Skip to content

Commit f49ce4a

Browse files
committed
feat: update systemd service definition
as per commit supabase/postgres@493bd39 (HEAD -> develop, origin/develop, origin/HEAD) Author: Chris Stockton <[email protected]> Date: Wed Sep 17 07:48:52 2025 -0700 feat: tighten gotrue.service deps and startup behavior (#1783)
1 parent 9a8f145 commit f49ce4a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

nix/modules/nixos/auth.nix

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ let
2828
GOTRUE_JWT_EXP = "3600";
2929
GOTRUE_JWT_SECRET = "your-super-secret-jwt-token-with-at-least-32-characters-long";
3030
GOTRUE_MAILER_AUTOCONFIRM = "true";
31+
32+
# Both v2 & v3 support reloading via signals, on linux this is SIGUSR1.
33+
GOTRUE_RELOADING_SIGNAL_ENABLED = "true";
34+
GOTRUE_RELOADING_SIGNAL_NUMBER = "10";
35+
36+
# Both v2 & v3 disable the poller. While gotrue sets it to off by default we
37+
# defensively set it to false here.
38+
GOTRUE_RELOADING_POLLER_ENABLED = "false";
39+
40+
# Determines how much idle time must pass before triggering a reload. This
41+
# ensures only 1 reload operation occurs during a burst of config updates.
42+
GOTRUE_RELOADING_GRACE_PERIOD_INTERVAL = "2s";
43+
44+
# v3 does not use filesystem notifications for config reloads.
45+
GOTRUE_RELOADING_NOTIFY_ENABLED = "false";
46+
47+
# TODO: remove duplicates?
3148
GOTRUE_SITE_URL = "http://localhost:3000";
3249
GOTRUE_SMTP_ADMIN_EMAIL = "[email protected]";
3350
GOTRUE_SMTP_HOST = "localhost";
@@ -90,9 +107,10 @@ in
90107
description = "gotrue (auth)";
91108
wantedBy = [ "multi-user.target" ];
92109
serviceConfig = {
93-
Type = "simple";
110+
Type = "exec";
94111
WorkingDirectory = "/opt/gotrue";
95112
ExecStart = "${cfg.package}/bin/gotrue --config-dir /etc/auth.d";
113+
ExecReload = "${pkgs.coreutils}/bin/kill -10 $MAINPID";
96114
User = "gotrue";
97115
Restart = "always";
98116
RestartSec = 3;
@@ -108,6 +126,10 @@ in
108126
# pg_isready -h ${config.auth.settings.DB_HOST} -p ${config.auth.settings.DB_PORT} -U ${config.auth.settings.DB_USER}; do sleep 1; done
109127
# '';
110128
};
129+
unitConfig = {
130+
StartLimitIntervalSec = 10;
131+
StartLimitBurst = 5;
132+
};
111133
};
112134

113135
systemd.tmpfiles.rules = [

nix/package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pkgs.buildGoModule {
33
pname = "supabase-auth";
44
version = "2.180.0";
5-
src = ./..;
5+
src = ./..; # TODO: better filters out what's not go files
66

77
vendorHash = "sha256-knYvNkEVffWisvb4Dhm5qqtqQ4co9MGoNt6yH6dUll8=";
88

0 commit comments

Comments
 (0)