plausible: 1.4.0 -> 1.4.3

ChangeLog: https://github.com/plausible/analytics/blob/v1.4.3/CHANGELOG.md#unreleased

Also makes the option `services.plausible.releaseCookiePath` mandatory[1]: since Elixir
1.13 the `RELEASE_COOKIE` env-var *must* be set, otherwise the startup
fails[2]. Since we drop `$out/releases/COOKIE` in the `fixupPhase` of
`mixRelease` and Elixir seems to always attempt to generate such a
file[3], I figured it's reasonable to just make it mandatory now.

Closes #155575

[1] https://nixos.org/manual/nixos/stable/options.html#opt-services.plausible.releaseCookiePath
[2] f24eb2c1ef /
    https://github.com/elixir-lang/elixir/issues/11114
[3] https://hexdocs.pm/mix/Mix.Tasks.Release.html, see `:cookie`
This commit is contained in:
Maximilian Bosch 2022-01-25 17:19:49 +01:00
parent 6ea0d68c4d
commit e211c94b94
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
6 changed files with 2055 additions and 2166 deletions

View File

@ -10,8 +10,7 @@ in {
enable = mkEnableOption "plausible";
releaseCookiePath = mkOption {
default = null;
type = with types; nullOr (either str path);
type = with types; either str path;
description = ''
The path to the file with release cookie. (used for remote connection to the running node).
'';
@ -235,6 +234,8 @@ in {
script = ''
export CONFIG_DIR=$CREDENTIALS_DIRECTORY
export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
# setup
${pkgs.plausible}/createdb.sh
${pkgs.plausible}/migrate.sh
@ -243,10 +244,8 @@ in {
psql -d plausible <<< "UPDATE users SET email_verified=true;"
fi
''}
${optionalString (cfg.releaseCookiePath != null) ''
export RELEASE_COOKIE="$(< $CREDENTIALS_DIRECTORY/RELEASE_COOKIE )"
''}
plausible start
exec plausible start
'';
serviceConfig = {
@ -257,8 +256,8 @@ in {
LoadCredential = [
"ADMIN_USER_PWD:${cfg.adminUser.passwordFile}"
"SECRET_KEY_BASE:${cfg.server.secretKeybaseFile}"
] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"]
++ lib.optionals (cfg.releaseCookiePath != null) [ "RELEASE_COOKIE:${cfg.releaseCookiePath}"];
"RELEASE_COOKIE:${cfg.releaseCookiePath}"
] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"];
};
};
}

View File

@ -8,6 +8,9 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
virtualisation.memorySize = 4096;
services.plausible = {
enable = true;
releaseCookiePath = "${pkgs.runCommand "cookie" { } ''
${pkgs.openssl}/bin/openssl rand -base64 64 >"$out"
''}";
adminUser = {
email = "admin@example.org";
passwordFile = "${pkgs.writeText "pwd" "foobar"}";

View File

@ -12,13 +12,13 @@
let
pname = "plausible";
version = "1.4.0";
version = "1.4.3";
src = fetchFromGitHub {
owner = "plausible";
repo = "analytics";
rev = "v${version}";
sha256 = "1d31y7mwvml17w97dm5c4312n0ciq39kf4hz3g80hdzbbn72mi4q";
sha256 = "1aa5nkwb4qz599zb77dhwrvn5gwcdiyji4vbxmayn2zhv2vhj36d";
};
# TODO consider using `mix2nix` as soon as it supports git dependencies.

View File

@ -64,5 +64,5 @@
"webpack-bundle-analyzer": "^4.4.2"
},
"name": "plausible",
"version": "v1.4.0"
"version": "v1.4.3"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff