Skip to content

Beautiful Open-Source Form Builder

Fix Postgres healthcheck database target (#1200)

Julien Nahum5eed95f06ae1
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 388591804..d73ba0ba3 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -84,7 +84,7 @@ services:
POSTGRES_USER: ${DB_USERNAME:-forge}
POSTGRES_PASSWORD: ${DB_PASSWORD:-forge}
healthcheck:
- test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-forge}"]
+ test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
interval: 5s
timeout: 5s
retries: 5
diff --git a/docker-compose.yml b/docker-compose.yml
index 48fcec12c..cdedd37a7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -100,7 +100,7 @@ services:
POSTGRES_USER: ${DB_USERNAME:-forge}
POSTGRES_PASSWORD: ${DB_PASSWORD:-forge}
healthcheck:
- test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-forge}"]
+ test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
interval: 30s
timeout: 5s
volumes:
diff --git a/docs/configuration/environment-variables.mdx b/docs/configuration/environment-variables.mdx
index a1f64bf20..2b52fe682 100644
--- a/docs/configuration/environment-variables.mdx
+++ b/docs/configuration/environment-variables.mdx
@@ -157,6 +157,14 @@ import CloudVersion from "/snippets/cloud-version.mdx";
When running OpnForm with Docker, there are some important considerations for handling environment variables:
+<Note>
+ Docker Compose uses shell variables, a root `.env` file next to
+ `docker-compose.yml`, or a file passed with `--env-file` when it resolves
+ `${...}` values in the Compose file. The service-level `env_file` entries
+ such as `./api/.env` and `./client/.env` only pass variables into the
+ containers after the Compose file has already been resolved.
+</Note>
+
### Updating Environment Variables
When changing environment variables in your `.env` files, you need to recreate the containers for the changes to take effect. Simply restarting the containers is not sufficient as Docker only loads environment variables when containers are created.