From 15fe5958c20a5de53e5ef7e81527f36612fdaca5 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 00:31:50 +0200 Subject: [PATCH 1/8] mask the `"remote_url" has [count(*)] args, but no placeholders` error --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 12c3195..f7fe5e6 100755 --- a/scripts/install +++ b/scripts/install @@ -307,9 +307,9 @@ yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$a #================================================= ynh_script_progression --message="Creating gotosocial admin user..." --weight=1 -"$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account create --username "$admin" --email "$email" --password "$password" +ynh_exec_warn_less "$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account create --username "$admin" --email "$email" --password "$password" -"$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account promote --username "$admin" +ynh_exec_warn_less "$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account promote --username "$admin" #================================================= # START SYSTEMD SERVICE From 803b66060630cad699f04744ce9017ca7a388e58 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 17:39:20 +0200 Subject: [PATCH 2/8] implementing media caching --- conf/nginx.conf | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1a4cd60..c1a87f0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,3 +13,31 @@ location __PATH__/ { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + + +# media caching stuff +# https://docs.gotosocial.org/en/latest/advanced/caching/assets-media/#nginx + +location /assets/ { + alias web-asset-base-dir/; + autoindex off; + expires 5m; + add_header Cache-Control "public"; +} + +location @fileserver { + proxy_pass http://localhost:__PORT__; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; +} + +location /fileserver/ { + alias storage-local-base-path/; + autoindex off; + expires 1w; + add_header Cache-Control "private, immutable"; + try_files $uri @fileserver; +} \ No newline at end of file From d436324ae33ccb8e5463cc47ada69a1ea7d80f52 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 19:18:27 +0200 Subject: [PATCH 3/8] finalizing nginx media caching conf & various fixes --- conf/nginx.conf | 66 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c1a87f0..7bf49a7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,43 +1,45 @@ location __PATH__/ { proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - - proxy_pass http://localhost:__PORT__; - - client_max_body_size __CLIENT_MAX_BODY_SIZE__; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; -} - - -# media caching stuff -# https://docs.gotosocial.org/en/latest/advanced/caching/assets-media/#nginx - -location /assets/ { - alias web-asset-base-dir/; - autoindex off; - expires 5m; - add_header Cache-Control "public"; -} - -location @fileserver { - proxy_pass http://localhost:__PORT__; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_pass http://127.0.0.1:__PORT__; + + client_max_body_size __CLIENT_MAX_BODY_SIZE__; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; + + + # media caching stuff + # https://docs.gotosocial.org/en/latest/advanced/caching/assets-media/#nginx + location /assets/ { + alias __FINAL_PATH__/web/assets/; + autoindex off; + expires 5m; + add_header Cache-Control "public"; + } + + location /fileserver/ { + alias __DATADIR__; + autoindex off; + expires 1w; + add_header Cache-Control "private, immutable"; + try_files $uri @fileserver; + } + } -location /fileserver/ { - alias storage-local-base-path/; - autoindex off; - expires 1w; - add_header Cache-Control "private, immutable"; - try_files $uri @fileserver; +location @fileserver { + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; } \ No newline at end of file From f3ef8588cca9819598ad877c6efae13fffe1810e Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 19:27:33 +0200 Subject: [PATCH 4/8] bump version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4c5860e..2bd1d0b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "ActivityPub social network server", "fr": "Serveur de réseau social basé sur ActivityPub" }, - "version": "0.11.1~ynh3", + "version": "0.11.1~ynh4", "url": "https://github.com/superseriousbusiness/gotosocial", "upstream": { "license": "AGPL-3.0-only", From 1d706e3902a84f34f2c21f34b193e7d3a17b05a8 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 11 Sep 2023 17:27:37 +0000 Subject: [PATCH 5/8] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a97609..9bc5506 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ With GoToSocial, you can keep in touch with your friends, post, read, and share Documentation is at [docs.gotosocial.org](https://docs.gotosocial.org). -**Shipped version:** 0.11.1~ynh3 +**Shipped version:** 0.11.1~ynh4 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 695a233..c26fcd4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,7 +25,7 @@ Avec GoToSocial, vous pouvez rester en contact avec vos amis, publier, lire et p Vous pouvez consulter la documentation à l'adresse : [docs.gotosocial.org](https://docs.gotosocial.org). -**Version incluse :** 0.11.1~ynh3 +**Version incluse :** 0.11.1~ynh4 ## Captures d’écran From a0ce3597be6874f5801a92749f48189a51d18568 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 22:25:48 +0200 Subject: [PATCH 6/8] various fixes --- conf/nginx.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 7bf49a7..6603e55 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,6 +16,11 @@ location __PATH__/ { include conf.d/yunohost_panel.conf.inc; + # fix "[warn] could not build optimal proxy_headers_hash error" + proxy_headers_hash_max_size 512; + proxy_headers_hash_bucket_size 128; + + # media caching stuff # https://docs.gotosocial.org/en/latest/advanced/caching/assets-media/#nginx location /assets/ { @@ -26,7 +31,7 @@ location __PATH__/ { } location /fileserver/ { - alias __DATADIR__; + alias /home/yunohost.app/__APP__/; autoindex off; expires 1w; add_header Cache-Control "private, immutable"; From 74881eb87d9c6e406d67a66c4e49c31a691bc9ec Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 23:25:56 +0200 Subject: [PATCH 7/8] Fix "Do not use 'add_header'" error --- conf/nginx.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6603e55..d1d550c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -26,15 +26,15 @@ location __PATH__/ { location /assets/ { alias __FINAL_PATH__/web/assets/; autoindex off; - expires 5m; - add_header Cache-Control "public"; + # 300 = 5 minutes + more_set_headers "Cache-control: public, max-age=300"; } location /fileserver/ { alias /home/yunohost.app/__APP__/; autoindex off; - expires 1w; - add_header Cache-Control "private, immutable"; + # 604800 = 1 week + more_set_headers "Cache-Control: private, immutable, max-age=604800"; try_files $uri @fileserver; } From a9972a3f72fbb30799cdd03a2986f803ba5a4fab Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Mon, 11 Sep 2023 23:44:32 +0200 Subject: [PATCH 8/8] workaround for a CI bug --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index f7fe5e6..082d69a 100755 --- a/scripts/install +++ b/scripts/install @@ -307,9 +307,12 @@ yunohost service add "$app" --description="Gotosocial server" --log="/var/log/$a #================================================= ynh_script_progression --message="Creating gotosocial admin user..." --weight=1 -ynh_exec_warn_less "$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account create --username "$admin" --email "$email" --password "$password" +# using "/var/www/$app" instead of "$final_path" as a temporary workaround for this bug: +# bad_ynh_exec_syntax() false positive: https://github.com/YunoHost/package_linter/issues/123 -ynh_exec_warn_less "$final_path"/gotosocial --config-path "$final_path/config.yaml" admin account promote --username "$admin" +ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$final_path/config.yaml" admin account create --username "$admin" --email "$email" --password "$password" + +ynh_exec_warn_less /var/www/"$app"/gotosocial --config-path "$final_path/config.yaml" admin account promote --username "$admin" #================================================= # START SYSTEMD SERVICE