Closed dottjt closed 5 years ago
That doesn't look like distillery doing that, that just looks like normal docker unique naming?
Why would it be unique naming though?
Is it a possible flaw in the Makefile for not specifying a --name?
So there simply might be a flaw in the build instructions in the Distillery docs for Docker. I've attempted to provide nfd_web and nfd_db container_names to the services in the docker-compose.yml file, and now they're congruent in the terminal, however I still get the error:
~/C/P/nfd ❯❯❯ docker-compose up master ✖ ✱ ◼
Creating nfd_db ... done
Creating nfd_web ... done
Attaching to nfd_db, nfd_web
db_1 | 2019-02-28 21:34:27.586 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-02-28 21:34:27.586 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-02-28 21:34:27.597 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-02-28 21:34:27.754 UTC [19] LOG: database system was shut down at 2019-02-28 21:33:31 UTC
db_1 | 2019-02-28 21:34:27.821 UTC [1] LOG: database system is ready to accept connections
web_1 | 21:34:29.865 [info] [swarm on nfd@127.0.0.1] [tracker:init] started
db_1 | 2019-02-28 21:34:29.936 UTC [26] FATAL: database "nfd_db" does not exist
web_1 | 21:34:29.938 [error] Postgrex.Protocol (#PID<0.2271.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "nfd_db" does not exist
db_1 | 2019-02-28 21:34:29.953 UTC [31] FATAL: database "nfd_db" does not exist
web_1 | 21:34:29.954 [error] Postgrex.Protocol (#PID<0.2266.0>) failed to connect: ** (Postgrex.Error) FATAL 3D000 (invalid_catalog_name) database "nfd_db" does not exist
db_1 | 2019-02-28 21:34:29.967 UTC [30] FATAL: database "nfd_db" does not exist
db_1 | 2019-02-28 21:34:29.969 UTC [29] FATAL: database "nfd_db" does not exist
db_1 | 2019-02-28 21:34:29.974 UTC [32] FATAL: database "nfd_db" does not exist
Thoughts?
Why would it be unique naming though?
Just what I see it do, though in my case it might be a docker-compose thing.
I'm pretty sure the _1
being appended is coming from Docker Compose, since it allows you to spawn multiple replicas of a single service. Since by default it only starts up one instance of each application, all your apps have _1
appended to them.
However, the individual containers in your compose file can reach each other by their name you configured them with in docker-compose.yml
. If you run multiple replicas of the same service, Docker will loadbalance them internally.
Your error seems unrelated to both Docker and Distillery: you're trying to access a database in Postgres which doesn't exist, the default postgres container only sets up a database named postgres
. In config/docker.env
, you should probably add something like:
POSTGRES_DB=nfd_db
in order to automatically create the database when the PostgreSQL container is created. See the "Environment variables" section on https://hub.docker.com/_/postgres for more things you can configure at startup.
Hope this helps.
@jchristgit Thank you, I appreciate the advice.
Yes, this is a Docker Compose thing, not Distillery
Steps to reproduce
Following the guide
Verbose Logs
This is essentially the error I get when I run docker-compose up
Description of issue
I've been following the documentation for https://hexdocs.pm/distillery/guides/working_with_docker.html and essentially, it seems to be naming the application nfd_web_1 and the database nfd_db_1, as opposed to nfd_db which is what it's being set to in the config. Also, why is it nfd_web?
Anyway, what should I be doing differently to get the correct details? I've followed the documentation to a Tee, and now I'm stuck.
// rel/config/config.exs
In my config/docker.env
Dockerfile