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

Merge branch 'testing' into datadir

This commit is contained in:
Éric Gaspar 2023-01-19 10:39:17 +01:00
commit 584a7a7154
10 changed files with 44 additions and 33 deletions

View file

@ -30,6 +30,16 @@ BookWyrm est un réseau social pour garder la trace de vos lectures, parler de l
Ce projet est encore jeune et n'est pas, pour le moment, très stable, faites preuve de prudence lors de son utilisation en production.
Générez le code administrateur avec 'sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code',
et copiez le code administrateur à utiliser lors de la création de votre compte administrateur. Vous pouvez obtenir votre code
à tout moment en réexécutant cette commande. Voici un exemple de sortie :
```
*******************************************
Use this code to create your admin account:
c6c35779-af3a-4091-b330-c026610920d6
*******************************************
```
## Documentations et ressources
* Site officiel de lapp : <https://joinbookwyrm.com/fr/>

View file

@ -1,7 +1,7 @@
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY="__KEY__"
# SECURITY WARNING: don 't run with debug turned on in production!
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG=false
USE_HTTPS=true

View file

@ -1,6 +1,6 @@
This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production.
Generate the admin code with 'sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code',
Generate the admin code with `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
and copy the admin code to use when you create your admin account. You can get your code
at any time by re-running that command. Here's an example output:
```

View file

@ -1 +1,11 @@
Ce projet est encore jeune et n'est pas, pour le moment, très stable, faites preuve de prudence lors de son utilisation en production.
Générez le code administrateur avec `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
et copiez le code administrateur à utiliser lors de la création de votre compte administrateur. Vous pouvez obtenir votre code
à tout moment en réexécutant cette commande. Voici un exemple de sortie :
```
*******************************************
Use this code to create your admin account:
c6c35779-af3a-4091-b330-c026610920d6
*******************************************
```

View file

@ -46,7 +46,7 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr-fr", "en-us", "it-it", "pt-pt"],
"choices": ["de-de", "en-us", "es-es", "fr-fr", "it-it", "pt-pt", "zh-hans"],
"default": "fr-fr"
},
{

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="redis redis-tools redis-server postgresql postgresql-contrib nginx python3-venv libpq-dev"
pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev"
#=================================================
# PERSONAL HELPERS

View file

@ -40,7 +40,6 @@ key=$(ynh_string_random --length=32)
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -39,7 +39,7 @@ fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
ynh_systemd_action --service_name="${app}-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app"
ynh_systemd_action --service_name="${app}-server" --action="stop" --log_path="systemd" --line_match="Stopped $app"
@ -55,7 +55,7 @@ ynh_secure_remove --file="/etc/systemd/system/$app.target"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -71,7 +71,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -83,14 +83,14 @@ ynh_secure_remove --file="$final_path"
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config

View file

@ -33,6 +33,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
@ -52,18 +53,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_as_root --sql="ALTER USER $db_user CREATEDB;"
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -104,10 +93,7 @@ chown -R $app:www-data "$datadir"
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_exec_warn_less
ynh_install_app_dependencies
$pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE POSTGRESQL DATABASE

View file

@ -21,9 +21,9 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$(ynh_app_setting_get --app=$app --key=db_user)
#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
admin_mail=$(ynh_user_get_info --username=$admin --key=username)
@ -88,9 +88,9 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Installing service script..." --weight=1
ynh_add_config --template="../conf/.env.production" --destination="$final_path/.env"
chmod 600 $final_path/.env
chown $app:www-data "$final_path/.env"
#ynh_add_config --template="../conf/.env.production" --destination="$final_path/.env"
#chmod 600 $final_path/.env
#chown $app:www-data "$final_path/.env"
set -a; source "$final_path/.env"; set +a
@ -99,6 +99,12 @@ mkdir "$final_path/venv"
python3 -m venv "$final_path/venv"
$final_path/venv/bin/pip3 install -r "$final_path/requirements.txt"
#=================================================
# SET PERMISSIONS ON BOOKWYRM DIRECTORY
#=================================================
chown -R $app:www-data $final_path
#=================================================
# NGINX CONFIGURATION
#=================================================