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-15 16:58:51 +01:00
|
|
|
if [ $develop -eq 1 ]
|
2023-12-15 16:31:47 +01:00
|
|
|
then
|
2023-12-15 16:58:51 +01:00
|
|
|
ynh_add_config --template="../conf/extra_url" --destination="./extra_url"
|
2023-12-15 16:31:47 +01:00
|
|
|
pip_option='--extra-index-url "https://pypi.diacamma.org"'
|
|
|
|
else
|
|
|
|
pip_option=''
|
|
|
|
fi
|
|
|
|
venv/bin/pip3 install -U lucterios lucterios-standard lucterios-contacts lucterios-documents $pip_option
|
|
|
|
venv/bin/pip3 install -U diacamma-asso diacamma-syndic diacamma-financial $pip_option
|
2023-12-14 17:15:30 +01:00
|
|
|
venv/bin/pip3 install -U gunicorn psycopg2-binary psycopg2 django-auth-ldap3-ad
|
2023-12-14 19:48:34 +01:00
|
|
|
sed -i 's|member=%s|inheritPermission=%s|g' venv/lib/python*/site-packages/django_auth_ldap3_ad/auth.py
|
2023-12-12 13:07:45 +01:00
|
|
|
venv/bin/lucterios_admin.py installed
|
2023-12-13 16:15:51 +01:00
|
|
|
ynh_add_config --template="../conf/extra_diacamma.json" --destination="/tmp/extra.json"
|
|
|
|
extra_json=$(jq -c . /tmp/extra.json)
|
2023-12-14 18:14:31 +01:00
|
|
|
venv/bin/lucterios_admin.py add -n inst-${app} -p "${APPLITYPE}" -m "${MODULES}" -d "${DATABASE}" -e ''$extra_json''
|
2023-12-12 13:07:45 +01:00
|
|
|
popd
|
2023-12-12 11:38:41 +01:00
|
|
|
|
2023-12-12 16:28:42 +01:00
|
|
|
if [ ! -z "$archive" ]
|
|
|
|
then
|
2023-12-12 16:43:55 +01:00
|
|
|
curl $archive > /tmp/diacamma_archive.lbk
|
2023-12-12 16:28:42 +01:00
|
|
|
pushd $install_dir
|
2023-12-12 16:54:49 +01:00
|
|
|
venv/bin/lucterios_admin.py restore -n inst-${app} -f /tmp/diacamma_archive.lbk
|
2023-12-12 16:28:42 +01:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2023-12-15 16:31:47 +01:00
|
|
|
refresh_collect
|
|
|
|
|
2023-12-12 16:28:42 +01:00
|
|
|
check_params
|
|
|
|
|
2023-12-11 17:56:26 +01:00
|
|
|
#=================================================
|
|
|
|
# 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
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# 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"
|
|
|
|
|
2023-12-15 15:57:46 +01:00
|
|
|
|
2023-12-15 15:15:01 +01:00
|
|
|
# FIXME : temporary debug
|
2023-12-15 15:57:46 +01:00
|
|
|
sleep 10 # Maybe the service needs a few seconds to actually start ...
|
2023-12-15 15:15:01 +01:00
|
|
|
|
2023-12-11 17:56:26 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2023-12-15 15:15:01 +01:00
|
|
|
ynh_script_progression --message="Installation of ${app} completed" --last
|