Cannot load production configuration when running in Docker
AFusco opened this issue · 6 comments
Hi,
when running docker-compose up
I get the error "Cannot load production configuration" many times, until I stop the containers (it happens also if I run them in background). To get these error I followed the getting started guide step by step, but I had to apply this patch to connect-cli in order to fix the error #316
[afusco@arch younid-connect]$ docker-compose up
Creating younidconnect_redis_1
Creating younidconnect_connect_1
Creating younidconnect_nginx_1
Attaching to younidconnect_redis_1, younidconnect_connect_1, younidconnect_nginx_1
connect_1 | Starting 1 workers
connect_1 | Cannot load production configuration
connect_1 | Cannot load production configuration
connect_1 | Cannot load production configuration
connect_1 | Cannot load production configuration
connect_1 | Cannot load production configuration
connect_1 | Cannot load production configuration
^CGracefully stopping... (press Ctrl+C again to force)
Stopping younidconnect_nginx_1 ... done
Stopping younidconnect_connect_1 ... done
Stopping younidconnect_redis_1 ... done
It appears that the production.json
and development.json
files are not copied to the config volume. I checked with these commands:
[afusco@arch younid-connect]$ docker exec younidconnect_connect_1 ls
config
email
keys
logs
node_modules
package.json
protocols
providers
public
server.js
views
[afusco@arch younid-connect]$ docker exec younidconnect_connect_1 ls config
[afusco@arch younid-connect]$
I'm currently running on Arch Linux.
Some additional information that might be useful:
$ uname -rm
4.4.1-2-ARCH x86_64
$ docker -v
Docker version 1.10.1, build 9e83765
$ docker-compose -v
docker-compose version 1.6.0, build d99cad6
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.10.2
The config files should be generated for you by nvl init
, however the connect/config
directory is listed in .gitignore
to prevent accidentally publishing anything confidential that might be in the config files. If you've deployed via git, that might be why they aren't showing up where you expect them? Just a wild guess.
Haven't tried this personally on Arch, only Debian, Ubuntu, Alpine, and OS X.
It is not .gitignore
's fault, since the keys are correctly copied. I'm not deploying the containers anywhere, I'm just trying to make them work locally. Also, my colleague @matteobad has the same problem running on Elementary OS, which is ubuntu based.
We noticed that production.json
has 644 permissions while the keys have 664. Could this prevent docker from copying the files?
The files actually shouldn't be copied at all. They're in a read only volume. Is it possible the volume isn't mounting correctly?
How can I make sure that it mounts correctly?
if the files exist in your host directory, execute a shell on the container. To do this you need the container id, which you can get from docker ps
:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
77e61a5a7ab7 20160223nvl_nginx "nginx" 13 hours ago Up 13 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp 20160223nvl_nginx_1
4a7ee415ebf6 20160223nvl_connect "node server.js" 13 hours ago Up 13 hours 20160223nvl_connect_
1
0b61e8cd046d 20160223nvl_redis "redis-server /etc/re" 13 hours ago Up 13 hours 6379/tcp 20160223nvl_redis_1
When you have the id, you can run docker exec
:
$ docker exec -ti 4a7ee415ebf6 sh
/opt/connect #
Now you're inside the container. Mounted directories should be present where they're defined in the Dockerfile
and/or docker-compose.yml
. Out of the box, that would be /opt/connect
.
/opt/connect # ls
config email keys logs node_modules package.json protocols providers public server.js views
Finally, take a look inside the config
directory:
/opt/connect # ls config/
development.json production.json
I was able to solve this.
A weird environment variables configuration was preventing to correctly mount the volumes.
I was able to start everything correctly by running $ eval $(docker-machine env --unset)
before $ docker-compose up
.
I'm still new with docker, and I don't really understand why this solution works (I discovered it by accident), so if you know what's going on, please tell me.
I'm going to close this. Thanks.