2023-12-11 17:56:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# INSTALL APP
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installing app..." --weight=5
|
|
|
|
|
|
|
|
pushd $install_dir
|
|
|
|
python3 -m venv venv
|
2023-12-12 10:55:14 +01:00
|
|
|
. venv/bin/activate
|
2023-12-12 11:20:21 +01:00
|
|
|
pip3 install -U lucterios lucterios-standard lucterios-contacts lucterios-documents
|
|
|
|
pip3 install -U diacamma-asso diacamma-syndic diacamma-financial
|
|
|
|
pip3 install -U gunicorn psycopg2-binary psycopg2
|
2023-12-12 12:04:12 +01:00
|
|
|
lucterios_admin.py installed
|
2023-12-12 11:58:14 +01:00
|
|
|
ls -l $install_dir/venv/lib/python3.8/site-packages/lucterios
|
|
|
|
ls -l $install_dir/venv/lib/python3.8/site-packages/diacamma
|
2023-12-12 12:04:12 +01:00
|
|
|
ynh_script_progression --message=" >> PYTHONPATH=${PYTHONPATH}"
|
2023-12-12 11:38:41 +01:00
|
|
|
lucterios_admin.py add -n ${app} -p "${APPLITYPE}" -m "${MODULES}" -d "${DATABASE}" -e '{"LANGUAGES":"'${language}'"}'
|
|
|
|
|
|
|
|
refresh_collect
|
2023-12-11 17:56:26 +01:00
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
chmod 400 "$install_dir/"
|
|
|
|
chown ${app}:${app} "$install_dir/"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SYSTEM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding system configurations related to ${app}..."
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
### `ynh_systemd_config` is used to configure a systemd script for an app, using the conf/systemd.service template
|
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
|
|
|
|
### `yunohost service add` integrates a service in YunoHost. It then gets
|
|
|
|
### displayed in the admin interface and through the others `yunohost service` commands.
|
|
|
|
|
|
|
|
yunohost service add ${app} --log="/var/log/${app}/${app}.log"
|
|
|
|
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
|
|
|
|
|
|
|
# Create a dedicated Fail2Ban config
|
|
|
|
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex=""
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting app's systemd service..."
|
|
|
|
|
|
|
|
# Start a systemd service
|
|
|
|
ynh_systemd_action --service_name=${app} --action="start" --log_path="/var/log/${app}/${app}.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of ${app} completed" --last
|