From 358c41c4897cd652463e889ab212947f3d50a24e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 6 Sep 2020 18:03:25 +0200 Subject: [PATCH] Fix restore script --- conf/config.js | 16 ++-------------- conf/nginx.conf | 2 +- scripts/backup | 2 -- scripts/install | 8 +++----- scripts/restore | 11 +++++++++-- scripts/upgrade | 7 +++---- 6 files changed, 18 insertions(+), 28 deletions(-) diff --git a/conf/config.js b/conf/config.js index ba29d25..0825b96 100644 --- a/conf/config.js +++ b/conf/config.js @@ -1,17 +1,10 @@ { - - "host": "127.0.0.1", - + "host": "127.0.0.1", "port": __PORT__, - "keyLength": 10, - "maxLength": 400000, - "staticMaxAge": 86400, - "recompressStaticAssets": true, - "logging": [ { "level": "verbose", @@ -19,11 +12,9 @@ "colorize": true } ], - "keyGenerator": { "type": "phonetic" }, - "rateLimits": { "categories": { "normal": { @@ -32,14 +23,11 @@ } } }, - "storage": { "type": "file", "path": "__YNH_DATA_PATH__" }, - "documents": { "about": "./about.md" - } - + } } diff --git a/conf/nginx.conf b/conf/nginx.conf index 0579767..abd8968 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://localhost:__PORT__; + proxy_pass http://127.0.0.1:__PORT__; proxy_set_header Host $host; proxy_buffering off; diff --git a/scripts/backup b/scripts/backup index e75918d..fef7284 100755 --- a/scripts/backup +++ b/scripts/backup @@ -46,8 +46,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= diff --git a/scripts/install b/scripts/install index ab1fb44..5bf3377 100755 --- a/scripts/install +++ b/scripts/install @@ -121,9 +121,6 @@ data_path="/home/yunohost.app/${app}" # Create app folders mkdir -p "$data_path" -# Give permission to the datadir -chown -R $app:$app "$data_path" - #================================================= # CONFIGURE HASTE #================================================= @@ -149,7 +146,6 @@ ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh" cp ../conf/haste.sh /usr/bin/$app -chmod +x /usr/bin/$app #================================================= # GENERIC FINALIZATION @@ -158,7 +154,9 @@ chmod +x /usr/bin/$app #================================================= chown -R root: $final_path -chown -R $app "$final_path/static" +chown -R $app: "$final_path/static" +chown -R $app: "$data_path" +chmod +x /usr/bin/$app #================================================= # HANDLE LOG FILES AND SETUP LOGROTATE diff --git a/scripts/restore b/scripts/restore index d408ca5..fc99240 100755 --- a/scripts/restore +++ b/scripts/restore @@ -85,13 +85,20 @@ systemctl enable $app.service ynh_restore_file "/home/yunohost.app/$app" +#================================================= +# RESTORE BINARY +#================================================= + +ynh_restore_file --origin_path="/usr/bin/$app" + #================================================= # SECURE FILES AND DIRECTORIES #================================================= chown -R root: $final_path -chown -R $app "$final_path/static" -chown -R $app "/home/yunohost.app/$app" +chown -R $app: "$final_path/static" +chown -R $app: "/home/yunohost.app/$app" +chmod +x /usr/bin/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index cfd132d..4db3213 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,8 +171,6 @@ ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain cp ../conf/haste.sh /usr/bin/$app -chmod +x /usr/bin/$app - #================================================= # GENERIC FINALIZATION #================================================= @@ -180,8 +178,9 @@ chmod +x /usr/bin/$app #================================================= chown -R root: $final_path -chown -R $app "$final_path/static" -chown -R $app "$data_path" +chown -R $app: "$final_path/static" +chown -R $app: "$data_path" +chmod +x /usr/bin/$app #================================================= # START SYSTEMD SERVICE