From 3f5780c8068d471a77f58e6ddae981a3b79a29a6 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 22:43:11 +0200 Subject: [PATCH] cleaning --- conf/config.yml | 2 +- conf/systemd.service | 4 ++-- manifest.toml | 4 ++-- scripts/backup | 7 +------ scripts/change_url | 2 +- scripts/install | 1 - scripts/restore | 1 - scripts/upgrade | 8 ++++---- 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/conf/config.yml b/conf/config.yml index f7f11a8..e7f1585 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__" # 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/systemd.service b/conf/systemd.service index 4abdff6..8bb8aa2 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=/var/www/__APP__/ -ExecStart=/var/www/__APP__/vikunja +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/vikunja RestartSec=2s Restart=always diff --git a/manifest.toml b/manifest.toml index 4897279..89e51ca 100644 --- a/manifest.toml +++ b/manifest.toml @@ -66,8 +66,6 @@ ram.runtime = "50M" autoupdate.asset.arm64 = "tarball" autoupdate.asset.armhf = "tarball" - [resources.ports] - [resources.system_user] allow_email = true @@ -80,6 +78,8 @@ ram.runtime = "50M" api.allowed = "visitors" api.auth_header = false + [resources.ports] + [resources.apt] packages = "postgresql" diff --git a/scripts/backup b/scripts/backup index a9ec4d0..c711f03 100644 --- a/scripts/backup +++ b/scripts/backup @@ -18,19 +18,14 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -# Frontend ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM 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/change_url b/scripts/change_url index b3ee07d..e8cbf6f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -40,7 +40,7 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 domain="$new_domain" path="$new_path" -ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config.yml" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" chmod 600 "$install_dir/config.yml" diff --git a/scripts/install b/scripts/install index a467126..a3fae88 100644 --- a/scripts/install +++ b/scripts/install @@ -52,7 +52,6 @@ executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")" mv "$executable" "$install_dir/vikunja" chmod +x "$install_dir/vikunja" - chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" diff --git a/scripts/restore b/scripts/restore index 84e0014..72d6098 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Restoring $app main directory..." --weight=4 -# Frontend ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" diff --git a/scripts/upgrade b/scripts/upgrade index e9ee5ec..9251252 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,9 +102,9 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# UPGRADE A CONFIGURATION +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Upgrading a configuration file..." --weight=1 +ynh_script_progression --message="Updating $app's configuration files..." --weight=1 ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" @@ -112,9 +112,9 @@ chmod 400 "$install_dir/config.yml" chown $app:$app "$install_dir/config.yml" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_add_nginx_config