Give postgres a consistent user

This commit is contained in:
niten 2023-07-17 17:52:53 -07:00
parent 7205859ddd
commit c8746c01ef
1 changed files with 11 additions and 3 deletions

View File

@ -60,6 +60,7 @@ let
"${stateDirectory}/postgres:/var/lib/postgresql/data:Z"
"${postgresCfg.configFile}:/etc/postgresql.conf"
];
user = "${toString postgresCfg.uid}:${toString postgresCfg.uid}";
env_file = [ postgresCfg.envFile ];
restart = "always";
};
@ -306,9 +307,15 @@ in {
};
};
users.users.lemmy-pictrs = {
isSystemUser = true;
group = "lemmy-pictrs";
users.users = {
lemmy-pictrs = {
isSystemUser = true;
group = "lemmy-pictrs";
};
lemmy-postgres = {
isSystemUser = true;
group = "lemmy-postgres";
};
};
systemd.tmpfiles.rules = [
@ -352,6 +359,7 @@ in {
image = cfg.docker-images.postgres;
envFile = hostSecrets.lemmyPostgresEnv.target-file;
configFile = hostSecrets.lemmyPostgresCfg.target-file;
uid = config.users.users.lemmy-postgres.uid;
};
};
in { imports = [ lemmyImage ]; };