-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
Description
With this basic example, I can't get postgres to contain the expected database I want.
process-compose."default" = {config, ...}: let
dbuser = "postgres";
dbpass = "postgres";
dbName = "example";
in {
imports = [
inputs.services-flake.processComposeModules.default
];
services.postgres.pg1 = {
enable = true;
superuser = dbuser;
initialScript.before = ''
CREATE USER ${dbuser} WITH SUPER PASSWORD '${dbpass}';
'';
initialDatabases = [
{
name = dbName;
schemas = [];
}
];
};First time I run it, process-compose exits immediately, next time I try to start it, the pgint script refuses to run:
+ export PGDATA=./data/pg1 ║│
│║+ PGDATA=./data/pg1 ║│
│║+ export PGPORT=5432 ║│
│║+ PGPORT=5432 ║│
│║+ POSTGRES_RUN_INITIAL_SCRIPT=false ║│
│║+ [[ ! -d ./data/pg1 ]] ║│
│║+ echo 'Setting up postgresql.conf' ║│
│║Setting up postgresql.conf ║│
│║+ cp /nix/store/1cz3y8b8fbdysx51afappcjga2w3yaaw-postgresql.conf ./data/pg1/postgresql.conf ║│
│║+ [[ false = \t\r\u\e ]] ║│
│║+ echo ║│
│║ ║│
│║PostgreSQL database directory appears to contain a database; Skipping initialization ║│
│║ ║│
│║+ echo 'PostgreSQL database directory appears to contain a database; Skipping initialization' ║│
│║+ echo ║│
│║+ unset POSTGRES_RUN_INITIAL_SCRIPT ║│
│║
Reactions are currently unavailable