when building docker image and try to run with external mongo-db, than setting ENVs:
MONGO_SERVER=myserver
MONGO_PORT=9999
has no effect when 'start.sh' is running on container start and docker run will fail, because mongo connection localhost:27017 is not available.
in kuberenetes rancher cluster i mount the config.py as config volume, where i already put the correct mongo connection.
but this ended with error sed: cannot rename ./sedpeMyL1: Device or resource busy
so i fixed the related script start.sh:
if [ ! -f "./config.py" ]; then
cp config.py-sample config.py
sed -i 's/https = True/https = False/g' ./config.py
sed -i "s/mongouri = \"mongodb:\/\/localhost:27017\/\"/mongouri = \"mongodb:\/\/${MONGO_SERVER-localhost}:${MONGO_PORT-27017}\"/g" ./config.py
fi
for my understanding it only makes sense to use sed for modifying config options in config.py, when the configfile does not exist - so sed is better placed within the if loop
I also found that the Dockerfile is cloning the 2.x branch into the image and that has a different config.py file with different settings so the sed command doesn't do anything because there is no mongouri setting.
when building docker image and try to run with external mongo-db, than setting ENVs: MONGO_SERVER=myserver MONGO_PORT=9999 has no effect when 'start.sh' is running on container start and docker run will fail, because mongo connection localhost:27017 is not available.
in kuberenetes rancher cluster i mount the
config.py
as config volume, where i already put the correct mongo connection. but this ended with errorsed: cannot rename ./sedpeMyL1: Device or resource busy
so i fixed the related scriptstart.sh
:for my understanding it only makes sense to use
sed
for modifying config options inconfig.py
, when the configfile does not exist - sosed
is better placed within theif
loop