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..60b4845 100755 --- a/scripts/backup +++ b/scripts/backup @@ -32,8 +32,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= ynh_print_info --message="Declaring files to be backed up..." -#================================================= -# STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -46,8 +44,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..f2cff50 100755 --- a/scripts/restore +++ b/scripts/restore @@ -13,9 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - true -} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -61,7 +58,7 @@ ynh_restore_file --origin_path="$final_path" ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC RESTORE @@ -71,27 +68,34 @@ ynh_system_user_create --username=$app ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service - #================================================= # RESTORE VARIOUS FILES #================================================= 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 + +#================================================= +# RESTORE HANDLE LOG FILES +#================================================= + +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown $app -R /var/log/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -99,6 +103,14 @@ chown -R $app "/home/yunohost.app/$app" yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log" +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service + #================================================= # START SYSTEMD SERVICE #================================================= @@ -115,7 +127,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX #================================================= ynh_script_progression --message="Reloading NGINX web server..." --weight=1 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