1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fittrackee_ynh.git synced 2024-09-03 18:36:16 +02:00

Merge pull request #73 from YunoHost-Apps/testing

Upgrade to 0.8.6
This commit is contained in:
Thomas 2024-08-05 14:41:41 +02:00 committed by GitHub
commit ec414cee27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 179 additions and 206 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

49
README_id.md Normal file
View file

@ -0,0 +1,49 @@
<!--
N.B.: README ini dibuat secara otomatis oleh <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Ini TIDAK boleh diedit dengan tangan.
-->
# 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.6~ynh1
## Tangkapan Layar
![Tangkapan Layar pada FitTrackee](./doc/screenshots/screenshot-fittrackee.png)
## Dokumentasi dan sumber daya
- Website aplikasi resmi: <https://samr1.github.io/FitTrackee>
- Dokumentasi admin resmi: <https://samr1.github.io/FitTrackee>
- Depot kode aplikasi hulu: <https://github.com/SamR1/FitTrackee>
- Gudang YunoHost: <https://apps.yunohost.org/app/fittrackee>
- Laporkan bug: <https://github.com/YunoHost-Apps/fittrackee_ynh/issues>
## 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:** <https://yunohost.org/packaging_apps>

View file

@ -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
## 截图

View file

@ -38,4 +38,3 @@ STATICMAP_SUBDOMAINS=''
# available weather API providers: darksky, visualcrossing
WEATHER_API_PROVIDER=__WEATHER_API_PROVIDER__
WEATHER_API_KEY=__WEATHER_API_KEY__

View file

@ -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

View file

@ -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

View file

@ -1,5 +1,4 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
location / {
# Set max upload size
client_max_body_size 20m;

View file

@ -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 dactivités extérieures auto-hébergé 🚴"
version = "0.8.5~ynh1"
version = "0.8.6~ynh1"
maintainers = ["Thovi98"]
@ -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

View file

@ -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)."

View file

@ -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"

View file

@ -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
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"

View file

@ -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"

View file

@ -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"

View file

@ -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,17 +39,17 @@ 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
@ -76,54 +57,52 @@ then
# 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"

View file

@ -20,4 +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"