diff --git a/config/services/akkoma/default.nix b/config/services/akkoma/default.nix index 0b2316e9..f7c8dabc 100644 --- a/config/services/akkoma/default.nix +++ b/config/services/akkoma/default.nix @@ -7,6 +7,13 @@ system, ... }: let + purge_url_script = pkgs.writeScript "purge-url" '' + access_key=$(cat ${config.sops.secrets."services/bunny-key".path}) + for url in $@; do + url=$(echo $url | ${pkgs.python3}/bin/python3 -c "import sys; import urllib.parse; print(urllib.parse.quote(sys.stdin.read().strip()))") + ${pkgs.curl}/bin/curl -H "Authorization: Bearer $access_key" -X POST "https://api.bunny.net/purge?url=$url&async=false" + done + ''; emoji_set_names = ["volpeon-blobfox-flip" "volpeon-blobfox" "volpeon-bunhd-flip" "volpeon-bunhd" "volpeon-drgn" "volpeon-fox" "volpeon-raccoon" "volpeon-vlpn" "lotte" "caro"]; emoji_sets = builtins.listToAttrs (map (name: { inherit name; @@ -141,9 +148,17 @@ }; ":media_proxy" = { enabled = true; + base_url = "https://mediaproxy.chir.rs"; proxy_opts = { redirect_on_failure = true; }; + invalidation = { + enabled = true; + provider = mkRaw "Pleroma.Web.MediaProxy.Invalidation.Script"; + }; + }; + "Pleroma.Web.MediaProxy.Invalidation.Script" = { + script_path = "${purge_url_script}"; }; "Pleroma.Repo" = { adapter = mkRaw "Ecto.Adapters.Postgres"; @@ -214,6 +229,7 @@ in { } ]; sops.secrets."services/akkoma.exs" = {owner = "akkoma";}; + sops.secrets."services/bunny-key".owner = "akkoma"; services.caddy.virtualHosts."akko.chir.rs" = { useACMEHost = "chir.rs"; extraConfig = '' diff --git a/secrets/nixos-8gb-fsn1-1.yaml b/secrets/nixos-8gb-fsn1-1.yaml index fb4b0566..079255f9 100644 --- a/secrets/nixos-8gb-fsn1-1.yaml +++ b/secrets/nixos-8gb-fsn1-1.yaml @@ -10,6 +10,7 @@ security: services: nix: cache-key: ENC[AES256_GCM,data:aLUW21G4ubmxS97LOwvUY+9ovrk02tZwq3D6tSO5tK9DwhySEuquQIHKsmuhsQtuCZRDLPgR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ZWGqJ1wE6JuxChMifjs1q0c=,tag:o8g+taLxtnZb3mF72sxrbA==,type:str] + lastmodified: "2022-12-04T12:33:55Z" + mac: ENC[AES256_GCM,data:32UzO0QJVp1YtEaL67k9BCckx3G2E7eX7Sa+MORwidjGCEg2UrEzn15DlBuLKHr/iaZzOO3eQSODnJXBGCv6h5m8WOCFyieCHClC3HpiOGPAaUPSZjx5xD5Lnvaziy6q5sZe7a+3DnQf3G8ajb2YSwB+CsjuRjAulnZJzxvKCQA=,iv:K795ZLX86GekNWlkJUmVZSaclEL3URABH33nD+/TG5E=,tag:R33H43tw1zUta7Pqu1nEWQ==,type:str] pgp: - created_at: "2022-02-02T17:50:42Z" enc: | diff --git a/zones/chir.rs.nix b/zones/chir.rs.nix index e0df1759..e4beb27b 100644 --- a/zones/chir.rs.nix +++ b/zones/chir.rs.nix @@ -102,7 +102,7 @@ with dns.lib.combinators; let SOA = { nameServer = "ns1.chir.rs."; adminEmail = "lotte@chir.rs"; - serial = 19; + serial = 20; }; NS = [ "ns1.chir.rs." @@ -171,7 +171,7 @@ with dns.lib.combinators; let _keybase.TXT = [ (ttl zoneTTL (txt "keybase-site-verification=r044cwg0wOTW-ws35BA5MMRLNwjdTNJ4uOu6kgdTopI")) ]; - + www = createZone {}; api = createZone {}; git = createZone {}; @@ -193,6 +193,7 @@ with dns.lib.combinators; let "cache-chir-rs.b-cdn.net." ]; peertube = createZone {}; + mediaproxy.CNAME = [ "mediaproxy-chir-rs.b-cdn.net." ]; int = delegateTo [