mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
Apply Last example_ynh
This commit is contained in:
parent
5e6bcfa39a
commit
88fea978c7
7 changed files with 36 additions and 38 deletions
|
@ -2,11 +2,6 @@ root __FINALPATH__/front/dist;
|
|||
|
||||
location / {
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
# global proxy conf
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"demo": "https://demo.funkwhale.audio",
|
||||
"admindoc": "https://docs.funkwhale.audio/admin/index.html",
|
||||
"userdoc": "https://docs.funkwhale.audio/users/index.html",
|
||||
"code": "https://dev.funkwhale.audio/funkwhale"
|
||||
"code": "https://dev.funkwhale.audio/funkwhale/funkwhale"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
@ -26,7 +26,7 @@
|
|||
"email": "jean-baptiste@holcroft.fr"
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.2.0"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
|
|
@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
@ -34,7 +34,7 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
|||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
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)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
key=$(ynh_app_setting_get --app=$app --key=key)
|
||||
|
@ -42,7 +42,7 @@ key=$(ynh_app_setting_get --app=$app --key=key)
|
|||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -77,7 +77,7 @@ fi
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name="$app-beat" --action=stop --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name="$app-server" --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
@ -86,7 +86,7 @@ ynh_systemd_action --service_name="$app-worker" --action=stop --log_path="/var/l
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -147,7 +147,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$new_domain-access.log" --fail
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -155,4 +155,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
ynh_script_progression --message="Change of URL completed for $app"
|
||||
|
|
|
@ -40,8 +40,6 @@ ynh_script_progression --message="Validating installation parameters..."
|
|||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
datadir="/home/yunohost.app/${app}/data"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
|
@ -105,9 +103,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|||
ynh_setup_source --dest_dir="$final_path/api" --source_id="api"
|
||||
ynh_setup_source --dest_dir="$final_path/front" --source_id="front"
|
||||
|
||||
pushd $final_path
|
||||
mkdir -p config
|
||||
popd
|
||||
mkdir -p $final_path/config
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
@ -128,13 +124,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.app/$app/data
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
pushd $datadir
|
||||
mkdir -p static media music
|
||||
popd
|
||||
mkdir -p $datadir/{static,media,music}
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
|
|
|
@ -21,6 +21,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
|
||||
#=================================================
|
||||
|
@ -72,14 +73,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..."
|
|||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -88,6 +81,17 @@ ynh_script_progression --message="Removing app main directory..."
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# 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..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -96,6 +100,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
|
|||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -39,7 +39,8 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -78,9 +79,7 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
|
|||
|
||||
mkdir -p $datadir
|
||||
|
||||
pushd $datadir
|
||||
mkdir -p static media music
|
||||
popd
|
||||
mkdir -p $datadir/{static,media,music}
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
|
|
|
@ -97,9 +97,7 @@ if [ -z "$datadir" ]; then
|
|||
ynh_script_progression --message="Moving datas to $datadir..."
|
||||
|
||||
mkdir -p $datadir
|
||||
pushd $datadir
|
||||
mkdir -p static media music
|
||||
popd
|
||||
mkdir -p $datadir/{static,media,music}
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
|
|
Loading…
Reference in a new issue