outline: 0.68.1 -> 0.69.2

This commit is contained in:
Alexander Sieg 2023-05-16 14:55:33 +02:00
parent 8f13c7d6d7
commit 74bc42615c
No known key found for this signature in database
5 changed files with 4526 additions and 9788 deletions

View File

@ -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";
};
};
};

View File

@ -9,20 +9,20 @@
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 +43,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 +54,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,9 +67,9 @@ 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

View File

@ -1,15 +1,22 @@
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 {
const commandResult = execSync(
- `yarn sequelize db:migrate:status${
- env.PGSSLMODE === "disable" ? " --env=production-ssl-disabled" : ""
- }`
+ "outline-sequelize db:migrate:status"
);
const commandResultArray = Buffer.from(commandResult)
.toString("utf-8")
@@ -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