From 666de2c8f4143cd67cb99e4a324a8f394cb326cd Mon Sep 17 00:00:00 2001 From: teutat3s Date: Tue, 15 Oct 2024 23:19:02 +0200 Subject: [PATCH] mastodon: switch files.pub.solar from storj to garage s3 backend --- modules/mastodon/default.nix | 6 +++--- modules/nginx-mastodon-files/default.nix | 12 ++++++++---- modules/nginx/default.nix | 7 +++++++ secrets/mastodon-extra-env-secrets.age | Bin 2878 -> 2663 bytes 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/modules/mastodon/default.nix b/modules/mastodon/default.nix index 01acf7a6..2f16e330 100644 --- a/modules/mastodon/default.nix +++ b/modules/mastodon/default.nix @@ -96,9 +96,9 @@ # S3 File storage (optional) # ----------------------- S3_ENABLED = "true"; - S3_BUCKET = "pub-solar-mastodon"; - S3_REGION = "europe-west-1"; - S3_ENDPOINT = "https://gateway.tardigradeshare.io"; + S3_BUCKET = "mastodon"; + S3_REGION = "eu-central"; + S3_ENDPOINT = "https://buckets.pub.solar"; S3_ALIAS_HOST = "files.${config.pub-solar-os.networking.domain}"; # Translation (optional) # ----------------------- diff --git a/modules/nginx-mastodon-files/default.nix b/modules/nginx-mastodon-files/default.nix index b5497468..a4ddca4e 100644 --- a/modules/nginx-mastodon-files/default.nix +++ b/modules/nginx-mastodon-files/default.nix @@ -1,8 +1,7 @@ { config, ... }: let - objStorHost = "link.tardigradeshare.io"; - objStorBucket = "s/jw24ad6l4a6zxsnd32cmf5hp5nsq/pub-solar-mastodon"; + objStorHost = "mastodon.web.pub.solar"; in { services.nginx.virtualHosts = { @@ -10,6 +9,12 @@ in enableACME = true; forceSSL = true; + # Use variable to force nginx to perform a DNS resolution on its value, + # the IP of the object storage provider may not always remain the same. + extraConfig = '' + set $s3_backend 'https://${objStorHost}'; + ''; + locations = { "= /" = { index = "index.html"; @@ -25,7 +30,6 @@ in deny all; } - resolver 8.8.8.8; proxy_set_header Host ${objStorHost}; proxy_set_header Connection \'\'; proxy_set_header Authorization \'\'; @@ -40,7 +44,7 @@ in proxy_hide_header x-amz-bucket-region; proxy_hide_header x-amzn-requestid; proxy_ignore_headers Set-Cookie; - proxy_pass https://${objStorHost}/${objStorBucket}$request_uri?download; + proxy_pass $s3_backend$uri; proxy_intercept_errors off; proxy_ssl_protocols TLSv1.2 TLSv1.3; proxy_ssl_server_name on; diff --git a/modules/nginx/default.nix b/modules/nginx/default.nix index 0122164d..46bec0ff 100644 --- a/modules/nginx/default.nix +++ b/modules/nginx/default.nix @@ -22,6 +22,13 @@ in recommendedOptimisation = true; recommendedProxySettings = true; recommendedTlsSettings = true; + resolver.addresses = [ + # quad9.net + "9.9.9.9" + "149.112.112.112" + "[2620:fe::fe]" + "[2620:fe::9]" + ]; appendHttpConfig = '' # https://my.f5.com/manage/s/article/K51798430 proxy_headers_hash_bucket_size 128; diff --git a/secrets/mastodon-extra-env-secrets.age b/secrets/mastodon-extra-env-secrets.age index 14ad42713dc4552370b4f661043838718a37b4cb..c78b5b57a4084f3047084aa98baa223137fd33a5 100644 GIT binary patch literal 2663 zcmZXW>+9;+kAk@Aiz!a@=ZlHDzu*H8pXd30-7vTi z?7gZln)tB4`A~)976vZ7XH?hGg}_HJ3?@f0D05TIwnTx4l|6>2uqGnI7YRk zCP^0(&by>H#Y}az4}sO*TWcoTOm_M>=4fR>umZ`s?KnExE)=#wqa72_+D3l*|Fom+ zv2r)^a{lCqL7DS`EJo~#%b12eVO=Z<&!!+R#0?h)%!!c~k(wSBv1urw>*&)y&RPo3Im=QLoi5}Y6-H>wpHCX7whjintjqY5`QcBGOM zJvafmJ<>|5xi<5KKv>C+b`QylX}uNK0&zWdyrOiBp;y8ax-J;s999_T$-#UnSoWbY z6L2l`6;zj1TdE=2;k{##VpJ(g!A3x|!YTtBc2>M$X{4J*yU9U!C6)|}VP4^UwBB=a zwb0x-y|OsL3b2d!5;CC=wT$ni~&W!-kIs;3fWD@yUJT-@k28=8{>e7g?o)X17S41I+#^FP&gkyvES2-kzuq(3dQVM#q1AVRn^rKG>LW8#z6;aq8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