From d5e42cd825c40bcdcece58e9cd21b7f2d7ce3a7f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 18:07:52 +0100 Subject: [PATCH 1/6] fix proxy_pass --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 19cfa5b..b14062f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location ~ ^/(css|img|js|fonts)/ { location __PATH__/ { - proxy_pass http://localhost:__PORT__/; + proxy_pass http://localhost:__PORT__; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; From 4adf6733f183affa1e58f1f12db650d280f65e83 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 18:13:24 +0100 Subject: [PATCH 2/6] nginx configuration to comply with writefreely recommandation --- conf/nginx.conf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b14062f..434c236 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,9 +19,8 @@ location __PATH__/ { proxy_pass http://localhost:__PORT__; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - client_max_body_size 10m; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_redirect off; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; From cb0e1127223863bc86ad49645e46798e48a4336b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 18:24:05 +0100 Subject: [PATCH 3/6] Switch from log files to journalctl --- conf/systemd.service | 7 +++++-- scripts/backup | 2 +- scripts/install | 11 ++--------- scripts/remove | 4 ++-- scripts/restore | 11 ++--------- scripts/upgrade | 2 +- 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index b2cdfdf..8399c8b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,11 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=/bin/sh -c '__FINALPATH__/writefreely >> /var/log/__APP__/__APP__.log 2>&1' +StandardOutput=syslog +StandardError=syslog +WorkingDirectory=__FINALPATH__ +ExecStart=__FINALPATH__/writefreely +Restart=always [Install] WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index e35094e..015ed04 100755 --- a/scripts/backup +++ b/scripts/backup @@ -73,7 +73,7 @@ ynh_mysql_dump_db "$db_name" > db.sql # BACKUP LOGROTATE #================================================= -ynh_backup "/etc/logrotate.d/$app" +#ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index 2cfa69a..765347b 100755 --- a/scripts/install +++ b/scripts/install @@ -288,13 +288,6 @@ ynh_store_file_checksum "$final_path/config.ini" #================================================= # SPECIFIC SETUP -#================================================= -# CREATE LOG FOLDER -#================================================= - -mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" - #================================================= # MAKE SETUP #================================================= @@ -333,7 +326,7 @@ chown -R "$app":"$app" "$final_path" ### - And the section "SETUP LOGROTATE" in the upgrade script # Use logrotate to manage application logfile(s) -ynh_use_logrotate +#ynh_use_logrotate #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -350,7 +343,7 @@ ynh_use_logrotate #yunohost service add $app --log "/var/log/$app/APP.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added -yunohost service add $app --description "$app daemon for WriteFreely" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for WriteFreely" --log_type systemd #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index e2cca67..6ffffcc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -91,7 +91,7 @@ ynh_remove_nginx_config #================================================= # Remove the app-specific logrotate config -ynh_remove_logrotate +#ynh_remove_logrotate #================================================= # CLOSE A PORT @@ -116,7 +116,7 @@ fi ynh_secure_remove "/etc/$app/" # Remove the log files -ynh_secure_remove "/var/log/$app/" +#ynh_secure_remove "/var/log/$app/" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 06a1fb5..ef76183 100755 --- a/scripts/restore +++ b/scripts/restore @@ -114,7 +114,7 @@ systemctl daemon-reload # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "$app daemon for WriteFreely" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for WriteFreely" --log_type systemd #================================================= # RESTORE THE CRON FILE @@ -126,7 +126,7 @@ yunohost service add $app --description "$app daemon for WriteFreely" --log "/va # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_restore_file "/etc/logrotate.d/$app" +#ynh_restore_file "/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION @@ -137,13 +137,6 @@ ynh_restore_file "/etc/logrotate.d/$app" #systemctl reload php5-fpm systemctl reload nginx -#================================================= -# CREATE LOG FOLDER -#================================================= - -mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" - #================================================= # START SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c248a83..ca71c31 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -166,7 +166,7 @@ fi #================================================= # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +#ynh_use_logrotate --non-append #================================================= # SETUP SYSTEMD From a517cc54e9cff138630477f7493a92cde476b945 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 18:28:58 +0100 Subject: [PATCH 4/6] [YEP-2.1] for specify the type of the argument --- manifest.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifest.json b/manifest.json index ed1647b..05cd5ab 100644 --- a/manifest.json +++ b/manifest.json @@ -65,6 +65,7 @@ }, { "name": "single_user", + "type": "string", "ask": { "en": "Choose if you want a Single User Blog ?", "fr": "Souhaitez vous un blog pour un seul utilisateur?" @@ -74,6 +75,7 @@ }, { "name": "site_name", + "type": "string", "ask": { "en": "Choose a name for your WriteFreely instance", "fr": "Choisissez un nom pour votre instance WriteFreely" @@ -82,6 +84,7 @@ }, { "name": "site_description", + "type": "string", "ask": { "en": "Choose a description for your WriteFreely instance", "fr": "Choisissez une description pour votre instance WriteFreely" @@ -90,6 +93,7 @@ }, { "name": "open_registration", + "type": "string", "ask": { "en": "Are registrations opened to all ?", "fr": "Les inscriptions sont t'elles ouvertes ?" @@ -99,6 +103,7 @@ }, { "name": "max_blogs", + "type": "string", "ask": { "en": "How many blogs each user can create ?", "fr": "Combien de blogs chaque utilisateur peut créer ?" @@ -107,6 +112,7 @@ }, { "name": "federation", + "type": "string", "ask": { "en": "Is it federation enabled ?", "fr": "Est-ce une application publique ?" @@ -116,6 +122,7 @@ }, { "name": "public_stats", + "type": "string", "ask": { "en": "Are federation stats public ?", "fr": "Est-ce les statistiques de federation sont publiques ?" @@ -125,6 +132,7 @@ }, { "name": "private", + "type": "string", "ask": { "en": "Are the instance metadata private ?", "fr": "Est-ce les metadatas de l'instance sont privée ?" @@ -134,6 +142,7 @@ }, { "name": "local_timeline", + "type": "string", "ask": { "en": "Do you want to add a local timeline ?", "fr": "Voulez vous afficher une timeline locale ?" From dde640a7b209c4ab13c672952b160ffff47ee722 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 18:30:44 +0100 Subject: [PATCH 5/6] remove sudo --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 765347b..39740d9 100755 --- a/scripts/install +++ b/scripts/install @@ -258,7 +258,7 @@ ynh_add_systemd_config ### (It's compatible with sed regular expressions syntax) # setup application config -sudo cp "../conf/config.ini" "$final_path/config.ini" +cp "../conf/config.ini" "$final_path/config.ini" ynh_replace_string "__DBNAME__" "$db_name" "$final_path/config.ini" ynh_replace_string "__DBUSER__" "$db_name" "$final_path/config.ini" From 64f1fa5dd1e92f3b5a470dc35e73af6a153d7e22 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 8 Feb 2019 19:24:09 +0100 Subject: [PATCH 6/6] Version change to comply for the log change to journalctl --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 05cd5ab..b7199aa 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Write Freely is free and open source software for starting a minimalist, federated blog — or an entire community.", "fr": "Write Freely est un logiciel gratuit et à code source ouvert permettant de créer un blog fédéré minimaliste ou une communauté entière." }, - "version": "0.8.1~ynh2", + "version": "0.8.1~ynh3", "url": "https://writefreely.org", "license": "free", "maintainer": {