diff --git a/nixos/modules/services/web-apps/plausible.nix b/nixos/modules/services/web-apps/plausible.nix
index caf5ba466dfe..b56848b79d21 100644
--- a/nixos/modules/services/web-apps/plausible.nix
+++ b/nixos/modules/services/web-apps/plausible.nix
@@ -7,10 +7,15 @@ let
# FIXME consider using LoadCredential as soon as it actually works.
envSecrets = ''
- export ADMIN_USER_PWD="$(<${cfg.adminUser.passwordFile})"
- export SECRET_KEY_BASE="$(<${cfg.server.secretKeybaseFile})"
+ ADMIN_USER_PWD="$(<${cfg.adminUser.passwordFile})"
+ export ADMIN_USER_PWD # separate export to make `set -e` work
+
+ SECRET_KEY_BASE="$(<${cfg.server.secretKeybaseFile})"
+ export SECRET_KEY_BASE # separate export to make `set -e` work
+
${optionalString (cfg.mail.smtp.passwordFile != null) ''
- export SMTP_USER_PWD="$(<${cfg.mail.smtp.passwordFile})"
+ SMTP_USER_PWD="$(<${cfg.mail.smtp.passwordFile})"
+ export SMTP_USER_PWD # separate export to make `set -e` work
''}
'';
in {
@@ -102,6 +107,11 @@ in {
type = types.str;
description = ''
Public URL where plausible is available.
+
+ Note that /path components are currently ignored:
+
+ https://github.com/plausible/analytics/issues/1182
+ .
'';
};
};
@@ -228,6 +238,7 @@ in {
WorkingDirectory = "/var/lib/plausible";
StateDirectory = "plausible";
ExecStartPre = "@${pkgs.writeShellScript "plausible-setup" ''
+ set -eu -o pipefail
${envSecrets}
${pkgs.plausible}/createdb.sh
${pkgs.plausible}/migrate.sh
@@ -238,6 +249,7 @@ in {
''}
''} plausible-setup";
ExecStart = "@${pkgs.writeShellScript "plausible" ''
+ set -eu -o pipefail
${envSecrets}
plausible start
''} plausible";
diff --git a/pkgs/servers/web-apps/plausible/default.nix b/pkgs/servers/web-apps/plausible/default.nix
index bf408551a44e..2cdd33a245e5 100644
--- a/pkgs/servers/web-apps/plausible/default.nix
+++ b/pkgs/servers/web-apps/plausible/default.nix
@@ -26,12 +26,15 @@ let
mixFodDeps = beamPackages.fetchMixDeps {
pname = "${pname}-deps";
inherit src version;
- sha256 = "18h3hs69nw06msvs3nnymf6p94qd3x1f4d2zawqriy9fr5fz7zx6";
+ sha256 = "1x0if0ifk272vcqjlgf097pxsw13bhwy8vs0b89l0bssx1bzygsi";
# We need ecto 3.6 as this version checks whether the database exists before
# trying to create it. The creation attempt would always require super-user privileges
# and since 3.6 this isn't the case anymore.
- patches = [ ./ecto_sql-fix.patch ];
+ patches = [
+ ./ecto_sql-fix.patch
+ ./plausible-Bump-clickhouse_ecto-dependency-to-be-compatible-with-ecto-3.6.patch
+ ];
};
yarnDeps = mkYarnModules {
diff --git a/pkgs/servers/web-apps/plausible/plausible-Bump-clickhouse_ecto-dependency-to-be-compatible-with-ecto-3.6.patch b/pkgs/servers/web-apps/plausible/plausible-Bump-clickhouse_ecto-dependency-to-be-compatible-with-ecto-3.6.patch
new file mode 100644
index 000000000000..b8aa7319a217
--- /dev/null
+++ b/pkgs/servers/web-apps/plausible/plausible-Bump-clickhouse_ecto-dependency-to-be-compatible-with-ecto-3.6.patch
@@ -0,0 +1,26 @@
+From 127a77882879e5cdf32d908ee3b1b6cbdc9e482e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?=
+Date: Wed, 14 Jul 2021 01:20:29 +0200
+Subject: [PATCH] Bump `clickhouse_ecto` dependency to be compatible with ecto
+ 3.6
+
+---
+ mix.lock | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mix.lock b/mix.lock
+index ecae8ac..d42af1e 100644
+--- a/mix.lock
++++ b/mix.lock
+@@ -12,7 +12,7 @@
+ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
+ "cachex": {:hex, :cachex, "3.3.0", "6f2ebb8f27491fe39121bd207c78badc499214d76c695658b19d6079beeca5c2", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]}], "hexpm", "d90e5ee1dde14cef33f6b187af4335b88748b72b30c038969176cd4e6ccc31a1"},
+ "certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
+- "clickhouse_ecto": {:git, "https://github.com/plausible/clickhouse_ecto.git", "b30ccc93a4101a25ff0bba92113e18d8a9a8b28e", []},
++ "clickhouse_ecto": {:git, "https://github.com/plausible/clickhouse_ecto.git", "1969f14ecef7c357b2bd8bdc3e566234269de58c", []},
+ "clickhousex": {:git, "https://github.com/plausible/clickhousex", "0832dd4b1af1f0eba1d1018c231bf0d8d281f031", []},
+ "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
+ "comeonin": {:hex, :comeonin, "5.3.2", "5c2f893d05c56ae3f5e24c1b983c2d5dfb88c6d979c9287a76a7feb1e1d8d646", [:mix], [], "hexpm", "d0993402844c49539aeadb3fe46a3c9bd190f1ecf86b6f9ebd71957534c95f04"},
+--
+2.31.1
+