I’m trying to do deploy an elixir umbrella app with elixir 1.9+(using mix release). I’ve gotten to the point where I’m running a migration. The error is that the db doesn’t exist yet. How do I create the database programmatically during the release?
(similar process to https://elixirschool.com/blog/releasing-an-umbrella-app-with-docker-and-mix-release/)
docker run -p 4000:4000 -p 5432:5432 --env DATABASE_URL=ecto://postgres:postgres@postgres/registrar_dev --env SECRET_KEY_BASE=bazbazbaz mhanna/registrar:latest
Starting app from bash script...
running env.sh.eex...
Beginning migration script...
running env.sh.eex...
Starting dependencies..
Starting repos..
Running migrations for registrar repo: Elixir.Registrar.Repo migrations_path: /app/lib/registrar-0.1.0/priv/repo/migrations
03:35:46.550 [error] Postgrex.Protocol (#PID<0.223.0>) failed to connect: (DBConnection.ConnectionError) tcp connect (postgres:5432): non-existing domain - :nxdomain
03:35:46.550 [error] Postgrex.Protocol (#PID<0.222.0>) failed to connect: (DBConnection.ConnectionError) tcp connect (postgres:5432): non-existing domain - :nxdomain
03:35:48.690 [error] Postgrex.Protocol (#PID<0.222.0>) failed to connect: (DBConnection.ConnectionError) tcp connect (postgres:5432): non-existing domain - :nxdomain
03:35:49.109 [error] Postgrex.Protocol (#PID<0.223.0>) failed to connect: (DBConnection.ConnectionError) tcp connect (postgres:5432): non-existing domain - :nxdomain
03:35:49.525 [error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
* The "schema_migrations" table, which Ecto uses for managing
migrations, was defined by another library
* There is a deadlock while migrating (such as using concurrent
indexes with a migration_lock)
To fix the first issue, run "mix ecto.create".