summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-04-24 11:23:30 +0200
committerHarald Eilertsen <haraldei@anduin.net>2024-04-24 11:23:30 +0200
commit1c3e4dba9fe90faa318933a99eecdb9cd5e7481a (patch)
treeb648818504bbd78bdf0bb1756e5a4d9879e76931
parentb618514904b005ea5d2d51ae174b2ca5e24b31c5 (diff)
downloadfaktura-1c3e4dba9fe90faa318933a99eecdb9cd5e7481a.tar.gz
faktura-1c3e4dba9fe90faa318933a99eecdb9cd5e7481a.tar.bz2
faktura-1c3e4dba9fe90faa318933a99eecdb9cd5e7481a.zip
postgrest: Use env vars for connecting to the db.
Get rid of the hardcoded creds for this part at least (they're still in the schema definition for now), but the main motivation at this point is to be able to bootstrap the system. The thing is: If the postgrest container is not able to connect to the db it refuses to start and dies. This means the nginx container will not be able to check the connection to the postgrest service, and it also dies. Since ddev considers the system broken if the web container dies, it just stops everything and kills the db container too. Iow, we're not able to add the authenticator user to the db so that postgrest will boot, and the rest of the system with it. So to bootstrap the system, do the following: Set PGRST_DB_USER and PGRST_DB_PASS both to the default ddev db user ("db"). Load the db schema: % ddev psql < sql/schema.sql Change the PGRST_DB_USER and PGRST_DB_PASS to their proper values, and store them in the .ddev/.env file. Then restart the project: % ddev restart The postgrest container should now use the correct credentials.
-rw-r--r--.ddev/docker-compose.postgrest.yaml4
1 files changed, 1 insertions, 3 deletions
diff --git a/.ddev/docker-compose.postgrest.yaml b/.ddev/docker-compose.postgrest.yaml
index d0b914b..af8e192 100644
--- a/.ddev/docker-compose.postgrest.yaml
+++ b/.ddev/docker-compose.postgrest.yaml
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: CC0-1.0
-version: '3.6'
-
services:
web:
# Make the web container wait for the postgrest container
@@ -20,7 +18,7 @@ services:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: ${DDEV_APPROOT}
environment:
- PGRST_DB_URI: postgres://authenticator:password@db:5432/db
+ PGRST_DB_URI: postgres://${PGRST_DB_USER}:${PGRST_DB_PASS}@db:5432/db
PGRST_DB_ANON_ROLE: web_anon
PGRST_DB_SCHEMAS: api
PGRST_JWT_SECRET: ${PGRST_JWT_SECRET}