diff --git a/deployment/check/cli/flake-part.nix b/deployment/check/cli/flake-part.nix index ec2021fc..fbb24589 100644 --- a/deployment/check/cli/flake-part.nix +++ b/deployment/check/cli/flake-part.nix @@ -14,6 +14,7 @@ let "mastodon" "peertube" "pixelfed" + "attic" ]; pathToRoot = /. + (builtins.unsafeDiscardStringContext self); pathFromRoot = ./.; diff --git a/deployment/check/cli/nixosTest.nix b/deployment/check/cli/nixosTest.nix index 9bce082e..c28619e3 100644 --- a/deployment/check/cli/nixosTest.nix +++ b/deployment/check/cli/nixosTest.nix @@ -48,6 +48,11 @@ in s3AccessKeyFile = dummyFile; s3SecretKeyFile = dummyFile; }; + attic = { + enable = true; + s3AccessKeyFile = dummyFile; + s3SecretKeyFile = dummyFile; + }; temp.cores = 1; temp.initialUser = { username = "dummy"; @@ -72,6 +77,7 @@ in nodes.mastodon.virtualisation.memorySize = 4 * 1024; nodes.pixelfed.virtualisation.memorySize = 4 * 1024; nodes.peertube.virtualisation.memorySize = 5 * 1024; + nodes.attic.virtualisation.memorySize = 2 * 1024; ## FIXME: The test of presence of the services are very simple: we only ## check that there is a systemd service of the expected name on the @@ -86,6 +92,7 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with no services enabled"): deployer.succeed("nixops4 apply check-deployment-cli-nothing --show-trace --no-interactive 1>&2") @@ -95,6 +102,7 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with Mastodon and Pixelfed enabled"): deployer.succeed("nixops4 apply check-deployment-cli-mastodon-pixelfed --show-trace --no-interactive 1>&2") @@ -104,6 +112,7 @@ in mastodon.succeed("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.succeed("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with only Peertube enabled"): deployer.succeed("nixops4 apply check-deployment-cli-peertube --show-trace --no-interactive 1>&2") @@ -113,5 +122,6 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.succeed("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") ''; } diff --git a/deployment/check/common/deployerNode.nix b/deployment/check/common/deployerNode.nix index f8caba87..bbaf9c70 100644 --- a/deployment/check/common/deployerNode.nix +++ b/deployment/check/common/deployerNode.nix @@ -40,7 +40,7 @@ in ## default. These values have been trimmed down to the gigabyte. ## Memory use is expected to be dominated by the NixOS evaluation, ## which happens on the deployer. - memorySize = 4 * 1024; + memorySize = 5 * 1024; diskSize = 4 * 1024; cores = 2; }; @@ -59,7 +59,9 @@ in inputs.nixops4 inputs.nixops4-nixos inputs.nixpkgs + sources.flake-inputs + sources.vars pkgs.stdenv pkgs.stdenvNoCC diff --git a/deployment/check/panel/flake-part.nix b/deployment/check/panel/flake-part.nix index 3d268a98..b585bbeb 100644 --- a/deployment/check/panel/flake-part.nix +++ b/deployment/check/panel/flake-part.nix @@ -17,6 +17,7 @@ let "mastodon" "peertube" "pixelfed" + "attic" ]; pathToRoot = /. + (builtins.unsafeDiscardStringContext self); pathFromRoot = ./.; diff --git a/deployment/check/panel/nixosTest.nix b/deployment/check/panel/nixosTest.nix index 357c9a24..ebd4d0a8 100644 --- a/deployment/check/panel/nixosTest.nix +++ b/deployment/check/panel/nixosTest.nix @@ -33,6 +33,7 @@ let enableMastodon, enablePeertube, enablePixelfed, + enableAttic, }: hostPkgs.writers.writePython3Bin "interact-with-panel" { @@ -94,6 +95,7 @@ let checkbox_set(driver.find_element(By.XPATH, "//input[@name = 'mastodon.enable']"), ${toPythonBool enableMastodon}) checkbox_set(driver.find_element(By.XPATH, "//input[@name = 'peertube.enable']"), ${toPythonBool enablePeertube}) checkbox_set(driver.find_element(By.XPATH, "//input[@name = 'pixelfed.enable']"), ${toPythonBool enablePixelfed}) + checkbox_set(driver.find_element(By.XPATH, "//input[@name = 'attic.enable']"), ${toPythonBool enableAttic}) print("Start deployment...") driver.find_element(By.XPATH, "//button[@id = 'deploy-button']").click() @@ -194,6 +196,11 @@ in s3AccessKeyFile = dummyFile; s3SecretKeyFile = dummyFile; }; + attic = { + enable = true; + s3AccessKeyFile = dummyFile; + s3SecretKeyFile = dummyFile; + }; temp.cores = 1; temp.initialUser = { username = "dummy"; @@ -239,6 +246,7 @@ in nodes.mastodon.virtualisation.memorySize = 4 * 1024; nodes.pixelfed.virtualisation.memorySize = 4 * 1024; nodes.peertube.virtualisation.memorySize = 5 * 1024; + nodes.attic.virtualisation.memorySize = 2 * 1024; ## FIXME: The test of presence of the services are very simple: we only ## check that there is a systemd service of the expected name on the @@ -311,6 +319,7 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with no services enabled"): client.succeed("${ @@ -319,6 +328,7 @@ in enableMastodon = false; enablePeertube = false; enablePixelfed = false; + enableAttic = false; } }/bin/interact-with-panel >&2") @@ -327,6 +337,7 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with Mastodon and Pixelfed enabled"): client.succeed("${ @@ -335,6 +346,7 @@ in enableMastodon = true; enablePeertube = false; enablePixelfed = true; + enableAttic = false; } }/bin/interact-with-panel >&2") @@ -343,6 +355,7 @@ in mastodon.succeed("systemctl status mastodon-web.service") peertube.fail("systemctl status peertube.service") pixelfed.succeed("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") with subtest("Run deployment with only Peertube enabled"): client.succeed("${ @@ -351,6 +364,7 @@ in enableMastodon = false; enablePeertube = true; enablePixelfed = false; + enableAttic = false; } }/bin/interact-with-panel >&2") @@ -359,5 +373,6 @@ in mastodon.fail("systemctl status mastodon-web.service") peertube.succeed("systemctl status peertube.service") pixelfed.fail("systemctl status phpfpm-pixelfed.service") + attic.fail("systemctl status atticd.service") ''; } diff --git a/infra/common/resource.nix b/infra/common/resource.nix index 5e2b9fef..fc812be4 100644 --- a/infra/common/resource.nix +++ b/infra/common/resource.nix @@ -33,8 +33,10 @@ in ## should go into the `./nixos` subdirectory. nixos.module = { imports = [ - "${sources.agenix}/modules/age.nix" - "${sources.disko}/module.nix" + "${agenix}/modules/age.nix" + "${disko}/module.nix" + "${vars}/options.nix" + "${vars}/backends/on-machine.nix" ./options.nix ./nixos ]; diff --git a/services/fediversity/attic/default.nix b/services/fediversity/attic/default.nix index 292ebff5..dcfc3858 100644 --- a/services/fediversity/attic/default.nix +++ b/services/fediversity/attic/default.nix @@ -48,12 +48,7 @@ in attic = { inherit (config.fediversity.attic) s3AccessKeyFile s3SecretKeyFile; ensureAccess = { - peertube-videos = { - read = true; - write = true; - owner = true; - }; - peertube-playlists = { + attic = { read = true; write = true; owner = true; @@ -108,8 +103,8 @@ in outPath = "./attic.env"; text = '' ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64=${fileContents config.vars.generators.attic.files.token.path} - AWS_ACCESS_KEY_ID=$(cat ${config.fediversity.peertube.s3AccessKeyFile}) - AWS_SECRET_ACCESS_KEY=$(cat ${config.fediversity.peertube.s3SecretKeyFile}) + AWS_ACCESS_KEY_ID=$(cat ${config.fediversity.attic.s3AccessKeyFile}) + AWS_SECRET_ACCESS_KEY=$(cat ${config.fediversity.attic.s3SecretKeyFile}) ''; } }/bin/attic.env"; @@ -255,41 +250,54 @@ in #default-retention-period = "6 months"; }; - jwt = { - # WARNING: Changing _anything_ in this section will break any existing - # tokens. If you need to regenerate them, ensure that you use the the - # correct secret and include the `iss` and `aud` claims. + # jwt = { + # WARNING: Changing _anything_ in this section will break any existing + # tokens. If you need to regenerate them, ensure that you use the the + # correct secret and include the `iss` and `aud` claims. - # JWT `iss` claim - # - # Set this to the JWT issuer that you want to validate. - # If this is set, all received JWTs will validate that the `iss` claim - # matches this value. - #token-bound-issuer = "some-issuer"; + # JWT `iss` claim + # + # Set this to the JWT issuer that you want to validate. + # If this is set, all received JWTs will validate that the `iss` claim + # matches this value. + #token-bound-issuer = "some-issuer"; - # JWT `aud` claim - # - # Set this to the JWT audience(s) that you want to validate. - # If this is set, all received JWTs will validate that the `aud` claim - # contains at least one of these values. - #token-bound-audiences = ["some-audience1", "some-audience2"]; - }; + # JWT `aud` claim + # + # Set this to the JWT audience(s) that you want to validate. + # If this is set, all received JWTs will validate that the `aud` claim + # contains at least one of these values. + #token-bound-audiences = ["some-audience1", "some-audience2"]; + # }; # jwt.signing = { - # # JWT RS256 secret key - # # - # # Set this to the base64-encoded private half of an RSA PEM PKCS1 key. - # # TODO - # # You can also set it via the `ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64` - # # environment variable. - # token-rs256-secret-base64 = "%token_rs256_secret_base64%"; + # You must configure JWT signing and verification inside your TOML configuration by setting one of the following options in the [jwt.signing] block: + # * token-rs256-pubkey-base64 + # * token-rs256-secret-base64 + # * token-hs256-secret-base64 + # or by setting one of the following environment variables: + # * ATTIC_SERVER_TOKEN_RS256_PUBKEY_BASE64 + # * ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64 + # * ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 + # Options will be tried in that same order (configuration options first, then environment options if none of the configuration options were set, starting with the respective RSA pubkey option, the RSA secret option, and finally the HMAC secret option). The first option that is found will be used. + # If an RS256 pubkey (asymmetric RSA PEM PKCS1 public key) is provided, it will only be possible to verify received JWTs, and not sign new JWTs. + # If an RS256 secret (asymmetric RSA PEM PKCS1 private key) is provided, it will be used for both signing new JWTs and verifying received JWTs. + # If an HS256 secret (symmetric HMAC secret) is provided, it will be used for both signing new JWTs and verifying received JWTs. - # # JWT HS256 secret key - # # - # # Set this to the base64-encoded HMAC secret key. - # # You can also set it via the `ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64` - # # environment variable. - # #token-hs256-secret-base64 = ""; + # JWT RS256 secret key + # + # Set this to the base64-encoded private half of an RSA PEM PKCS1 key. + # TODO + # You can also set it via the `ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64` + # environment variable. + # token-rs256-secret-base64 = "%token_rs256_secret_base64%"; + + # JWT HS256 secret key + # + # Set this to the base64-encoded HMAC secret key. + # You can also set it via the `ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64` + # environment variable. + #token-hs256-secret-base64 = ""; # }; }; };