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 #39 from YunoHost-Apps/master

push changes in email branch
This commit is contained in:
Thomas 2023-09-15 13:16:18 +02:00 committed by GitHub
commit efdd7123f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 67 additions and 18 deletions

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.7.22~ynh1
**Shipped version:** 0.7.23~ynh1
## Screenshots

View file

@ -19,7 +19,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
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.7.22~ynh1
**Version incluse :** 0.7.23~ynh1
## Captures décran

View file

@ -17,7 +17,7 @@ DATABASE_URL=postgresql://__DB_USER__:__DB_PWD__@:5432/__DB_NAME__
# DATABASE_DISABLE_POOLING=
# Redis (required for API rate limits and email sending)
REDIS_URL=redis://
REDIS_URL=redis://127.0.0.1:6379/__REDIS_DB__
# API rate limits
# API_RATE_LIMITS="300 per 5 minutes"
@ -29,7 +29,7 @@ SENDER_EMAIL=__APP__@__DOMAIN__
# WORKERS_PROCESSES=
# Workouts
TILE_SERVER_URL=https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
TILE_SERVER_URL=https://tile.openstreetmap.org/{z}/{x}/{y}.png
MAP_ATTRIBUTION='&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors'
DEFAULT_STATICMAP=False
STATICMAP_SUBDOMAINS=''

View file

@ -5,7 +5,7 @@ name = "FitTrackee"
description.en = "Self-hosted outdoor activity tracker 🚴"
description.fr = "Traqueur dactivités extérieures auto-hébergé 🚴"
version = "0.7.22~ynh1"
version = "0.7.23~ynh1"
maintainers = ["Thovi98"]

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES
#=================================================
fittrackee_version="0.7.22"
fittrackee_version="0.7.23"
#=================================================
# PERSONAL HELPERS
@ -14,6 +14,44 @@ fittrackee_version="0.7.22"
# EXPERIMENTAL HELPERS
#=================================================
# get the first available redis database
#
# usage: ynh_redis_get_free_db
# | returns: the database number to use
ynh_redis_get_free_db() {
local result max db
result=$(redis-cli INFO keyspace)
# get the num
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
db=0
# default Debian setting is 15 databases
for i in $(seq 0 "$max")
do
if ! echo "$result" | grep -q "db$i"
then
db=$i
break 1
fi
db=-1
done
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
echo "$db"
}
# Create a master password and set up global settings
# Please always call this script in install and restore scripts
#
# usage: ynh_redis_remove_db database
# | arg: database - the database to erase
ynh_redis_remove_db() {
local db=$1
redis-cli -n "$db" flushall
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -36,10 +36,10 @@ ynh_change_url_nginx_config
#=================================================
# MODIFY THE CONFIG FILE
#=================================================
#ynh_script_progression --message="Modifying a config file..." --weight=1
ynh_script_progression --message="Modifying a config file..." --weight=1
#domain=$new_domain
#ynh_add_config --template="../conf/env.production" --destination="$install_dir/config/.env"
domain=$new_domain
ynh_add_config --template="../conf/env.production" --destination="$install_dir/config/.env"
#=================================================
# START SYSTEMD SERVICE

View file

@ -30,6 +30,11 @@ chown -R $app:www-data /var/log/$app/
# CONFIGURE THE INSTALL SCRIPT
#=================================================
# Configure redis
redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --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
@ -59,14 +64,13 @@ export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sb
else
sudo -u "$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
ynh_exec_warn_less pip install fittrackee==$fittrackee_version toml pyyaml
ynh_exec_warn_less pip install --upgrade pip wheel toml pyyaml
ynh_exec_warn_less pip install fittrackee==$fittrackee_version
popd
#=================================================

View file

@ -9,6 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
# STANDARD REMOVE
@ -47,6 +53,9 @@ ynh_remove_logrotate
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
# Remove the redis database
ynh_redis_remove_db "$redis_db"
#=================================================
# END OF SCRIPT

View file

@ -47,6 +47,7 @@ chown -R $app: "$install_dir"
#=================================================
ynh_script_progression --message="Installing service script..." --weight=1
redis_db=$(ynh_redis_get_free_db)
ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env"
chmod 600 $install_dir/.env
chown $app: "$install_dir/.env"
@ -70,17 +71,13 @@ export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sb
else
sudo -u "$app" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal'
fi
sudo -u "$app" env PATH=$PATH rustup install stable
sudo -u "$app" env PATH=$PATH rustup default stable
fi
pushd $install_dir
python3 -m venv $install_dir/venv
source $install_dir/venv/bin/activate
ynh_exec_warn_less pip install --upgrade pip
ynh_exec_warn_less pip install fittrackee==$fittrackee_version toml pyyaml
ynh_exec_warn_less pip install --upgrade pip wheel toml pyyaml
ynh_exec_warn_less pip install fittrackee==$fittrackee_version
popd

View file

@ -18,3 +18,4 @@ test_format = 1.0
test_upgrade_from.ca02214.name = "0.7.18"
test_upgrade_from.9c094f9.name = "0.7.21"
test_upgrade_from.e49294c.name = "0.7.22"