about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-05-23 15:14:18 +0200
committerGitHub <noreply@github.com>2023-05-23 15:14:18 +0200
commit078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18 (patch)
tree52b92e62fab68ca44aa4c5df5385e0ad394495bc /nixos
parent4f5dc6e5a30d95892a120064178a38c705f9ee78 (diff)
parentf92e700f6c5e55555d9a18ed796a20e6f7686172 (diff)
downloadnixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar.gz
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar.bz2
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar.lz
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar.xz
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.tar.zst
nixlib-078d3ebcaae3ee458f2e43e3a6d92dd5693c4d18.zip
Merge pull request #232235 from cyberus-technology/outline-0.69.2
outline: 0.68.1 -> 0.69.2
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-apps/outline.nix19
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/outline.nix54
3 files changed, 61 insertions, 13 deletions
diff --git a/nixos/modules/services/web-apps/outline.nix b/nixos/modules/services/web-apps/outline.nix
index b72dd8243bb4..6f63198a68a5 100644
--- a/nixos/modules/services/web-apps/outline.nix
+++ b/nixos/modules/services/web-apps/outline.nix
@@ -586,7 +586,7 @@ in
 
       # Create an outline-sequalize wrapper (a wrapper around the wrapper) that
       # has the config file's path baked in. This is necessary because there is
-      # at least one occurrence of outline calling this from its own code.
+      # at least two occurrences of outline calling this from its own code.
       sequelize = pkgs.writeShellScriptBin "outline-sequelize" ''
         exec ${cfg.package}/bin/outline-sequelize \
           --config $RUNTIME_DIRECTORY/database.json \
@@ -687,21 +687,18 @@ in
           openssl rand -hex 32 > ${lib.escapeShellArg cfg.utilsSecretFile}
         fi
 
-        # The config file is required for the CLI, the DATABASE_URL environment
-        # variable is read by the app.
+        # The config file is required for the sequelize CLI.
         ${if (cfg.databaseUrl == "local") then ''
           cat <<EOF > $RUNTIME_DIRECTORY/database.json
           {
-            "production": {
-              "dialect": "postgres",
+            "production-ssl-disabled": {
               "host": "/run/postgresql",
               "username": null,
-              "password": null
+              "password": null,
+              "dialect": "postgres"
             }
           }
           EOF
-          export DATABASE_URL=${lib.escapeShellArg localPostgresqlUrl}
-          export PGSSLMODE=disable
         '' else ''
           cat <<EOF > $RUNTIME_DIRECTORY/database.json
           {
@@ -720,11 +717,7 @@ in
             }
           }
           EOF
-          export DATABASE_URL=${lib.escapeShellArg cfg.databaseUrl}
         ''}
-
-        cd $RUNTIME_DIRECTORY
-        ${sequelize}/bin/outline-sequelize db:migrate
       '';
 
       script = ''
@@ -781,7 +774,7 @@ in
         RuntimeDirectoryMode = "0750";
         # This working directory is required to find stuff like the set of
         # onboarding files:
-        WorkingDirectory = "${cfg.package}/share/outline/build";
+        WorkingDirectory = "${cfg.package}/share/outline";
       };
     };
   };
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index af541737e12f..c2519b776b3a 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -555,6 +555,7 @@ in {
   openstack-image-userdata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).userdata or {};
   opentabletdriver = handleTest ./opentabletdriver.nix {};
   owncast = handleTest ./owncast.nix {};
+  outline = handleTest ./outline.nix {};
   image-contents = handleTest ./image-contents.nix {};
   openvscode-server = handleTest ./openvscode-server.nix {};
   orangefs = handleTest ./orangefs.nix {};
diff --git a/nixos/tests/outline.nix b/nixos/tests/outline.nix
new file mode 100644
index 000000000000..e45be37f5d3b
--- /dev/null
+++ b/nixos/tests/outline.nix
@@ -0,0 +1,54 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }:
+let
+  accessKey = "BKIKJAA5BMMU2RHO6IBB";
+  secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
+  secretKeyFile = pkgs.writeText "outline-secret-key" ''
+    ${secretKey}
+  '';
+  rootCredentialsFile = pkgs.writeText "minio-credentials-full" ''
+    MINIO_ROOT_USER=${accessKey}
+    MINIO_ROOT_PASSWORD=${secretKey}
+  '';
+in
+{
+  name = "outline";
+
+  meta.maintainers = with lib.maintainers; [ xanderio ];
+
+  nodes = {
+    outline = { pkgs, config, ... }: {
+      nixpkgs.config.allowUnfree = true;
+      environment.systemPackages = [ pkgs.minio-client ];
+      services.outline = {
+        enable = true;
+        forceHttps = false;
+        storage = {
+          inherit accessKey secretKeyFile;
+          uploadBucketUrl = "http://localhost:9000";
+          uploadBucketName = "outline";
+          region = config.services.minio.region;
+        };
+      };
+      services.minio = {
+        enable = true;
+        inherit rootCredentialsFile;
+      };
+    };
+  };
+
+  testScript =
+    ''
+      machine.wait_for_unit("minio.service")
+      machine.wait_for_open_port(9000)
+
+      # Create a test bucket on the server
+      machine.succeed(
+          "mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4"
+      )
+      machine.succeed("mc mb minio/outline")
+
+      outline.wait_for_unit("outline.service")
+      outline.wait_for_open_port(3000)
+      outline.succeed("curl --fail http://localhost:3000/")
+    '';
+})