Replies: 2 comments
-
|
Extrapolating this a bit more, if we add a variable then we can set the two DB_URL variables as a static value As long as the That also means the postgres-init-container can be set completely with variables postgres-init:
image: postgres:17
depends_on:
typetype-postgres:
condition: service_started
environment:
POSTGRES_CONTAINER: ${POSTGRES_CONTAINER}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
PGPASSWORD: ${POSTGRES_PASSWORD}
command:
- /bin/sh
- -ec
- |
until pg_isready -h ${POSTGRES_CONTAINER} -U ${POSTGRES_USER} -d ${POSTGRES_DB}; do sleep 1; done
EXISTS=$$(psql -h ${POSTGRES_CONTAINER} -U ${POSTGRES_USER} -d ${POSTGRES_DB} -tAc "SELECT 1 FROM pg_database WHERE datname='typetype_downloader'")
if [ "$$EXISTS" != "1" ]; then
psql -h ${POSTGRES_CONTAINER} -U ${POSTGRES_USER} -d ${POSTGRES_DB} -c "CREATE DATABASE typetype_downloader"
fi
restart: no |
Beta Was this translation helpful? Give feedback.
-
|
Hey, thanks for pointing this out. Yeah I agree, this part is confusing right now. The stack currently has I think your idea makes sense: So instead of having to update the same value in multiple places, users would only change it once in I'll clean this up in the compose files and will throw a PR to fix it. Thanks for catching it :p |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I love Typetype but found the variables quite confusing initially.
For instance we define
DATABASE_PASSWORDin the.envfile but the stack will fall over unless we also manually propogate this change topostgresandpostgres-initas well, and the confusing bit is the variables have different names in those containers.I just wonder if it might be more intuitive to set the following variables in
.envand then use those in the compose file for
DATABASE_USERandDATABASE_NAMEandDATABASE_PASSWORD`Then we can do the following with
typetype-serverthe following for
typetype-downloaderand then for
postgresand finally for
postgres-initI've tested this and it works, and it means the end user only needs to change the variables in the
.envfile and it will be propogated correctly through the stack.Beta Was this translation helpful? Give feedback.
All reactions