Any idea why my deployment fails?

I have a standard phoenix app (no other packages than default) using the fly launch command that I’m trying to deploy but deploys keep failing on fly (for different reasons but all seems to fail with the db). I tried since yesterday (I took a break because thought perhaps temp probs with

This is latest error message:

3f1f62edf862: Pushed 
41a3e795badb: Pushed 
7279d2fe4228: Pushed 
ba5a5fe43301: Pushed 
deployment-1649488866: digest: sha256:b8e5eecddd9758f0840482b3ae0b89bcfbd0ae0c9bcbac9b2c80fb738e66c8c6 size: 1576
--> Pushing image done
Image size: 118 MB
==> Creating release
Release v2 created
Release command detected: this new release will not be available until the command succeeds.

You can detach the terminal anytime without stopping the deployment
==> Release command
Command: /app/bin/migrate
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Preparing kernel init
         Configuring firecracker
         Starting init (commit: 6f9865f)...
         Preparing to run: `/app/bin/migrate` as nobody
         2022/04/09 07:23:16 listening on [fdaa:0:59ad:a7b:23c3:3162:7ff:2]:22 (DNS: [fdaa::3]:53)
         07:23:19.206 [info] == Running 20220407173957 LiveviewChat.Repo.Migrations.CreateUsersAuthTables.change/0 forward
         07:23:19.213 [info] execute "CREATE EXTENSION IF NOT EXISTS citext"
         ** (Postgrex.Error) ERROR 42501 (insufficient_privilege) permission denied to create extension "citext"
             (ecto_sql 3.7.2) lib/ecto/adapters/sql.ex:852: Ecto.Adapters.SQL.execute_ddl/4
             (ecto_sql 3.7.2) lib/ecto/migration/runner.ex:343: Ecto.Migration.Runner.log_and_execute_ddl/3
             (elixir 1.13.3) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
         Starting clean up.
Error Release command failed, deployment aborted

Not sure why I wouldnt have premissions to add citext. I deployed several phoenix apps before and not had this issue.

1 Like

Running into the same issue - logging in directly to the database and giving the default postgres user permissions via ALTER USER user WITH SUPERUSER; as well as adding citext manually via CREATE EXTENSION IF NOT EXISTS citext; also results in the same error upon deploying the app.

The DB logs themselves are cycling through:

 2022-04-09T23:50:08.146 app[c0e11638] lax [info] keeper   | 2022-04-09T23:50:08.145Z INFO cmd/keeper.go:1504 our db requested role is master

2022-04-09T23:50:08.147 app[c0e11638] lax [info] keeper   | 2022-04-09T23:50:08.146Z INFO cmd/keeper.go:1542 already master

2022-04-09T23:50:08.164 app[c0e11638] lax [info] keeper   | 2022-04-09T23:50:08.164Z INFO cmd/keeper.go:1675 postgres parameters not changed

2022-04-09T23:50:08.165 app[c0e11638] lax [info] keeper   | 2022-04-09T23:50:08.164Z INFO cmd/keeper.go:1702 postgres hba entries not changed 

But that might be some kind of intended polling behavior?

I got it working with what I tried above by swapping to the other db within postgres and adding the extension manually.

flyctl postgres connect -a my_app-db

\c my_app

Doesn’t seem like this should be necessary however - it worked yesterday for me with similarly configured phoenix app on a previous flyctl CLI version.

Yea, I guess it might some bug with latest cli because worked for me on multiple porjects until latest cli. Anyone knows if there is a way to “downgrade” the fly cli to a prev version?