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

Merge pull request #386 from iiab/master

sync from iiab:master
This commit is contained in:
A Holt 2020-04-08 06:13:55 -04:00 committed by GitHub
commit 8b3b20c1b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 129 additions and 12 deletions

View file

@ -9,7 +9,7 @@
# Info needed to install Gitea:
gitea_version: 1.11.3
gitea_version: 1.11.4
iset_suffixes:
i386: 386
x86_64: amd64

View file

@ -13,9 +13,32 @@
- name: Install python2, if Raspbian/Debian > 10 or Ubuntu > 19
package:
name: python2
name:
- python2
- python-setuptools # provides setuptools-44 last version compatible with python2
state: present
when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19) # 2020-03-27: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
- name: Put wheel file in place if missing
get_url:
url: http://d.iiab.io/packages/ipaddress-0.0.0-py2.py3-none-any.whl
dest: /usr/share/python-wheels/ipaddress-0.0.0-py2.py3-none-any.whl
when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-04-02: python-pip-whl 20.0.2-2 is missing ipaddress-0.0.0-py2.py3-none-any.whl
# https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1869247
- name: Use pip to pin setuptools to 44 in {{ kalite_venv }} if Raspbian/Debian > 10 or Ubuntu > 19
pip:
name:
- setuptools==44
virtualenv: "{{ kalite_venv }}" # /usr/local/kalite/venv
virtualenv_site_packages: no
virtualenv_command: /usr/bin/virtualenv
virtualenv_python: python2.7
extra_args: "--no-use-pep517 --no-cache-dir --no-python-version-warning"
when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
- name: Use pip to install KA Lite static to {{ kalite_venv }}
pip:
@ -26,7 +49,6 @@
virtualenv_command: /usr/bin/virtualenv
virtualenv_python: python2.7
extra_args: "--no-cache-dir"
#extra_args="--disable-pip-version-check"
when: internet_available | bool
- name: "Install from template: venv wrapper /usr/bin/kalite, systemd unit file kalite-serve.service, Apache's kalite.conf"
@ -42,11 +64,22 @@
- { src: 'kalite-serve.service.j2', dest: '/etc/systemd/system/kalite-serve.service', mode: '0644'}
- { src: 'kalite.conf', dest: '/etc/{{ apache_conf_dir }}', mode: '0644'}
- name: Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes
- name: Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian < 11 or Ubuntu < 20
replace:
path: /usr/local/kalite/venv/local/lib/python2.7/site-packages/kalite/packages/dist/ifcfg/parser.py
regexp: 'a-zA-Z0-9'
replace: 'a-zA-Z0-9\-'
when: is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
- name: Fix KA Lite bug in regex parsing ifconfig output, for @m-anish's network names that contain dashes, if Raspbian/Debian > 10 or Ubuntu > 19
replace:
path: /usr/local/kalite/venv/lib/python2.7/site-packages/kalite/packages/dist/ifcfg/parser.py
regexp: 'a-zA-Z0-9'
replace: 'a-zA-Z0-9\-'
when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19)
# 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already.
# JV why not just is_ubuntu_20?
- name: Create dir {{ kalite_root }}
file:

View file

@ -1,4 +1,4 @@
location /kolibri/ {
location {{ kolibri_url_without_slash }} {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
@ -6,3 +6,9 @@ location /kolibri/ {
proxy_pass http://127.0.0.1:8009;
}
location /static/mathjax/2.1/ {
rewrite ^(.*)$ /kolibri$1 permanent;
}
location /static/images/spinner.gif {
rewrite ^(.*)$ /kolibri$1 permanent;
}

View file

@ -7,7 +7,7 @@ RemainAfterExit=yes
Environment=KOLIBRI_USER={{ kolibri_user }}
Environment=KOLIBRI_HOME={{ kolibri_home }}
Environment=KOLIBRI_HTTP_PORT={{ kolibri_http_port }}
Environment=KOLIBRI_URL_PATH_PREFIX={{ kolibri_url }}
Environment=KOLIBRI_URL_PATH_PREFIX={{ kolibri_url_without_slash }}
User={{ kolibri_user }}
Group={{ apache_user }}
TimeoutStartSec=infinity

View file

@ -56,6 +56,7 @@
src: "/etc/php/{{ php_version }}/mods-available/stem.ini"
path: "/etc/php/{{ php_version }}/fpm/conf.d/20-stem.ini"
state: link
when: php_version != 7.4
#when: nginx_enabled | bool
- name: Restart php{{ php_version }}-fpm systemd service

View file

@ -85,7 +85,7 @@
group: "{{ apache_user }}" # DO WE REALLY STILL WANT THIS FOR NGINX?
mode: '0660' # Others strongly recommend '0600' (or do PHP/Apache/NGINX really need group read & write permissions?)
- name: Install etc/{{ apache_conf_dir }}/wordpress.conf from template, for http://box{{ wp_url }} via Apache
- name: Install /etc/{{ apache_conf_dir }}/wordpress.conf from template, for http://box{{ wp_url }} via Apache
template:
src: wordpress.conf.j2
dest: "/etc/{{ apache_conf_dir }}/wordpress.conf"

View file

@ -5,7 +5,9 @@
- include_tasks: html.yml
- include_tasks: php-stem.yml
when: php_version != 7.4
- name: Create dir {{ doc_root }}/home -- if you customized var iiab_home_url e.g. in /etc/iiab/local_vars.yml, that dir is created later -- by www_options/tasks/main.yml
file:

75
scripts/comp-vars.py Executable file
View file

@ -0,0 +1,75 @@
#!/usr/bin/env python
from __future__ import print_function
import argparse
import yaml
def main():
args = parse_args()
comp_var_file = args.var_file
def_vars = read_yaml('/opt/iiab/iiab/vars/default_vars.yml')
comp_vars = read_yaml(comp_var_file)
list_extra_vars(comp_var_file, comp_vars, def_vars)
list_changed(comp_var_file, comp_vars, def_vars)
#min_vars = adm.read_yaml('/opt/iiab/iiab/vars/local_vars_min.yml')
#med_vars = adm.read_yaml('/opt/iiab/iiab/vars/local_vars_medium.yml')
#big_vars = adm.read_yaml('/opt/iiab/iiab/vars/local_vars_big.yml')
#list_extra_vars('min_vars', min_vars, def_vars)
#list_extra_vars('med_vars', med_vars, def_vars)
#list_extra_vars('big_vars', big_vars, def_vars)
#min_vars = remove_dups('min_vars', min_vars, def_vars)
#med_vars = remove_dups('med_vars', med_vars, def_vars)
#big_vars = remove_dups('big_vars', big_vars, def_vars)
def list_changed(file_name, var_dict, def_vars):
# { k : v for k,v in d.items() if v} - copy only filtered to new and return (muy pythonic)
print('Changed in ' + file_name)
for var_name in var_dict:
var_val = var_dict[var_name]
if var_val != def_vars.get(var_name):
print(var_name + ':', var_dict[var_name])
def remove_dups(dict_name, var_dict, def_vars):
# { k : v for k,v in d.items() if v} - copy only filtered to new and return (muy pythonic)
for var_name in var_dict.copy():
var_val = var_dict[var_name]
if var_val == def_vars.get(var_name):
del var_dict[var_name]
print(dict_name)
for var_name in var_dict:
print(var_name, var_dict[var_name])
return var_dict
def list_extra_vars(dict_name, var_dict, def_vars):
for var_name in var_dict:
if def_vars.get(var_name, 'ReallyNone!@#$') == 'ReallyNone!@#$':
print(dict_name, var_name, 'not in default')
# from adm_lib
def read_yaml(file_name, loader=yaml.SafeLoader):
try:
with open(file_name, 'r') as f:
y = yaml.load(f, Loader=loader)
return y
except:
raise
def parse_args():
parser = argparse.ArgumentParser(description="Compare vars file to default_vars.")
parser.add_argument("var_file", help="the full path to the local vars file you want to compare.")
#parser.add_argument("-z", "--zim", type=str, help="zim to update (e.g. wikipedia_en_medicine_maxi). Leave blank for All.")
return parser.parse_args()
# Now start the application
if __name__ == "__main__":
# Run the main routine
main()

View file

@ -214,10 +214,10 @@ read ans < /dev/tty
echo -e "\e[1m"
if [ "$ans" == "" ] || [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then
echo -ne "PUBLISHING TO URL... "
pastebinit < $outfile
pastebinit -b dpaste.com < $outfile # Run 'pastebinit -l' to list other possible pastebin site URLs
else
echo -e "If you later decide to publish it, run:"
echo
echo -e " pastebinit < $outfile"
echo -e " pastebinit -b dpaste.com < $outfile"
fi
echo -e "\e[0m"

View file

@ -47,7 +47,7 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things:
Or, you can later/manually upload it using the ``pastebinit`` command:
```
pastebinit < /etc/iiab/diag/NEW-FILE-NAME
pastebinit -b dpaste.com < /etc/iiab/diag/NEW-FILE-NAME
```
Either way, this will generate an actual web link (URL).

View file

@ -23,7 +23,7 @@ mysql_service: mariadb
apache_log: /var/log/apache2/access.log
sshd_package: openssh-server
sshd_service: ssh
php_version: 7.3 # 7.4 might be nec for Ubuntu 20.04 later?
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