From c6e1b18aa6a6a8db90fd6335a96e0f2f4f315a8d Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sun, 23 Jun 2024 08:56:30 +0200 Subject: [PATCH 01/11] upgrade helpers to v2.1 --- conf/.env.production | 3 +- conf/fittrackee.service | 3 -- conf/fittrackee_workers.service | 5 --- manifest.toml | 5 +-- scripts/backup | 25 ++++------- scripts/change_url | 47 +++++++------------- scripts/install | 73 ++++++++++++++---------------- scripts/remove | 28 +++++------- scripts/restore | 51 +++++++++------------ scripts/upgrade | 78 ++++++++++++--------------------- tests.toml | 1 + 11 files changed, 121 insertions(+), 198 deletions(-) diff --git a/conf/.env.production b/conf/.env.production index 7d4cb0f..94ed355 100644 --- a/conf/.env.production +++ b/conf/.env.production @@ -37,5 +37,4 @@ STATICMAP_SUBDOMAINS='' # Weather # available weather API providers: darksky, visualcrossing WEATHER_API_PROVIDER=__WEATHER_API_PROVIDER__ -WEATHER_API_KEY=__WEATHER_API_KEY__ - +WEATHER_API_KEY=__WEATHER_API_KEY__ \ No newline at end of file diff --git a/conf/fittrackee.service b/conf/fittrackee.service index 91b859a..0f967d7 100644 --- a/conf/fittrackee.service +++ b/conf/fittrackee.service @@ -1,11 +1,9 @@ - [Unit] Description=__APP__ service After=network.target After=postgresql.service After=redis.service - [Service] Type=simple Restart=always @@ -31,7 +29,6 @@ Environment="WEATHER_API_KEY=" WorkingDirectory=__INSTALL_DIR__/ ExecStart=__INSTALL_DIR__/venv/bin/gunicorn -b 127.0.0.1:__PORT__ "fittrackee:create_app()" --error-logfile /var/log/__APP__/__APP__.log - # Denying access to capabilities that should not be relevant for webapps # Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD diff --git a/conf/fittrackee_workers.service b/conf/fittrackee_workers.service index 8b10cb9..d16b5e9 100644 --- a/conf/fittrackee_workers.service +++ b/conf/fittrackee_workers.service @@ -5,7 +5,6 @@ After=network.target After=postgresql.service After=redis.service - [Service] Type=simple Restart=always @@ -28,10 +27,6 @@ Environment="REDIS_URL=" WorkingDirectory=__INSTALL_DIR__/ ExecStart=__INSTALL_DIR__/venv/bin/flask worker --processes 2 - - - - NoNewPrivileges=yes PrivateTmp=yes PrivateDevices=yes diff --git a/manifest.toml b/manifest.toml index 1ea9eb4..ec02a7f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,8 @@ admindoc = "https://samr1.github.io/FitTrackee" code = "https://github.com/SamR1/FitTrackee" [integration] -yunohost = ">= 11.2.12" +yunohost = ">= 11.2.15" +helpers_version = "2.1" architectures = "all" multi_instance = true @@ -33,7 +34,6 @@ ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.init_main_permission] @@ -41,7 +41,6 @@ ram.runtime = "50M" default = "visitors" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [install.password] diff --git a/scripts/backup b/scripts/backup index 8838463..91d857a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,48 +1,39 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/${app}.service" -ynh_backup --src_path="/etc/systemd/system/${app}_workers.service" +ynh_backup "/etc/systemd/system/${app}.service" +ynh_backup "/etc/systemd/system/${app}_workers.service" #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the PostgreSQL database..." +ynh_print_info "Backing up the PostgreSQL database..." -ynh_psql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 4c3ffde..7ca224a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -16,57 +10,48 @@ source /usr/share/yunohost/helpers admin=$(ynh_user_get_info --username=$admin --key=username) admin_mail=$(ynh_user_get_info --username=$admin --key=mail) -if [ -z "${weather_api_provider:-}" ]; then - weather_api_provider=$weather_provider - ynh_app_setting_set --app=$app --key=weather_api_provider --value=$weather_api_provider -fi +ynh_app_setting_set_default --key=weather_api_provider --value=$weather_provider -if [ -z "${weather_api_key:-}" ]; then - weather_api_key=$weather_key - ynh_app_setting_set --app=$app --key=weather_api_key --value=$weather_api_key -fi +ynh_app_setting_set_default --key=weather_api_key --value=$weather_key -if [ -z "${redis_db:-}" ]; then - redis_db=$(ynh_redis_get_free_db) - ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -fi +ynh_app_setting_set_default --key=redis_db --value=$(ynh_redis_get_free_db) -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --action="stop" --service_name="${app}" -ynh_systemd_action --action="stop" --service_name="${app}_workers" +ynh_systemctl --action="stop" --service="${app}" + +ynh_systemctl --action="stop" --service="${app}_workers" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # MODIFY THE CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." --weight=1 +ynh_script_progression "Updating configuration..." domain=$new_domain -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" +ynh_config_add --template=".env.production" --destination="$install_dir/.env" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting the systemd services..." --weight=15 +ynh_script_progression "Starting the systemd services..." # Start a systemd service -ynh_systemd_action --service_name="${app}" --action="start" -ynh_systemd_action --service_name="${app}_workers" --action="start" +ynh_systemctl --service="${app}" --action="start" + +ynh_systemctl --service="${app}_workers" --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" \ No newline at end of file diff --git a/scripts/install b/scripts/install index 4305637..98b7386 100755 --- a/scripts/install +++ b/scripts/install @@ -1,37 +1,29 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers admin=$(ynh_user_get_info --username=$admin --key=username) admin_mail=$(ynh_user_get_info --username=$admin --key=mail) -ynh_app_setting_set --app=$app --key=weather_api_provider --value=$weather_api_provider -ynh_app_setting_set --app=$app --key=weather_api_key --value=$weather_api_key +ynh_app_setting_set --key=weather_api_provider --value=$weather_api_provider +ynh_app_setting_set --key=weather_api_key --value=$weather_api_key # Configure redis redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" +ynh_app_setting_set --key=redis_db --value="$redis_db" # key for the .env __KEY__ key=$(ynh_string_random --length=45 | base64) -ynh_app_setting_set --app=$app --key=key --value=$key +ynh_app_setting_set --key=key --value=$key #================================================= # LOGROTATE #================================================= -ynh_script_progression --message="Configuring logrotate to manage application logfiles" --weight=1 +ynh_script_progression "Configuring logrotate to manage application logfiles" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --specific_user=$app -touch /var/log/$app/$app.log -touch /var/log/$app/${app}_workers.log -chown -R $app:www-data /var/log/$app/ +ynh_config_add_logrotate + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -39,9 +31,9 @@ chown -R $app:www-data /var/log/$app/ # CONFIGURE THE INSTALL SCRIPT #================================================= -ynh_script_progression --message="Setting up source files..." --weight=64 +ynh_script_progression "Setting up source files..." -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" +ynh_config_add --template=".env.production" --destination="$install_dir/.env" chmod 400 $install_dir/.env chown -R $app:www-data "$install_dir" @@ -49,85 +41,84 @@ chown -R $app:www-data "$install_dir" #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." --weight=3 +ynh_script_progression "Installing Python dependencies..." if [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "armel" ] then -# Install rustup is not already installed +# Install rustup if not already installed # We need this to be able to install cryptgraphy on ARM hardware export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" if [ -e $install_dir/.rustup ]; then - sudo -u "$app" env PATH=$PATH rustup update + ynh_exec_as_app PATH=$PATH rustup update else - sudo -u "$app" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' + ynh_exec_as_app bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' fi fi pushd $install_dir python3 -m venv $install_dir/venv source $install_dir/venv/bin/activate - ynh_exec_warn_less pip install --upgrade pip wheel toml pyyaml - ynh_exec_warn_less pip install fittrackee=="$(ynh_app_upstream_version)" + ynh_hide_warnings pip install --upgrade pip wheel toml pyyaml + ynh_hide_warnings pip install fittrackee=="$(ynh_app_upstream_version)" popd #================================================= # INITIALIZE DATABASE #================================================= - ynh_script_progression --message="Initializing database..." --weight=1 + ynh_script_progression "Initializing database..." + +set -a -set -a source $install_dir/.env -ynh_exec_warn_less $install_dir/venv/bin/ftcli db upgrade +ynh_hide_warnings $install_dir/venv/bin/ftcli db upgrade -ynh_exec_warn_less $install_dir/venv/bin/ftcli users create $admin --email $admin_mail --password $password --lang $language +ynh_hide_warnings $install_dir/venv/bin/ftcli users create $admin --email $admin_mail --password $password --lang $language -ynh_exec_warn_less $install_dir/venv/bin/ftcli users update $admin --set-admin true +ynh_hide_warnings $install_dir/venv/bin/ftcli users update $admin --set-admin true set +a #================================================= # System Configuration #================================================= -ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 +ynh_script_progression "Adding system configurations related to $app ..." #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression "Configuring NGINX web server..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression "Configuring $app's systemd service..." # Create a dedicated systemd config -ynh_add_systemd_config --service="${app}" --template="fittrackee.service" -ynh_add_systemd_config --service="${app}_workers" --template="fittrackee_workers.service" +ynh_config_add_systemd --service="${app}" --template="fittrackee.service" +ynh_config_add_systemd --service="${app}_workers" --template="fittrackee_workers.service" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "${app}" --description="Fittrackee main service" --log="/var/log/$app/$app.log" yunohost service add "${app}_workers" --description="Fittrackee task queue service" --log="var/log/$app/${app}_workers.log" -#================================================= -# GENERIC FINALIZATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting the systemd services..." --weight=15 +ynh_script_progression "Starting the systemd services..." # Start a systemd service -ynh_systemd_action --service_name="${app}" --action="start" -ynh_systemd_action --service_name="${app}_workers" --action="start" +ynh_systemctl --service="${app}" --action="start" +ynh_systemctl --service="${app}_workers" --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 56c4109..5a81e00 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,20 +1,14 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression "Loading installation settings..." -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +redis_db=$(ynh_app_setting_get --key=redis_db) #================================================= # STANDARD REMOVE @@ -23,9 +17,9 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # 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 +if ynh_hide_warnings yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app services integration..." --weight=1 + ynh_script_progression "Removing $app services integration..." yunohost service remove $app yunohost service remove ${app}_workers fi @@ -33,21 +27,21 @@ fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 +ynh_script_progression "Stopping and removing the systemd service..." # Remove the dedicated systemd config -ynh_remove_systemd_config --service="${app}" -ynh_remove_systemd_config --service="${app}_workers" +ynh_config_remove_systemd"${app}" +ynh_config_remove_systemd"${app}_workers" #================================================= # REMOVE VARIOUS FILES #================================================= -ynh_script_progression --message="Removing various files..." --weight=5 +ynh_script_progression "Removing various files..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx -ynh_remove_logrotate +ynh_config_remove_logrotate # Remove the redis database ynh_redis_remove_db "$redis_db" @@ -56,4 +50,4 @@ ynh_redis_remove_db "$redis_db" # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" \ No newline at end of file diff --git a/scripts/restore b/scripts/restore index 9e8c0f5..a65c279 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,50 +1,42 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_name=$(ynh_app_setting_get --key=db_name) #================================================= # STANDARD RESTORATION STEPS #================================================= # RESTORE LOGROTATE #================================================= -ynh_script_progression --message="Configuring logrotate to manage application logfiles" --weight=1 +ynh_script_progression "Configuring logrotate to manage application logfiles" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --specific_user=$app -touch /var/log/$app/$app.log -touch /var/log/$app/${app}_workers.log -chown -R $app:www-data /var/log/$app/ +ynh_config_add_logrotate + #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression "Restoring the NGINX web server configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression "Restoring the PostgreSQL database..." -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_db_shell < "./db.sql" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" chmod 400 $install_dir/.env chown -R $app: "$install_dir" @@ -52,10 +44,10 @@ chown -R $app: "$install_dir" #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression "Restoring $app's systemd service..." -ynh_restore_file --origin_path="/etc/systemd/system/${app}.service" -ynh_restore_file --origin_path="/etc/systemd/system/${app}_workers.service" +ynh_restore "/etc/systemd/system/${app}.service" +ynh_restore "/etc/systemd/system/${app}_workers.service" systemctl enable "${app}.service" --quiet systemctl enable "${app}_workers.service" --quiet @@ -63,7 +55,7 @@ systemctl enable "${app}_workers.service" --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "${app}" --description="Fittrackee main service" --log="/var/log/$app/$app.log" yunohost service add "${app}_workers" --description="Fittrackee task queue service" --log="var/log/$app/${app}_workers.log" @@ -71,22 +63,21 @@ yunohost service add "${app}_workers" --description="Fittrackee task queue servi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="${app}" --action="start" -ynh_systemd_action --service_name="${app}_workers" --action="start" +ynh_systemctl --service="${app}" --action="start" + +ynh_systemctl --service="${app}_workers" --action="start" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression "Reloading NGINX web server..." -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index c2575fe..26fc6a6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,28 +1,16 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." -if [ -z "${weather_api_provider:-}" ]; then - weather_api_provider=$weather_provider - ynh_app_setting_set --app=$app --key=weather_api_provider --value=$weather_api_provider -fi +ynh_app_setting_set_default --key=weather_api_provider --value=$weather_provider -if [ -z "${weather_api_key:-}" ]; then - weather_api_key=$weather_key - ynh_app_setting_set --app=$app --key=weather_api_key --value=$weather_api_key -fi +ynh_app_setting_set_default --key=weather_api_key --value=$weather_key #================================================= # LOAD SETTINGS @@ -31,26 +19,19 @@ fi admin=$(ynh_user_get_info --username=$admin --key=username) admin_mail=$(ynh_user_get_info --username=$admin --key=mail) -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --action="stop" --service_name="${app}" -ynh_systemd_action --action="stop" --service_name="${app}_workers" +ynh_systemctl --action="stop" --service="${app}" + +ynh_systemctl --action="stop" --service="${app}_workers" #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=23 +ynh_script_progression "Installing dependencies..." chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" @@ -58,72 +39,70 @@ chown -R $app: "$install_dir" #================================================= # CONFIGURE THE INSTALL SCRIPT #================================================= -ynh_script_progression --message="Installing service script..." --weight=1 +ynh_script_progression "Installing service script..." redis_db=$(ynh_redis_get_free_db) -ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" +ynh_config_add --template=".env.production" --destination="$install_dir/.env" chmod 400 $install_dir/.env chown $app: "$install_dir/.env" #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." --weight=3 +ynh_script_progression "Installing Python dependencies..." if [ $YNH_ARCH == "armhf" ] || [ $YNH_ARCH == "armel" ] then -# Install rustup is not already installed +# Install rustup is not already installed # We need this to be able to install cryptgraphy on ARM hardware export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" if [ -e $install_dir/.rustup ]; then - sudo -u "$app" env PATH=$PATH rustup update + ynh_exec_as_app PATH=$PATH rustup update else - sudo -u "$app" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' + ynh_exec_as_app bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' fi fi pushd $install_dir python3 -m venv $install_dir/venv source $install_dir/venv/bin/activate - ynh_exec_warn_less pip install --upgrade pip wheel toml pyyaml - ynh_exec_warn_less pip install fittrackee=="$(ynh_app_upstream_version)" + ynh_hide_warnings pip install --upgrade pip wheel toml pyyaml + ynh_hide_warnings pip install fittrackee=="$(ynh_app_upstream_version)" popd #================================================= # Update DATABASE #================================================= -ynh_script_progression --message="Upgrading database..." --weight=1 +ynh_script_progression "Upgrading database..." set -a source $install_dir/.env -ynh_exec_warn_less $install_dir/venv/bin/ftcli db upgrade +ynh_hide_warnings $install_dir/venv/bin/ftcli db upgrade set +a #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression "Upgrading NGINX web server configuration..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression "Upgrading systemd configuration..." # Create a dedicated systemd config -ynh_add_systemd_config --service="${app}" --template="fittrackee.service" -ynh_add_systemd_config --service="${app}_workers" --template="fittrackee_workers.service" +ynh_config_add_systemd --service="${app}" --template="fittrackee.service" +ynh_config_add_systemd --service="${app}_workers" --template="fittrackee_workers.service" -#================================================= -# GENERIC FINALIZATION #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression "Integrating service in YunoHost..." yunohost service add "${app}" --description="Fittrackee main service" --log="/var/log/$app/$app.log" yunohost service add "${app}_workers" --description="Fittrackee task queue service" --log="var/log/$app/${app}_workers.log" @@ -131,14 +110,15 @@ yunohost service add "${app}_workers" --description="Fittrackee task queue servi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting the systemd services..." --weight=15 +ynh_script_progression "Starting the systemd services..." # Start a systemd service -ynh_systemd_action --service_name="${app}" --action="start" -ynh_systemd_action --service_name="${app}_workers" --action="start" +ynh_systemctl --service="${app}" --action="start" + +ynh_systemctl --service="${app}_workers" --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" \ No newline at end of file diff --git a/tests.toml b/tests.toml index 873d412..ae1d9f5 100644 --- a/tests.toml +++ b/tests.toml @@ -19,4 +19,5 @@ test_format = 1.0 test_upgrade_from.5b6ccd1.name = "0.8.0" test_upgrade_from.6c23ccf.name = "0.8.1" test_upgrade_from.2c6b69d.name = "0.8.3" + test_upgrade_from.48465e5.name = "helpers v1" From 4bd5d147e459516fb5169ba6a5e15a16cc413588 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sun, 23 Jun 2024 17:34:14 +0200 Subject: [PATCH 02/11] fix variable --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 98b7386..139f838 100755 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ pushd $install_dir python3 -m venv $install_dir/venv source $install_dir/venv/bin/activate ynh_hide_warnings pip install --upgrade pip wheel toml pyyaml - ynh_hide_warnings pip install fittrackee=="$(ynh_app_upstream_version)" + ynh_hide_warnings pip install fittrackee=="$(ynh_app_manifest_version)" popd #================================================= From 72cf77b09a15915a6c80e8bdc8c4fdb7235a40eb Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sun, 23 Jun 2024 17:38:15 +0200 Subject: [PATCH 03/11] set old variable back --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 139f838..98b7386 100755 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ pushd $install_dir python3 -m venv $install_dir/venv source $install_dir/venv/bin/activate ynh_hide_warnings pip install --upgrade pip wheel toml pyyaml - ynh_hide_warnings pip install fittrackee=="$(ynh_app_manifest_version)" + ynh_hide_warnings pip install fittrackee=="$(ynh_app_upstream_version)" popd #================================================= From bb76a4cc6384461c986f7de3bff15a12ec26ae20 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 25 Jun 2024 07:21:21 +0200 Subject: [PATCH 04/11] bump minimum yunohost version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ec02a7f..5bbe202 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,7 @@ admindoc = "https://samr1.github.io/FitTrackee" code = "https://github.com/SamR1/FitTrackee" [integration] -yunohost = ">= 11.2.15" +yunohost = ">= 11.2.17" helpers_version = "2.1" architectures = "all" multi_instance = true From 5ac1b96ff2b36bb92523f13dfe7f0a8479440c04 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:30:34 +0200 Subject: [PATCH 05/11] remove reference to path --- conf/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a0963b4..77a23ee 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,4 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location / { # Set max upload size client_max_body_size 20m; From 0e88a2e9546af8a312072684e64938f29ed2dce1 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:37:51 +0200 Subject: [PATCH 06/11] add space --- scripts/remove | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 5a81e00..30b41f2 100644 --- a/scripts/remove +++ b/scripts/remove @@ -30,8 +30,8 @@ fi ynh_script_progression "Stopping and removing the systemd service..." # Remove the dedicated systemd config -ynh_config_remove_systemd"${app}" -ynh_config_remove_systemd"${app}_workers" +ynh_config_remove_systemd "${app}" +ynh_config_remove_systemd "${app}_workers" #================================================= # REMOVE VARIOUS FILES @@ -50,4 +50,4 @@ ynh_redis_remove_db "$redis_db" # END OF SCRIPT #================================================= -ynh_script_progression "Removal of $app completed" \ No newline at end of file +ynh_script_progression "Removal of $app completed" From 8b9caa61d8a4789a8309c638596cbb31c8ae0cb3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:58:10 +0200 Subject: [PATCH 07/11] fix variables --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 26fc6a6..52b969a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,9 +8,9 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression "Ensuring downward compatibility..." -ynh_app_setting_set_default --key=weather_api_provider --value=$weather_provider +ynh_app_setting_set_default --key=weather_provider --value=$weather_api_provider -ynh_app_setting_set_default --key=weather_api_key --value=$weather_key +ynh_app_setting_set_default --key=weather_key --value=$weather_api_key #================================================= # LOAD SETTINGS @@ -121,4 +121,4 @@ ynh_systemctl --service="${app}_workers" --action="start" # END OF SCRIPT #================================================= -ynh_script_progression "Upgrade of $app completed" \ No newline at end of file +ynh_script_progression "Upgrade of $app completed" From 6e75f45bfc43e257b57811e8066a6afaa6d7b5fb Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 3 Aug 2024 09:22:04 +0000 Subject: [PATCH 08/11] Auto-update READMEs --- ALL_README.md | 1 + README_id.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 README_id.md diff --git a/ALL_README.md b/ALL_README.md index 152f2e7..4ed64dd 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -5,4 +5,5 @@ - [Irakurri README euskaraz](README_eu.md) - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) +- [Baca README dalam bahasa bahasa Indonesia](README_id.md) - [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README_id.md b/README_id.md new file mode 100644 index 0000000..d00d8bc --- /dev/null +++ b/README_id.md @@ -0,0 +1,49 @@ + + +# FitTrackee untuk YunoHost + +[![Tingkat integrasi](https://dash.yunohost.org/integration/fittrackee.svg)](https://ci-apps.yunohost.org/ci/apps/fittrackee/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/fittrackee.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/fittrackee.maintain.svg) + +[![Pasang FitTrackee dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=fittrackee) + +*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)* + +> *Paket ini memperbolehkan Anda untuk memasang FitTrackee secara cepat dan mudah pada server YunoHost.* +> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.* + +## Ringkasan + +FitTrackee allows you to track your outdoor activities (workouts) from gpx files and keep your data on your own server. +No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. + + +**Versi terkirim:** 0.8.5~ynh1 + +## Tangkapan Layar + +![Tangkapan Layar pada FitTrackee](./doc/screenshots/screenshot-fittrackee.png) + +## Dokumentasi dan sumber daya + +- Website aplikasi resmi: +- Dokumentasi admin resmi: +- Depot kode aplikasi hulu: +- Gudang YunoHost: +- Laporkan bug: + +## Info developer + +Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/fittrackee_ynh/tree/testing). + +Untuk mencoba branch `testing`, silakan dilanjutkan seperti: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/fittrackee_ynh/tree/testing --debug +atau +sudo yunohost app upgrade fittrackee -u https://github.com/YunoHost-Apps/fittrackee_ynh/tree/testing --debug +``` + +**Info lebih lanjut mengenai pemaketan aplikasi:** From e2156f4f88e9a7a282b99a4659208da1bc058878 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sat, 3 Aug 2024 11:23:05 +0200 Subject: [PATCH 09/11] Update tests.toml --- tests.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 1e9f797..e9d2278 100644 --- a/tests.toml +++ b/tests.toml @@ -20,4 +20,5 @@ test_format = 1.0 test_upgrade_from.6c23ccf.name = "0.8.1" test_upgrade_from.2c6b69d.name = "0.8.3" test_upgrade_from.fb74b14.name = "0.8.4" - \ No newline at end of file + test_upgrade_from.853024c.name = "helpers_v1 + 0.8.5" + From fac329414e760be6b120d5363de7ad8376f5ce3c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sat, 3 Aug 2024 11:25:37 +0200 Subject: [PATCH 10/11] upgrade to 0.5.6 --- manifest.toml | 2 +- tests.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 5b4c434..996fc77 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.gl = "Rexistra as túas actividades ao aire libre 🚴" description.ca = "Seguiment d'activitats a l'aire lliure autoallotjat 🚴" description.fr = "Traqueur d’activités extérieures auto-hébergé 🚴" -version = "0.8.5~ynh1" +version = "0.8.6~ynh1" maintainers = ["Thovi98"] diff --git a/tests.toml b/tests.toml index e9d2278..9a25095 100644 --- a/tests.toml +++ b/tests.toml @@ -20,5 +20,4 @@ test_format = 1.0 test_upgrade_from.6c23ccf.name = "0.8.1" test_upgrade_from.2c6b69d.name = "0.8.3" test_upgrade_from.fb74b14.name = "0.8.4" - test_upgrade_from.853024c.name = "helpers_v1 + 0.8.5" - + test_upgrade_from.853024c.name = "helpers_v1 + 0.8.5" \ No newline at end of file From faeea865a9ed8bed1624f1e9c64c4a9b084fb564 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 3 Aug 2024 09:25:40 +0000 Subject: [PATCH 11/11] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_zh_Hans.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9362c2b..6769dc4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**Shipped version:** 0.8.5~ynh1 +**Shipped version:** 0.8.6~ynh1 ## Screenshots diff --git a/README_es.md b/README_es.md index afb27ff..e99dc4f 100644 --- a/README_es.md +++ b/README_es.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**Versión actual:** 0.8.5~ynh1 +**Versión actual:** 0.8.6~ynh1 ## Capturas diff --git a/README_eu.md b/README_eu.md index b0cbcb6..c1985e0 100644 --- a/README_eu.md +++ b/README_eu.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**Paketatutako bertsioa:** 0.8.5~ynh1 +**Paketatutako bertsioa:** 0.8.6~ynh1 ## Pantaila-argazkiak diff --git a/README_fr.md b/README_fr.md index 80f05f8..9013029 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main. FitTrackee vous permet de suivre vos activités de plein air (séances d'entraînement) à partir de fichiers gpx et de conserver vos données sur votre propre serveur. Aucune application mobile n'a encore été développée, mais plusieurs applications mobiles existantes peuvent stocker localement les données des séances d'entraînement et les exporter dans un fichier gpx. -**Version incluse :** 0.8.5~ynh1 +**Version incluse :** 0.8.6~ynh1 ## Captures d’écran diff --git a/README_gl.md b/README_gl.md index fa4ca4c..c75759c 100644 --- a/README_gl.md +++ b/README_gl.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**Versión proporcionada:** 0.8.5~ynh1 +**Versión proporcionada:** 0.8.6~ynh1 ## Capturas de pantalla diff --git a/README_id.md b/README_id.md index d00d8bc..76a8581 100644 --- a/README_id.md +++ b/README_id.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**Versi terkirim:** 0.8.5~ynh1 +**Versi terkirim:** 0.8.6~ynh1 ## Tangkapan Layar diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 6b29c61..405c00c 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -20,7 +20,7 @@ FitTrackee allows you to track your outdoor activities (workouts) from gpx files No mobile app has been developed yet, but several existing mobile apps can store workouts data locally and export them into a gpx file. -**分发版本:** 0.8.5~ynh1 +**分发版本:** 0.8.6~ynh1 ## 截图