Closed tacticz closed 2 years ago
Digging into the problem here is what I found out:
both /srv/taiga/back/settings/local.py
and /srv/taiga/back/settings/celery.py
files are symlinks to the identically named files located under /taiga-conf/
, which itself is the docker mounted persistent volume under ./conf/back
. Interestingly enough, the celery.py
file present in that same directory has all $ENV_VAR
names correctly substituted.
Both of these files are generated by the start.sh
script when it runs at first launch. The generation process is using the sed
command to substitute values present in the template /tmp/taiga-conf/config.py
and /tmp/taiga-conf/celery.py
files. What I observed, by manually running both sed
commands present in the start.sh
script, is that an error is returned when executing it on the /tmp/taiga-conf/config.py
:
/tmp/taiga-conf # sed -e 's/$TAIGA_HOST/'$TAIGA_HOST'/' \
-e 's/$TAIGA_PORT/'$TAIGA_PORT'/' \
-e 's/$TAIGA_SECRET/'$TAIGA_SECRET'/' \
-e 's/$TAIGA_SCHEME/'$TAIGA_SCHEME'/' \
-e 's/$POSTGRES_HOST/'$POSTGRES_HOST'/' \
-e 's/$POSTGRES_DB/'$POSTGRES_DB'/' \
-e 's/$POSTGRES_USER/'$POSTGRES_USER'/' \
-e 's/$POSTGRES_PASSWORD/'$POSTGRES_PASSWORD'/' \
-e 's/$RABBIT_HOST/'$RABBIT_HOST'/' \
-e 's/$RABBIT_PORT/'$RABBIT_PORT'/' \
-e 's/$RABBIT_USER/'$RABBIT_USER'/' \
-e 's/$RABBIT_PASSWORD/'$RABBIT_PASSWORD'/' \
-e 's/$RABBIT_VHOST/'$RABBIT_VHOST'/' \
-i /tmp/taiga-conf/config.py
sed: bad option in substitution expression
Manually running each substitution line by line revealed that the problem occurred when substituting the value for TAIGA_SECRET
, which indeed contains special characters that are braking the sed
command execution (i.e. ; & # / , $ and _). I didn't yet tried to figure out which one(s) are problematic
Surrounding the TAIGA_SECRET
value definition with quotation marks in the variables.env
file makes it work but doesn't completely fix the problem since the surrounding quotation marks are then part of the secret value itself.
I keep digging the situation, as the obvious solution is NOT to use special characters in the secret, and haven't either defined yet whether a similar problem might exist with the xxx_PASSWORD
values...
In the meantime any relevant information regarding a way the sed
command in the start.sh
script could be adapted to work with special characters would be welcome!
Thank you.
Hello! Thanks a lot for digging into this! I'll try to fix this shortly and come back with an update.
Should be fixed for now in https://github.com/docker-taiga/back/commit/7a0e0d580c89971876888969d5292f9aa1a9c059 and https://github.com/docker-taiga/events/commit/36ac3c61e41cf4b497bde09c3abe10d409124b2f, but I may have missed something. Nevertheless, may be a better long term solution would be to use a different tool for writing/managing configs.
Hello,
Not sure whether I should post here or rather under "docker-taiga/back" since the issue seems to be Django related, but it seems posting here makes more sense as a "centralized" issue reports point.
Trying to deploy docker-taiga on my workstation, I configured the
variable.env
file in the simplest possible way, i.e. just specifyingTAIGA_HOST
,TAIGA_SECRET
,POSTGRES_PASSWORD
,RABBIT_PASSWORD
andREDIS_PASSWORD
values, leaving all other ones to their defaults.Running
docker-compose up
starts all the expected containers but, in the outputted logs, the following error is reported: django.db.utils.OperationalError: could not translate host name "$POSTGRES_HOST" to address: Name does not resolveConnecting to the taiga-back container, using
docker exec -it taiga-back /bin/sh
, showed that the environment variable was well set and that thedb
hostname was well recognized inside the container:Looking at the
settings/local.py
file one can see that Django'sDATABASES
settings are indeed set as follow:Not having enough experience with Django, I only can suspect that the
$NAMES
values do not get substituted with their equivalent environment variables values. But I wonder why this seems to be working for other users and not for me (since I didn't find someone reporting this problem in previous issues).Thank you very much for any hint that could lead me to a working solution.