juspay / juspay/services-flake
Initial database not created and init script refuses to run
- Dominant language
- Nix
- Stars
- 768
- Forks
- 69
- Avg merge
- 7d 20h
- Merged PRs (30d)
- 5
Description
With this basic example, I can't get postgres to contain the expected database I want.
```nix
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 ║│
│║
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.