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:** 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/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; diff --git a/manifest.toml b/manifest.toml index 31b8808..5b4c434 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.17" +helpers_version = "2.1" architectures = "all" multi_instance = true 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..30b41f2 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" 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..52b969a 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_provider --value=$weather_api_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_key --value=$weather_api_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" diff --git a/tests.toml b/tests.toml index f1e2b99..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" - + test_upgrade_from.853024c.name = "helpers_v1 + 0.8.5" +