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

View file

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