mirror of
https://github.com/YunoHost-Apps/tandoor_ynh.git
synced 2024-09-03 20:35:56 +02:00
commit
c51f9a4e3d
4 changed files with 13 additions and 14 deletions
|
@ -8,7 +8,7 @@
|
|||
setup_sub_dir=0
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_private=0
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
|
|
|
@ -94,6 +94,7 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
|||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
ynh_psql_execute_as_root --sql="GRANT ALL PRIVILEGES ON DATABASE $db_user TO $db_user;"
|
||||
|
|
|
@ -29,9 +29,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
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_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
secretkey=$(ynh_app_setting_get --app=$app --key=secretkey)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
|
@ -92,6 +95,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
|
|
|
@ -17,9 +17,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
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_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
secretkey=$(ynh_app_setting_get --app=$app --key=secretkey)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -104,14 +107,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -130,8 +125,8 @@ ynh_add_config --template=".env.template" --destination="$final_path/.env"
|
|||
# FIXME: this should be handled by the core in the future
|
||||
# You may need to use chmod 600 instead of 400,
|
||||
# for example if the app is expected to be able to modify its own config
|
||||
chmod 400 "$final_path/some_config_file"
|
||||
chown $app:$app "$final_path/some_config_file"
|
||||
chmod 400 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -140,11 +135,10 @@ chown $app:$app "$final_path/some_config_file"
|
|||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
|
||||
# load environment variables
|
||||
export $(cat "/var/www/$app/.env" |grep "^[^#]" | xargs)
|
||||
|
||||
ynh_script_progression --message="Running migrations and generatic static files..." --weight=2
|
||||
pushd "$final_path"
|
||||
# load environment variables
|
||||
export $(cat "/var/www/$app/.env" |grep "^[^#]" | xargs)
|
||||
ynh_exec_as $app "$final_path/venv/bin/python3" manage.py migrate
|
||||
ynh_exec_as $app "$final_path/venv/bin/python3" manage.py collectstatic --no-input
|
||||
ynh_exec_as $app "$final_path/venv/bin/python3" manage.py collectstatic_js_reverse
|
||||
|
|
Loading…
Reference in a new issue