Add plausible user and database

This commit is contained in:
Ivan R. 2023-08-19 20:23:00 +05:00
parent a13a134360
commit 0af7d3e6a4
No known key found for this signature in database
GPG key ID: 56C7BAAE859B302C
2 changed files with 19 additions and 16 deletions

View file

@ -3,7 +3,7 @@
config.services.postgresql = {
enable = true;
package = pkgs.postgresql_15;
ensureDatabases = [ "mastodon" "matrix-synapse" "nextcloud" "maddy" ];
ensureDatabases = [ "mastodon" "matrix-synapse" "nextcloud" "maddy" "plausible" ];
ensureUsers = [
{
name = "mastodon";
@ -33,12 +33,20 @@
};
ensureClauses.login = true;
}
{
name = "plausible";
ensurePermissions = {
"DATABASE plausible" = "ALL PRIVILEGES";
};
ensureClauses.login = true;
}
];
initialScript = pkgs.writeText "pg-init.sql" ''
ALTER DATABASE nextcloud OWNER TO nextcloud;
ALTER DATABASE mastodon OWNER TO mastodon;
ALTER DATABASE "matrix-synapse" OWNER TO "matrix-synapse";
ALTER DATABASE maddy OWNER TO maddy;
ALTER DATABASE plausible OWNER TO plausible;
'';
identMap = ''
# ArbitraryMapName systemUser DBUser

View file

@ -25,23 +25,18 @@
isSystemUser = true;
group = "matrix-synapse";
};
plausible = {
isSystemUser = true;
group = "plausible";
};
};
users.groups = {
mastodon = {
members = [ "mastodon" config.services.nginx.user ];
};
nextcloud = {
members = [ "nextcloud" config.services.nginx.user ];
};
photoprism = {
members = [ "photoprism" config.services.nginx.user ];
};
matrix-synapse = {
members = [ "matrix-synapse" config.services.nginx.user ];
};
maddy = {
members = [ "maddy" ];
};
mastodon.members = [ "mastodon" config.services.nginx.user ];
nextcloud.members = [ "nextcloud" config.services.nginx.user ];
photoprism.members = [ "photoprism" config.services.nginx.user ];
matrix-synapse.members = [ "matrix-synapse" config.services.nginx.user ];
maddy.members = [ "maddy" ];
plausible.members = [ "plausible" ];
};
}