outline: 0.69.2 -> 0.70.2

This commit is contained in:
Alexander Sieg 2023-07-05 13:11:00 +02:00
parent 8fa6417e9f
commit b926effb76
No known key found for this signature in database
6 changed files with 1983 additions and 2210 deletions

View File

@ -64,6 +64,8 @@
- `spamassassin` no longer supports the `Hashcash` module. The module needs to be removed from the `loadplugin` list if it was copied over from the default `initPreConf` option.
- `services.outline.sequelizeArguments` has been removed, as `outline` no longer executes database migrations via the `sequelize` cli.
- The Caddy module gained a new option named `services.caddy.enableReload` which is enabled by default. It allows reloading the service instead of restarting it, if only a config file has changed. This option must be disabled if you have turned off the [Caddy admin API](https://caddyserver.com/docs/caddyfile/options#admin). If you keep this option enabled, you should consider setting [`grace_period`](https://caddyserver.com/docs/caddyfile/options#grace-period) to a non-infinite value to prevent Caddy from delaying the reload indefinitely.
## Other Notable Changes {#sec-release-23.11-notable-changes}

View File

@ -3,8 +3,12 @@
let
defaultUser = "outline";
cfg = config.services.outline;
inherit (lib) mkRemovedOptionModule;
in
{
imports = [
(mkRemovedOptionModule [ "services" "outline" "sequelizeArguments" ] "Database migration are run agains configurated database by outline directly")
];
# See here for a reference of all the options:
# https://github.com/outline/outline/blob/v0.67.0/.env.sample
# https://github.com/outline/outline/blob/v0.67.0/app.json
@ -25,7 +29,7 @@ in
# to still land in the same team. Note that this effectively makes
# Outline a single-team instance.
patchPhase = ${"''"}
sed -i 's/const domain = parts\.length && parts\[1\];/const domain = "example.com";/g' server/routes/auth/providers/oidc.ts
sed -i 's/const domain = parts\.length && parts\[1\];/const domain = "example.com";/g' plugins/oidc/server/auth/oidc.ts
${"''"};
})
'';
@ -51,15 +55,6 @@ in
'';
};
sequelizeArguments = lib.mkOption {
type = lib.types.str;
default = "";
example = "--env=production-ssl-disabled";
description = lib.mdDoc ''
Optional arguments to pass to `sequelize` calls.
'';
};
#
# Required options
#
@ -583,16 +578,6 @@ in
systemd.services.outline = let
localRedisUrl = "redis+unix:///run/redis-outline/redis.sock";
localPostgresqlUrl = "postgres://localhost/outline?host=/run/postgresql";
# 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 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 \
${cfg.sequelizeArguments} \
"$@"
'';
in {
description = "Outline wiki and knowledge base";
wantedBy = [ "multi-user.target" ];
@ -603,7 +588,6 @@ in
++ lib.optional (cfg.redisUrl == "local") "redis-outline.service";
path = [
pkgs.openssl # Required by the preStart script
sequelize
];
@ -687,37 +671,6 @@ in
openssl rand -hex 32 > ${lib.escapeShellArg cfg.utilsSecretFile}
fi
# The config file is required for the sequelize CLI.
${if (cfg.databaseUrl == "local") then ''
cat <<EOF > $RUNTIME_DIRECTORY/database.json
{
"production-ssl-disabled": {
"host": "/run/postgresql",
"username": null,
"password": null,
"dialect": "postgres"
}
}
EOF
'' else ''
cat <<EOF > $RUNTIME_DIRECTORY/database.json
{
"production": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres",
"dialectOptions": {
"ssl": {
"rejectUnauthorized": false
}
}
},
"production-ssl-disabled": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres"
}
}
EOF
''}
'';
script = ''

View File

@ -10,23 +10,18 @@
stdenv.mkDerivation rec {
pname = "outline";
version = "0.69.2";
version = "0.70.2";
src = fetchFromGitHub {
owner = "outline";
repo = "outline";
rev = "v${version}";
hash = "sha256-XevrCUvPmAbPTysJ/o7i2xAZTQ+UFYtVal/aZKvt+Ls=";
hash = "sha256-y2VGWuwJX91Aa8Bs7YcT4MKOURrFKXUz9CcQkUI/U2s=";
};
nativeBuildInputs = [ makeWrapper yarn2nix-moretea.fixup_yarn_lock ];
buildInputs = [ yarn nodejs ];
# 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 ];
yarnOfflineCache = yarn2nix-moretea.importOfflineCache ./yarn.nix;
configurePhase = ''
@ -66,14 +61,6 @@ stdenv.mkDerivation rec {
--set NODE_ENV production \
--set NODE_PATH $node_modules
makeWrapper ${nodejs}/bin/node $out/bin/outline-sequelize \
--add-flags $node_modules/.bin/sequelize \
--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
'';

View File

@ -1,22 +0,0 @@
diff --git a/server/utils/startup.ts b/server/utils/startup.ts
index 444de475..b883f71a 100644
--- a/server/utils/startup.ts
+++ b/server/utils/startup.ts
@@ -8,7 +8,7 @@ import Team from "@server/models/Team";
function getPendingMigrations() {
const commandResult = execSync(
- `yarn 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" : ""
}`
);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff