bitwalker / distillery-aws-example

An example application to go with the AWS guide in the Distillery documentation
Apache License 2.0
52 stars 73 forks source link

Failing when running a migration #6

Closed gdub01 closed 5 years ago

gdub01 commented 5 years ago

Thanks for the repo! Happily have my app running with it.

I have received 3 different sets of errors, however, when the pipeline runs after I created a migration.

First, I'd hit this error: https://github.com/bitwalker/distillery-aws-example/issues/4 So I had to comment out the below entirely in bin/migrate: if grep '${DEFAULT_IPV4}' var/vm.args >/dev/null; then export RELEASE_READ_ONLY=true fi I'd imagine that's not the ideal solution, but it temporarily seemed to get around the issue.

But after that, an error was thrown that log: true is invalid, and needs to be one of :info, :debug, etc. Then another error was thrown because :pool_size needs to be > 1. I changed, /lib/example/tasks/migrate.ex:21 to {:ok, _pid} = MyApp.Repo.start_link(pool_size: 4, log: :info, log_sql: true) and then it worked for me. I should note that I've upgraded to ecto 3.

I'm now getting this error: LifecycleEvent - ApplicationStart Script - bin/migrate [stdout]==> Starting applications.. [stdout]==> Started crypto: [] [stdout]==> Started ssl: [] [stdout]==> Started postgrex: [:connection, :db_connection, :decimal, :postgrex] [stdout]==> Started ecto: [:ecto] [stdout]==> Starting repo [stdout]==> Running migrations [stderr] (exit) exited in: GenServer.call(Ecto.Migration.Supervisor, {:start_child, [#PID<0.166.0>, MyApp.Repo, :forward, :up, %{level: :info, sql: false}]}, :infinity) [stderr] (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started [stderr] (elixir) lib/gen_server.ex:914: GenServer.call/3 [stderr] (ecto_sql) lib/ecto/migration/runner.ex:22: Ecto.Migration.Runner.run/7 [stderr] (ecto_sql) lib/ecto/migrator.ex:211: Ecto.Migrator.attempt/7

The above is printed from the aws logs. I'm stuck here and don't really know how to proceed.

gdub01 commented 5 years ago

Ah sorry - My problem was ecto 3 needs to be treated differently than ecto 2 and you already showed how to handle ecto 3 here - https://github.com/bitwalker/distillery/blob/master/docs/guides/running_migrations.md (needed to start ecto_sql)

When I followed those changes, it worked. Sorry for trouble and thanks again for the guide