4 accessKey = "BKIKJAA5BMMU2RHO6IBB";
5 secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
7 minioCredentialsFile = pkgs.writeText "minio-credentials-full" ''
8 MINIO_ROOT_USER=${accessKey}
9 MINIO_ROOT_PASSWORD=${secretKey}
11 environmentFile = pkgs.runCommand "atticd-env" { } ''
12 echo ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64="$(${lib.getExe pkgs.openssl} genrsa -traditional 4096 | ${pkgs.coreutils}/bin/base64 -w0)" > $out
24 inherit environmentFile;
27 environment.systemPackages = [
40 endpoint = "http://127.0.0.1:9000";
43 access_key_id = accessKey;
44 secret_access_key = secretKey;
49 inherit environmentFile;
54 rootCredentialsFile = minioCredentialsFile;
57 environment.systemPackages = [
68 with subtest("local storage push"):
69 local.wait_for_unit("atticd.service")
70 token = local.succeed("atticd-atticadm make-token --sub stop --validity 1y --create-cache '*' --pull '*' --push '*' --delete '*' --configure-cache '*' --configure-cache-retention '*'").strip()
72 local.succeed(f"attic login local http://localhost:8080 {token}")
73 local.succeed("attic cache create test-cache")
74 local.succeed("attic push test-cache ${environmentFile}")
76 with subtest("s3 storage push"):
77 s3.wait_for_unit("atticd.service")
78 s3.wait_for_unit("minio.service")
79 s3.wait_for_open_port(9000)
81 "mc config host add minio "
82 + "http://localhost:9000 "
83 + "${accessKey} ${secretKey} --api s3v4",
86 token = s3.succeed("atticd-atticadm make-token --sub stop --validity 1y --create-cache '*' --pull '*' --push '*' --delete '*' --configure-cache '*' --configure-cache-retention '*'").strip()
88 s3.succeed(f"attic login s3 http://localhost:8080 {token}")
89 s3.succeed("attic cache create test-cache")
90 s3.succeed("attic push test-cache ${environmentFile}")