Unverified Commit 078d3ebc authored by Ryan Lahfa's avatar Ryan Lahfa Committed by GitHub
Browse files

Merge pull request #232235 from cyberus-technology/outline-0.69.2

outline: 0.68.1 -> 0.69.2
parents 4f5dc6e5 f92e700f
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -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";
      };
    };
  };
+1 −0
Original line number Diff line number Diff line
@@ -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 {};
+54 −0
Original line number Diff line number Diff line
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/")
    '';
})
+17 −19
Original line number Diff line number Diff line
@@ -5,24 +5,25 @@
, nodejs
, yarn
, yarn2nix-moretea
, nixosTests
}:

stdenv.mkDerivation rec {
  pname = "outline";
  version = "0.68.1";
  version = "0.69.2";

  src = fetchFromGitHub {
    owner = "outline";
    repo = "outline";
    rev = "v${version}";
    sha256 = "sha256-pln3cdozZPEodfXeUtTbBvhHb5yqE4uu0VKA95Zv6ro=";
    hash = "sha256-XevrCUvPmAbPTysJ/o7i2xAZTQ+UFYtVal/aZKvt+Ls=";
  };

  nativeBuildInputs = [ makeWrapper yarn2nix-moretea.fixup_yarn_lock ];
  buildInputs = [ yarn nodejs ];

  # Replace the inline call to yarn with our sequalize wrapper. This should be
  # the only occurrence:
  # Replace the inline calls to yarn with our sequalize wrapper. These should be
  # the two occurrences:
  # https://github.com/outline/outline/search?l=TypeScript&q=yarn
  patches = [ ./sequelize-command.patch ];

@@ -43,12 +44,10 @@ stdenv.mkDerivation rec {
      --frozen-lockfile \
      --ignore-engines --ignore-scripts
    patchShebangs node_modules/
    # apply upstream patches with `patch-package`
    yarn run postinstall
    yarn build

    pushd server
    cp -r config migrations onboarding ../build/server/
    popd

    runHook postBuild
  '';

@@ -56,16 +55,11 @@ stdenv.mkDerivation rec {
    runHook preInstall

    mkdir -p $out/bin $out/share/outline
    mv public node_modules build $out/share/outline/
    mv build server public node_modules $out/share/outline/

    node_modules=$out/share/outline/node_modules
    build=$out/share/outline/build

    # On NixOS the WorkingDirectory is set to the build directory, as
    # this contains files needed in the onboarding process. This folder
    # must also contain the `public` folder for mail notifications to
    # work, as it contains the mail templates.
    ln -s $out/share/outline/public $build/public
    server=$out/share/outline/server

    makeWrapper ${nodejs}/bin/node $out/bin/outline-server \
      --add-flags $build/server/index.js \
@@ -74,21 +68,25 @@ stdenv.mkDerivation rec {

    makeWrapper ${nodejs}/bin/node $out/bin/outline-sequelize \
      --add-flags $node_modules/.bin/sequelize \
      --add-flags "--migrations-path $build/server/migrations" \
      --add-flags "--models-path $build/server/models" \
      --add-flags "--seeders-path $build/server/models/fixtures" \
      --add-flags "--migrations-path $server/migrations" \
      --add-flags "--models-path $server/models" \
      --add-flags "--seeders-path $server/models/fixtures" \
      --set NODE_ENV production \
      --set NODE_PATH $node_modules

    runHook postInstall
  '';

  passthru.tests = {
    basic-functionality = nixosTests.outline;
  };

  meta = with lib; {
    description = "The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible";
    homepage = "https://www.getoutline.com/";
    changelog = "https://github.com/outline/outline/releases";
    license = licenses.bsl11;
    maintainers = with maintainers; [ cab404 yrd ];
    maintainers = with maintainers; [ cab404 yrd xanderio ];
    platforms = platforms.linux;
  };
}
+19 −12
Original line number Diff line number Diff line
diff --git a/server/utils/startup.ts b/server/utils/startup.ts
index 7554b854..6641f805 100644
index 444de475..b883f71a 100644
--- a/server/utils/startup.ts
+++ b/server/utils/startup.ts
@@ -8,9 +8,7 @@ import Team from "@server/models/Team";
 export function checkPendingMigrations() {
   try {
@@ -8,7 +8,7 @@ import Team from "@server/models/Team";
 
 function getPendingMigrations() {
   const commandResult = execSync(
-    `yarn sequelize db:migrate:status${
-        env.PGSSLMODE === "disable" ? " --env=production-ssl-disabled" : ""
-      }`
+      "outline-sequelize db:migrate:status"
+    `outline-sequelize db:migrate:status${
       env.PGSSLMODE === "disable" ? " --env=production-ssl-disabled" : ""
     }`
   );
@@ -26,7 +26,7 @@ function getPendingMigrations() {
 function runMigrations() {
   Logger.info("database", "Running migrations...");
   const cmdResult = execSync(
-    `yarn db:migrate${
+    `outline-sequelize db:migrate${
       env.PGSSLMODE === "disable" ? " --env=production-ssl-disabled" : ""
     }`
   );
     const commandResultArray = Buffer.from(commandResult)
       .toString("utf-8")
Loading