1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #494 from iiab/master

Sync from iiab/iiab:master
This commit is contained in:
A Holt 2021-05-19 21:34:45 -04:00 committed by GitHub
commit c89895b1ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 100 additions and 60 deletions

View file

@ -4,12 +4,13 @@ dist: focal
addons:
apt:
sources:
- sourceline: ppa:ansible/ansible
# sources:
# - sourceline: ppa:ansible/ansible
packages:
# - python-pip # @arky had used this starting in 2018
- ansible-base # Install latest ansible-base e.g. 2.10.9+, similar to https://github.com/iiab/iiab/blob/master/scripts/ansible
# - python3-pymysql # These 7-or-8 packages are not needed during this very rapid --syntax-check
# - python3-pip # Modern equivalent (but no need, as pip3 is pre-installed here on Travis)
# - ansible-core # SLOW. WHEN IT WORKS AT ALL. Using 'pip3 install ansible-core' instead (below) is faster and greatly simplifies. Certainly let's try to mimic https://github.com/iiab/iiab/blob/master/scripts/ansible (as it evolves) for linting etc?
# - python3-pymysql # These 7-or-8 packages (below) are not needed during the very rapid --syntax-check (core script, at bottom)
# - python3-psycopg2
# - python3-passlib
# - python3-pip
@ -20,14 +21,13 @@ addons:
install:
# - scripts/ansible # See #2105: fails to install latest Ansible (& ~4 Ansible Collections from collections.yml) due to Travis VM's disk layout/perms being different
# - pip install ansible # SLOW/OVERWEIGHT: installs Ansible 3.0.0+ with ~80 Ansible Collections
# - pip install ansible-base # ALSO WORKS (FASTER THAN ALL ABOVE!) e.g. if the above addons: / apt: section is commented out. To install latest ansible-base e.g. 2.10.7+, similar to https://github.com/iiab/iiab/blob/master/scripts/ansible
# - pip3 install ansible-core # APRIL 2021: ansible-base is being renamed to ansible-core -- latest version number is listed at https://pypi.org/project/ansible-core/
- ansible-galaxy collection install -r collections.yml # Install ~4 Ansible Collections
- "{ echo 'roles_path = ./roles/'; } >> ansible.cfg" # Add correct roles_path to ansible.cfg, appending to https://github.com/iiab/iiab/blob/master/ansible.cfg
# - "{ echo '[defaults]'; echo 'roles_path = ./roles/'; } >> ansible.cfg" # 2021-02-24: suddenly no longer works, with the newer ansible-base install methods above (error arises due to '[defaults]' appearing twice)
# - cat ansible.cfg # UNCOMMENT TO VERIFY!
- apt -a list ansible-base # VERIFY ansible-base VERSIONS OFFERED BY apt
# - pip3 install ansible # SLOW / OVERWEIGHT: installs Ansible 4.0.0+ superset, with more than 80 (far more than we need) Ansible Collections
- pip3 install ansible-core # SIGNIFICANTLY FASTER than apt install of ansible-core (in 'packages:' section above). APRIL 2021: ansible-base (2.10) was renamed to ansible-core (2.11+) with the latest version number shown at https://pypi.org/project/ansible-core/
- ansible-galaxy collection install -r collections.yml # Install ~4 Ansible Collections. Slow but nec, as per https://github.com/iiab/iiab/blob/master/scripts/ansible
- echo 'roles_path = ./roles/' >> ansible.cfg # Add correct roles_path to ansible.cfg, appending to https://github.com/iiab/iiab/blob/master/ansible.cfg
# - "{ echo '[defaults]'; echo 'roles_path = ./roles/'; } >> ansible.cfg" # 2021-02-24: suddenly no longer works, with the newer ansible-base -> ansible-core install methods above (error arises due to '[defaults]' appearing twice)
- cat ansible.cfg # VISUAL VERIFICATION OF ABOVE!
# - apt -a list ansible-core # VERIFY ansible-core VERSIONS OFFERED BY apt, from https://launchpad.net/~ansible/+archive/ubuntu/ansible
script:
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

View file

@ -43,7 +43,7 @@
msg: "Could not find a binary for the CPU architecture \"{{ ansible_architecture }}\""
when: gitea_iset_suffix == "unknown"
- name: Download Gitea binary {{ gitea_download_url }} to {{ gitea_install_path }}
- name: Download Gitea binary {{ gitea_download_url }} to {{ gitea_install_path }} (~103 MB, CAN TAKE 20 MIN)
get_url:
url: "{{ gitea_download_url }}"
dest: "{{ gitea_install_path }}"

View file

@ -1,7 +1,9 @@
# lokole_install: False
# lokole_enabled: False
# lokole_sim_type: LocalOnly # lokole_sim_type: Ethernet
# lokole_sim_type can be: 'hologram', 'Ethernet', 'LocalOnly', or 'mkwvconf'
# Details: https://github.com/ascoderu/lokole/blob/master/install.py#L35
# lokole_sim_type: LocalOnly
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
@ -24,7 +26,8 @@ lokole_user: lokole
lokole_url: /lokole
lokole_uid: "2000"
lokole_run_directory: /home/{{ lokole_user }}/state
lokole_domain_socket: "/run/lokole_gunicorn.sock"
lokole_log_directory: /home/{{ lokole_user }}/log
lokole_domain_socket: "{{ lokole_run_directory }}/lokole_gunicorn.sock"
lokole_sim_type: LocalOnly
lokole_full_url: "http://{{ iiab_hostname }}.{{ iiab_domain }}{{ lokole_url }}" # http://box.lan/lokole

View file

@ -83,24 +83,25 @@
file:
state: directory
path: "{{ lokole_run_directory }}"
#mode: a+x # Not nec, given above 'state: directory'
group: "{{ lokole_user }}"
owner: "{{ lokole_user }}"
mode: g+rw
# lets try to catch settings.env creation at registration time
# can't tell if the routine doesn't like settings.env being missing
- name: mkdir /{{ lokole_user }}/state for registration testing
- name: mkdir /{{ lokole_user }}/log
file:
state: directory
path: /{{ lokole_user }}/state
path: "{{ lokole_log_directory }}"
group: "{{ lokole_user }}"
owner: "{{ lokole_user }}"
mode: g+rw
- name: Install dummy target for registration testing fake
template:
src: settings.env.j2
dest: "/{{ lokole_user }}/state/settings.env"
- name: Install dummy target for registration testing run
- name: Install {{ lokole_run_directory }}/settings.env
template:
src: settings.env.j2
dest: "{{ lokole_run_directory }}/settings.env"
group: "{{ lokole_user }}"
owner: "{{ lokole_user }}"
mode: a+rw
- name: Install {{ lokole_run_directory }}/webapp_secrets.sh from template, to configure Lokole
template:
@ -112,6 +113,8 @@
template:
src: webapp.sh.j2
dest: "{{ lokole_run_directory }}/webapp.sh"
group: "{{ lokole_user }}"
owner: "{{ lokole_user }}"
mode: a+x
- name: Create Lokole admin user with password, for http://box{{ lokole_url }} # http://box/lokole

View file

@ -6,6 +6,7 @@ Before=celerybeat.service
[Service]
Type=simple
EnvironmentFile={{ lokole_run_directory }}/settings.env
ExecStart={{ lokole_venv }}/bin/celery --uid={{ lokole_uid }} --gid={{ lokole_uid }} --app=opwen_email_client.webapp.tasks worker --loglevel=info --concurrency=2
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill TERM $MAINPID

View file

@ -6,6 +6,7 @@ Before=lokole_restarter.service
[Service]
Type=simple
EnvironmentFile={{ lokole_run_directory }}/settings.env
ExecStart={{ lokole_venv }}/bin/celery --app=opwen_email_client.webapp.tasks beat --loglevel=info
[Install]

View file

@ -5,6 +5,7 @@ After=network.target
[Service]
Type=simple
EnvironmentFile={{ lokole_run_directory }}/settings.env
ExecStart=/bin/bash {{ lokole_run_directory }}/webapp.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

View file

@ -5,6 +5,7 @@ After=celerybeat.service
[Service]
Type=simple
EnvironmentFile={{ lokole_run_directory }}/settings.env
WorkingDirectory={{ lokole_run_directory }}
ExecStart={{ lokole_venv }}/bin/manage.py restarter --directory={{ lokole_run_directory }}

View file

@ -1,7 +1,8 @@
OPWEN_SIM_TYPE='{{ lokole_sim_type }}'
OPWEN_SETTINGS='{{ lokole_run_directory }}/settings.env'
OPWEN_STATE_DIRECTORY='{{ lokole_run_directory }}'
OPWEN_APP_ROOT='{{ lokole_url }}/'
OPWEN_MAX_UPLOAD_SIZE_MB=10
OPWEN_SYNC_SCHEDULE='1,16,31,46 * * * *'
OPWEN_SESSION_KEY='{{ lookup('password', '/dev/null chars=ascii_letters,digits,_ length=32') }}'
OPWEN_PASSWORD_SALT='{{ lookup('password', '/dev/null chars=ascii_letters,digits,_ length=16') }}'
OPWEN_SIM_TYPE='{{ lokole_sim_type }}'

View file

@ -1,3 +1,4 @@
export OPWEN_SETTINGS='{{ lokole_run_directory }}/settings.env'
export OPWEN_SIM_TYPE='{{ lokole_sim_type }}'
export OPWEN_STATE_DIRECTORY='{{ lokole_run_directory }}'
export OPWEN_APP_ROOT='{{ lokole_url }}/'

View file

@ -94,7 +94,7 @@
state: directory
path: "{{ nextcloud_root_dir }}" # /library/www/nextcloud
- name: Unarchive {{ nextcloud_dl_url }} (100+ MB) to {{ nextcloud_root_dir }} (400+ MB, {{ apache_user }}:{{ apache_user }})
- name: Unarchive {{ nextcloud_dl_url }} (100+ MB) to {{ nextcloud_root_dir }} (~449 MB, {{ apache_user }}:{{ apache_user }})
unarchive:
remote_src: yes # Overwrite even if "already exists on the target"
src: "{{ nextcloud_dl_url }}"

View file

@ -9,9 +9,19 @@
APT_PATH=/usr/bin # Avoids problematic /usr/local/bin/apt on Linux Mint
CURR_VER=undefined # Ansible version you currently have installed
GOOD_VER=2.10.9 # Orig for 'yum install [rpm]' & XO laptops (pip install)
GOOD_VER=2.11.0 # Orig for 'yum install [rpm]' & XO laptops (pip install)
# We install the latest 'ansible-base' from PPA, using an OS 'CODENAME' below:
# 2021-05-19 PR #2743: As a result of Ansible / Red Hat / IBM's extensive
# delays in publishing the PPA (.deb installer files) for ansible-core, this
# file bypasses the apt approach (and associated PPA source) in favor of:
#
# pip3 install ansible-core
#
# What the future holds for 2022+ is not yet clear. So the apt approach (with
# PPA source in /etc/apt/sources.list.d and .gpg key etc) and much associated
# guidance/comments below are NOT being commented out or deleted at this time.
# We install the latest 'ansible-core' from PPA, using an OS 'CODENAME' below:
# https://launchpad.net/~ansible/+archive/ubuntu/ansible
# 'lsb_release -sc' gives Mint 20 codename 'ulyana' etc: (TOO FINE-GRAINED)
@ -21,33 +31,41 @@ else
CODENAME=focal # Debian 11+, RaspiOS 11+, Ubuntu 20.04+, Mint 20+ (ETC)
fi
# 'ansible-base' being renamed 'ansible-code' early in 2021. RELEASE LINK REFS:
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-base/
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.10
# https://github.com/ansible/ansible/commits/stable-2.10/changelogs/CHANGELOG-v2.10.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_11.rst
# APRIL 2021 - ansible-base (2.10) was renamed to ansible-core (2.11+):
# https://www.ansible.com/blog/ansible-3.0.0-qa
# https://github.com/ansible/ansible/releases
# https://pypi.org/project/ansible-base/
# https://pypi.org/project/ansible-core/
# https://releases.ansible.com/ansible-base/
# https://releases.ansible.com/ansible-core/
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.10
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.11 ?
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-base/
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-core/ ?
# https://github.com/ansible/ansible/blob/stable-2.10/changelogs/CHANGELOG-v2.10.rst
# https://github.com/ansible/ansible/blob/stable-2.11/changelogs/CHANGELOG-v2.11.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_10.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_11.rst
# FYI .travis.yml installs ansible-base in a slightly different way (PR #2689).
# FYI .travis.yml installs ansible-core in a slightly different way (PRs #2689, #2742 or #2743 ?)
# IIAB implementers might instead consider these 4 GENERAL TECHNIQUES below
# ("in an emergency!") e.g. if apt fails & you need a newer/older Ansible:
# TEMPORARILY USE pip3 to install the latest ansible-core as listed at
# https://pypi.org/project/ansible-core/ (REMOVE W/ "pip3 uninstall ansible-core")
#apt install python3-pip
#pip3 install ansible-core # Then start a new shell, so /usr/local/bin works
#apt install python3-pymysql python3-psycopg2 python3-passlib python3-pip python3-setuptools python3-packaging python3-venv virtualenv
#ansible-galaxy collection install -r collections.yml
# TEMPORARILY USE ansible-base 2.10.9 (REMOVE W/ "pip3 uninstall ansible-base")
#apt install python3-pip
#pip3 install ansible-base==2.10.9 # Start new shell, so /usr/local/bin works
# TEMPORARILY USE ANSIBLE 2.9.21 (REMOVE IT WITH "pip uninstall ansible")
#apt install python-pip
#pip install ansible==2.9.21
#apt install python3-pip
#pip3 install ansible==2.9.21
# TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. Details: iiab/iiab#669
#echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb"
@ -65,8 +83,9 @@ echo -e "\n\nYOU ARE RUNNING: /opt/iiab/iiab/scripts/ansible (TO INSTALL ANSIBLE
echo -e "RECOMMENDED PREREQUISITES:"
echo -e "(1) Verify you're online"
echo -e "(2) Remove all prior versions of Ansible using..."
echo -e " 'apt purge ansible-core' and/or 'pip3 uninstall ansible-core' and/or"
echo -e " 'apt purge ansible-base' and/or 'pip3 uninstall ansible-base' and/or"
echo -e " 'apt purge ansible' and/or 'pip uninstall ansible'"
echo -e " 'apt purge ansible' and/or 'pip3 uninstall ansible'"
echo -e "(3) Remove all lines containing 'ansible' from..."
echo -e " /etc/apt/sources.list and /etc/apt/sources.list.d/*\n"
@ -82,7 +101,7 @@ if [ $(command -v ansible) ]; then # "command -v" is POSIX compliant; also ca
else
echo -e "ANSIBLE NOT FOUND ON THIS COMPUTER -- LET'S TRY TO INSTALL IT!"
fi
echo -e "(Internet-in-a-Box requests ansible-base $GOOD_VER or higher)\n"
echo -e "(Internet-in-a-Box requests ansible-core $GOOD_VER or higher)\n"
# Code above designed to work on all Linux distributions, to preserve options,
# in support of any volunteer(s) wanting to port IIAB to a new Linux/distro.
@ -130,10 +149,13 @@ echo -e "IF *OTHER* ANSIBLE SOURCES APPEAR BELOW, PLEASE MANUALLY REMOVE THEM TO
echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
echo -e "\napt update; apt install ansible-base and python3 dependencies explained at:"
echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
echo -e "\napt update; apt install ansible-core and python3 dependencies explained at:"
echo -e "https://github.com/iiab/iiab/blob/master/scripts/ansible.md\n"
$APT_PATH/apt update
$APT_PATH/apt -y --allow-downgrades install ansible-base \
$APT_PATH/apt -y install python3-pip
pip3 install ansible-core
#$APT_PATH/apt -y --allow-downgrades install ansible-core \
$APT_PATH/apt -y --allow-downgrades install \
python3-pymysql python3-psycopg2 python3-passlib python3-pip \
python3-setuptools python3-packaging python3-venv virtualenv
@ -148,11 +170,15 @@ ansible-galaxy collection install --force-with-deps \
# 2021-02-24: 'ansible-galaxy collection list' lists those installed. (#2659)
# 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here:
# /root/.ansible/collections/ansible_collections
# But going forward they'll be stored herein:
# But going forward they'll be stored herein: [~24MB for 4 Collections as of 2021-05-19]
# /usr/share/ansible/collections/ansible_collections
echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n"
mkdir -p /etc/ansible
echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
# 2021-04-19: No longer needed, per PR #2743 testing
#echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n"
#mkdir -p /etc/ansible # LIKELY REDUNDANT, due to above installation of Ansible
#echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # LIKELY REDUNDANT, due to https://github.com/iiab/iiab/blob/master/ansible_hosts
echo -e "SUCCESS: VERIFY ANSIBLE WITH 'ansible --version' & 'apt -a list ansible-base'\n\n"
echo -e "SUCCESS INSTALLING ANSIBLE! PLEASE VERIFY WITH COMMANDS LIKE:"
echo -e " ansible --version"
echo -e " pip show ansible-core"
echo -e " apt -a list ansible-core\n\n"

View file

@ -389,7 +389,9 @@ jupyterhub_port: 8000
# Lokole (email for rural communities) from https://ascoderu.ca
lokole_install: False
lokole_enabled: False
lokole_sim_type: LocalOnly # lokole_sim_type: Ethernet
# lokole_sim_type can be: 'hologram', 'Ethernet', 'LocalOnly', or 'mkwvconf'
# Details: https://github.com/ascoderu/lokole/blob/master/install.py#L35
lokole_sim_type: LocalOnly
mediawiki_install: False
mediawiki_enabled: False

View file

@ -19,13 +19,11 @@ apache_log_dir: /var/log/apache2
smb_service: smbd
nmb_service: nmbd
systemctl_program: /bin/systemctl
# issue raised
mysql_service: mariadb
apache_log: /var/log/apache2/access.log
sshd_package: openssh-server
sshd_service: ssh
php_version: 7.4
# "postgresql_version: 11.2" failed (too detailed for /etc/systemd/system/postgresql-iiab.service on Ubuntu 19.04)
postgresql_version: 12
systemd_location: /lib/systemd/system
python_ver: 3.8

View file

@ -260,7 +260,9 @@ jupyterhub_enabled: True
# Lokole (email for rural communities) from https://ascoderu.ca
lokole_install: True
lokole_enabled: True
lokole_sim_type: LocalOnly # lokole_sim_type: Ethernet
# lokole_sim_type can be: 'hologram', 'Ethernet', 'LocalOnly', or 'mkwvconf'
# Details: https://github.com/ascoderu/lokole/blob/master/install.py#L35
lokole_sim_type: LocalOnly
mediawiki_install: True
mediawiki_enabled: True

View file

@ -260,7 +260,9 @@ jupyterhub_enabled: False
# Lokole (email for rural communities) from https://ascoderu.ca
lokole_install: False
lokole_enabled: False
lokole_sim_type: LocalOnly # lokole_sim_type: Ethernet
# lokole_sim_type can be: 'hologram', 'Ethernet', 'LocalOnly', or 'mkwvconf'
# Details: https://github.com/ascoderu/lokole/blob/master/install.py#L35
lokole_sim_type: LocalOnly
mediawiki_install: False
mediawiki_enabled: False

View file

@ -260,7 +260,9 @@ jupyterhub_enabled: False
# Lokole (email for rural communities) from https://ascoderu.ca
lokole_install: False
lokole_enabled: False
lokole_sim_type: LocalOnly # lokole_sim_type: Ethernet
# lokole_sim_type can be: 'hologram', 'Ethernet', 'LocalOnly', or 'mkwvconf'
# Details: https://github.com/ascoderu/lokole/blob/master/install.py#L35
lokole_sim_type: LocalOnly
mediawiki_install: False
mediawiki_enabled: False

View file

@ -17,13 +17,11 @@ apache_log_dir: /var/log/apache2
smb_service: smbd
nmb_service: nmbd
systemctl_program: /bin/systemctl
# issue raised
mysql_service: mariadb
apache_log: /var/log/apache2/access.log
sshd_package: openssh-server
sshd_service: ssh
php_version: 7.4
# "postgresql_version: 11.2" failed (too detailed for /etc/systemd/system/postgresql-iiab.service on Ubuntu 19.04)
postgresql_version: 12
systemd_location: /lib/systemd/system
python_ver: 3.8

View file

@ -17,13 +17,11 @@ apache_log_dir: /var/log/apache2
smb_service: smbd
nmb_service: nmbd
systemctl_program: /bin/systemctl
# issue raised
mysql_service: mariadb
apache_log: /var/log/apache2/access.log
sshd_package: openssh-server
sshd_service: ssh
php_version: 7.4 # 2020-04-22: Will Ubuntu 21.10 require 8.0?
# "postgresql_version: 11.2" failed (too detailed for /etc/systemd/system/postgresql-iiab.service on Ubuntu 19.04)
postgresql_version: 13 # 2020-04-22: Will Ubuntu 21.10 require 14?
php_version: 7.4 # 2021-04-22: Will Ubuntu 21.10 require 8.0?
postgresql_version: 13 # 2021-04-22: Will Ubuntu 21.10 require 14?
systemd_location: /lib/systemd/system
python_ver: 3.9