1import ./make-test-python.nix ({ pkgs, lib, ... }:
2let
3 accessKey = "BKIKJAA5BMMU2RHO6IBB";
4 secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
5 secretKeyFile = pkgs.writeText "outline-secret-key" ''
6 ${secretKey}
7 '';
8 rootCredentialsFile = pkgs.writeText "minio-credentials-full" ''
9 MINIO_ROOT_USER=${accessKey}
10 MINIO_ROOT_PASSWORD=${secretKey}
11 '';
12in
13{
14 name = "outline";
15
16 meta.maintainers = with lib.maintainers; [ xanderio ];
17
18 nodes = {
19 outline = { pkgs, config, ... }: {
20 nixpkgs.config.allowUnfree = true;
21 environment.systemPackages = [ pkgs.minio-client ];
22 services.outline = {
23 enable = true;
24 forceHttps = false;
25 storage = {
26 inherit accessKey secretKeyFile;
27 uploadBucketUrl = "http://localhost:9000";
28 uploadBucketName = "outline";
29 region = config.services.minio.region;
30 };
31 };
32 services.minio = {
33 enable = true;
34 inherit rootCredentialsFile;
35 };
36 };
37 };
38
39 testScript =
40 ''
41 machine.wait_for_unit("minio.service")
42 machine.wait_for_open_port(9000)
43
44 # Create a test bucket on the server
45 machine.succeed(
46 "mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4"
47 )
48 machine.succeed("mc mb minio/outline")
49
50 outline.wait_for_unit("outline.service")
51 outline.wait_for_open_port(3000)
52 outline.succeed("curl --fail http://localhost:3000/")
53 '';
54})