mirror of
https://github.com/YunoHost-Apps/isso_ynh.git
synced 2024-09-03 19:35:55 +02:00
83 lines
2.7 KiB
Bash
Executable file
83 lines
2.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
|
|
|
#=================================================
|
|
# Setup Final Path
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
mkdir -p $install_dir
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
|
|
pushd $install_dir
|
|
ynh_exec_as $app python3 -m venv $install_dir/venv
|
|
ynh_exec_as $app "$install_dir/venv/bin/pip" install --upgrade pip
|
|
ynh_exec_as $app "$install_dir/venv/bin/pip" install --upgrade setuptools
|
|
ynh_exec_as $app "$install_dir/venv/bin/pip" install --upgrade MarkupSafe
|
|
ynh_exec_as $app "$install_dir/venv/bin/pip" install isso gunicorn
|
|
popd
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
ynh_add_config --template="isso.cfg" --destination="$install_dir/isso.cfg"
|
|
|
|
chmod 400 "$install_dir/isso.cfg"
|
|
chown $app:$app "$install_dir/isso.cfg"
|
|
|
|
#=================================================
|
|
# SETUP SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_use_logrotate
|
|
|
|
yunohost service add $app --description="Lightweight commenting server" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|