Testing Postgres create locally first?

Hi all,

I’ve just done my first deployment which failed with:

==> Release command
Command: /app/bin/migrate
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Configuring firecracker
	 Starting virtual machine
	 Starting init (commit: a4d425b)...
	 Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
	 no label, UUID=01d81045-edac-4e9a-8900-a7e5ef0f3efb
	 Preparing to run: `/app/bin/migrate` as nobody
	 2022/07/09 14:19:43 listening on [fdaa:0:760a:a7b:bada:c74a:4a66:2]:22 (DNS: [fdaa::3]:53)
	 warning: redefining module Pento.Repo.Migrations.CreateUsersAuthTables (current version defined in memory)
	 14:19:46.659 [info] execute "CREATE EXTENSION IF NOT EXISTS citext"
	 14:19:46.690 [info] alter table users
	 ** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "users" does not exist
	 Starting clean up.
Error Release command failed, deployment aborted

My demo app is at GitHub - ghenry/pento: Phoenix LiveView book projects

Can I reproduce this failure with a $ mix ecto.create ?

The db is up and running as this works fine:

flyctl postgres connect -a pento-ghenry-db


Ah, I see a new Dockerfile in my local repo. I could use that to test?

Found it! Duplicate module name in my ecto migrations of CreateUsersAuthTables

Still failing now with:

ly deploy --remote-only
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-falling-resonance-3218 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  91.08kB
[+] Building 0.9s (21/27)                                                                                                                           
 => [internal] load remote build context                                                                                                       0.0s
 => copy /context /                                                                                                                            0.1s
 => [internal] load metadata for docker.io/library/debian:bullseye-20210902-slim                                                               0.7s
 => [internal] load metadata for docker.io/hexpm/elixir:1.13.2-erlang-                                   0.7s
 => [builder  1/17] FROM docker.io/hexpm/elixir:1.13.2-erlang-  0.0s
 => [stage-1 1/6] FROM docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a  0.0s
 => CACHED [builder  2/17] RUN apt-get update -y && apt-get install -y build-essential git     && apt-get clean && rm -f /var/lib/apt/lists/*  0.0s
 => CACHED [builder  3/17] WORKDIR /app                                                                                                        0.0s
 => CACHED [builder  4/17] RUN mix local.hex --force &&     mix local.rebar --force                                                            0.0s
 => CACHED [builder  5/17] COPY mix.exs mix.lock ./                                                                                            0.0s
 => CACHED [builder  6/17] RUN mix deps.get --only prod                                                                                        0.0s
 => CACHED [builder  7/17] RUN mkdir config                                                                                                    0.0s
 => CACHED [builder  8/17] COPY config/config.exs config/prod.exs config/                                                                      0.0s
 => CACHED [builder  9/17] RUN mix deps.compile                                                                                                0.0s
 => CACHED [builder 10/17] COPY priv priv                                                                                                      0.0s
 => CACHED [builder 11/17] COPY lib lib                                                                                                        0.0s
 => CACHED [builder 12/17] COPY assets assets                                                                                                  0.0s
 => CACHED [builder 13/17] RUN mix assets.deploy                                                                                               0.0s
 => CACHED [builder 14/17] RUN mix compile                                                                                                     0.0s
 => CACHED [builder 15/17] COPY config/runtime.exs config/                                                                                     0.0s
 => ERROR [builder 16/17] COPY rel rel                                                                                                         0.0s
 > [builder 16/17] COPY rel rel:
Error failed to fetch an image or build from source: error building: failed to compute cache key: "/rel" not found: not found

Any ideas?

I’ve deleted everything and started again. Seems to be working now. Closing.