maz
Create database during release
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".
Marked As Solved
maz
when the container was up I did:
docker exec -ti registrar_umbrella_postgres_1 bash
and then psql, created the database.
On next run I got past the issue.
Also Liked
LostKobrakai
Usually manually, so the app doesn‘t need credentials, which allow the creation of tables.
3
sigu
The Ecto.Adapter.Storage.storage_up/1 should be of help
opts = Application.get_env(:myapp, MyApp.Repo)
MyApp.Repo.__adapter__().storage_up(opts)
1
Popular in Questions
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project.
Baby step #1 is extracting the number ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Other popular topics
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New







