From 6bc10dd6a0f6a7d32ec3ebe86c905f33624312b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 29 Jul 2024 21:56:27 +0200 Subject: [PATCH] fix --- conf/config.yml | 2 +- conf/nginx.conf | 2 +- conf/systemd.service | 4 ++-- config_panel.toml | 18 +++++++++--------- manifest.toml | 1 - scripts/backup | 8 -------- scripts/install | 23 ++++++----------------- scripts/remove | 3 --- scripts/restore | 9 ++------- scripts/upgrade | 14 +++++--------- 10 files changed, 26 insertions(+), 58 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index f7f11a8..40b00fa 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -21,7 +21,7 @@ service: # The base path on the file system where the binary and assets are. # Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder # with a config file which will then be used. - rootpath: "/opt/vikunja/" + rootpath: "__INSTALL_DIR__/backend" # Path on the file system to serve static files from. Set to the path of the frontend files to host frontend alongside the api. staticpath: "" # The max number of items which can be returned per page diff --git a/conf/nginx.conf b/conf/nginx.conf index e693a5d..2ebbddd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/front/; try_files $uri $uri/ /; diff --git a/conf/systemd.service b/conf/systemd.service index 8d1a42d..ce2db5c 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Requires=postgresql.service redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=/opt/__APP__/ -ExecStart=/opt/__APP__/vikunja +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/backend/vikunja RestartSec=2s Restart=always diff --git a/config_panel.toml b/config_panel.toml index 64d977b..389df9e 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ services = ["__APP__"] ask.fr = "Définir le MOTD" type = "string" help = "Set the MOTD message shown in Vikunja login page" - bind = "motd:/opt/__APP__/config.yml" + bind = "motd:__INSTALL_DIR__/backend/config.yml" [main.config.enable_registration] ask.en = "Enable registration" @@ -22,7 +22,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether to let new users registering themselves or not" - bind = "enableregistration:/opt/__APP__/config.yml" + bind = "enableregistration:__INSTALL_DIR__/backend/config.yml" [main.config.enable_linksharing] ask.en = "Enable links sharing" @@ -31,7 +31,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable sharing of lists via a link" - bind = "enablelinksharing:/opt/__APP__/config.yml" + bind = "enablelinksharing:__INSTALL_DIR__/backend/config.yml" [main.config.enable_taskattachments] ask.en = "Enable tasks attachments" @@ -40,7 +40,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether to enable task attachments or not" - bind = "enabletaskattachments:/opt/__APP__/config.yml" + bind = "enabletaskattachments:__INSTALL_DIR__/backend/config.yml" [main.config.enable_taskcomments] ask.en = "Enable task comments" @@ -49,7 +49,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether task comments should be enabled or not" - bind = "enabletaskcomments:/opt/__APP__/config.yml" + bind = "enabletaskcomments:__INSTALL_DIR__/backend/config.yml" [main.config.enable_emailreminders] ask.en = "Enable email reminders" @@ -58,7 +58,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "If enabled, vikunja will send an email to everyone who is either assigned to a task or created it when a task reminder is due." - bind = "enableemailreminders:/opt/__APP__/config.yml" + bind = "enableemailreminders:__INSTALL_DIR__/backend/config.yml" [main.config.enable_userdeletion] ask.en = "Enable user deletion" @@ -67,19 +67,19 @@ services = ["__APP__"] yes = "true" no = "false" help = "If true, will allow users to request the complete deletion of their account. When using external authentication methods it may be required to coordinate with them in order to delete the account. This setting will not affect the cli commands for user deletion" - bind = "enableuserdeletion:/opt/__APP__/config.yml" + bind = "enableuserdeletion:__INSTALL_DIR__/backend/config.yml" [main.config.maxavatarsize] ask.en = "Max avatar size" ask.fr = "Taille maximum de l'avatar" type = "number" help = "The maximum size clients will be able to request for user avatars. If clients request a size bigger than this, it will be changed on the fly" - bind = "maxavatarsize:/opt/__APP__/config.yml" + bind = "maxavatarsize:__INSTALL_DIR__/backend/config.yml" [main.config.maxitemsperpage] ask.en = "Max items per page" ask.fr = "Nombre d'éléments maximum par page" type = "number" help = "The max number of items which can be returned per page" - bind = "maxitemsperpage:/opt/__APP__/config.yml" + bind = "maxitemsperpage:__INSTALL_DIR__/backend/config.yml" diff --git a/manifest.toml b/manifest.toml index 5d85273..86e6994 100644 --- a/manifest.toml +++ b/manifest.toml @@ -64,7 +64,6 @@ ram.runtime = "50M" in_subdir = false format = "zip" - [resources.ports] [resources.system_user] diff --git a/scripts/backup b/scripts/backup index 64e1a14..50ae862 100644 --- a/scripts/backup +++ b/scripts/backup @@ -18,22 +18,14 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -# Frontend ynh_backup --src_path="$install_dir" -# Backend -ynh_backup --src_path="$backend_path" - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/install b/scripts/install index 30293fd..3ad8d40 100644 --- a/scripts/install +++ b/scripts/install @@ -49,26 +49,15 @@ ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage 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" +ynh_setup_source --dest_dir="$install_dir/front" --source_id="front" +ynh_setup_source --dest_dir="$install_dir/backend" --source_id="back" +tempdir="$(mktemp -d)" +back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" +cp "$back" "$install_dir/backend/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" - -#================================================= -# INSTALL BACKEND -#================================================= -ynh_script_progression --message="Setting up backend..." --weight=1 - -# Download, check integrity, uncompress and patch the source from app.src -mkdir -p "$backend_path" -mkdir -p "$backend_path/files" -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id="back" -back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" -cp "$back" "$backend_path/vikunja" - -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod +x "$install_dir/backend/vikunja" #================================================= # SYSTEM CONFIGURATION diff --git a/scripts/remove b/scripts/remove index 0e09476..9711ade 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,9 +28,6 @@ ynh_remove_systemd_config ynh_redis_remove_db "$redis_db" -# Remove backend -ynh_secure_remove --file="$backend_path" - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 8e89323..f153e20 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,16 +14,11 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Restoring $app main directory..." --weight=4 -# Frontend ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" + chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" - -# Backend -ynh_restore_file --origin_path="$backend_path" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod +x "$install_dir/backend/vikunja" #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 45ad19b..1754f60 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,20 +92,16 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= ynh_script_progression --message="Upgrading source files..." --weight=5 -# Frontend -ynh_setup_source --dest_dir="$install_dir" --source_id="front" - -# Backend -mkdir -p "$backend_path/files" +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir/front" --source_id="front" --full_replace=1 +ynh_setup_source --dest_dir="$install_dir/backend" --source_id="back" --full_replace=1 --keep="$install_dir/backend/config.yml" tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id="back" back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" -cp "$back" "$backend_path/vikunja" +cp "$back" "$install_dir/backend/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod +x "$install_dir/backend/vikunja" #================================================= # UPGRADE A CONFIGURATION