1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vikunja_ynh.git synced 2024-09-03 18:06:26 +02:00
This commit is contained in:
Éric Gaspar 2023-10-27 09:20:57 +02:00
parent 9a8f6c3905
commit 684c17dd0c
5 changed files with 31 additions and 54 deletions

View file

@ -5,7 +5,7 @@ name = "Vikunja"
description.en = "Self-hosted To-Do list application"
description.fr = "Application de liste de tâches auto-hébergée"
version = "0.21.0~ynh4"
version = "0.21.0~ynh5"
maintainers = ["eric_G"]
@ -41,7 +41,7 @@ ram.runtime = "50M"
ask.fr = "Choisissez la langue de l'application"
type = "select"
choices = ["de", "en", "es", "fa", "fr", "it", "lt", "nl", "pl", "pt"]
default = "en"
default = "fr"
[resources]

View file

@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers
timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32)
redis_db=$(ynh_redis_get_free_db)
backend_path=/opt/$app
set_motd=""
enable_registration="true"
@ -26,16 +28,11 @@ enable_userdeletion="true"
maxavatarsize=1024
maxitemsperpage=50
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
backend_path=/opt/$app
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path
ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd
ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration
ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing
@ -54,7 +51,6 @@ ynh_script_progression --message="Setting up frontend..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --source_id="front"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -63,8 +59,6 @@ chown -R $app:www-data "$install_dir"
#=================================================
ynh_script_progression --message="Setting up backend..." --weight=1
ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path
# Download, check integrity, uncompress and patch the source from app.src
mkdir -p "$backend_path"
mkdir -p "$backend_path/files"
@ -77,20 +71,9 @@ chmod +x "$backend_path/vikunja"
chown -R $app:www-data "$backend_path/files"
#=================================================
# ADD A CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
redis_db=$(ynh_redis_get_free_db)
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
chmod 400 "$backend_path/config.yml"
chown $app:$app "$backend_path/config.yml"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_add_nginx_config
@ -98,6 +81,16 @@ ynh_add_systemd_config
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="config.yml" --destination="$backend_path/config.yml"
chmod 400 "$backend_path/config.yml"
chown $app:$app "$backend_path/config.yml"
#=================================================
# START SYSTEMD SERVICE
#=================================================

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -22,34 +23,14 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE REDIS DATABASE
#=================================================
ynh_script_progression --message="Removing the redis database..."
ynh_redis_remove_db "$redis_db"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing $app main directory..." --weight=6
# Remove backend
ynh_secure_remove --file="$backend_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
# Remove the dedicated NGINX config
ynh_remove_nginx_config

View file

@ -30,12 +30,14 @@ chown -R $app:www-data "$backend_path/files"
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -45,9 +47,11 @@ systemctl enable $app.service --quiet
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
# GENERIC FINALIZATION
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="server started on"

View file

@ -15,6 +15,7 @@ source /usr/share/yunohost/helpers
timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32)
redis_db=$(ynh_redis_get_free_db)
#=================================================
# CHECK VERSION
@ -121,8 +122,7 @@ chown -R $app:www-data "$backend_path/files"
#=================================================
ynh_script_progression --message="Upgrading a configuration file..." --weight=1
redis_db=$(ynh_redis_get_free_db)
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
ynh_add_config --template="config.yml" --destination="$backend_path/config.yml"
chmod 400 "$backend_path/config.yml"
chown $app:$app "$backend_path/config.yml"
@ -132,7 +132,6 @@ chown $app:$app "$backend_path/config.yml"
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_systemd_config