Resized database app can't find volume

My postgres app recently stopped working because I hit the size limit, so I ran fly volumes extend. When I went to deploy I had to add an image, so I also added image = "postgres:16.2-bullseye" in the [build] section.

Now I’m seeing this and the database won’t start up.

16:48:08
Error: Database is uninitialized and superuser password is not specified.
16:48:08
       You must specify POSTGRES_PASSWORD to a non-empty value for the
16:48:08
       superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
16:48:08
       You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
16:48:08
       connections without a password. This is *not* recommended.
16:48:08
       See PostgreSQL documentation about "trust":
16:48:08
       https://www.postgresql.org/docs/current/auth-trust.html

I don’t know how this can be true, this app’s been running for two years and I just had to resize it because there was too much data.

How do I troubleshoot this?

Hm… Extending the volume shouldn’t have required a redeploy…

How was this database originally created (two years ago)?

(The ones that you get automatically via the Fly.io platform wouldn’t carry a postgres: image.)

I don’t really remember. I think it’s an app just for postgres? It predates managed postgres.

This is my fly.toml from back then (the only addition since the original deployment is the [build] section).

app = 'app-name'
primary_region = 'ewr'

[build]
  image = "postgres:16.2-bullseye"

[env]
  FLY_SCALE_TO_ZERO = '1h'
  PRIMARY_REGION = 'ewr'

[[mounts]]
  source = 'pg_data'
  destination = '/data'

[[services]]
  protocol = 'tcp'
  internal_port = 5432
  auto_start_machines = true

[[services.ports]]
    port = 5432
    handlers = ['pg_tls']

  [services.concurrency]
    type = 'connections'
    hard_limit = 1000
    soft_limit = 1000

[[services]]
  protocol = 'tcp'
  internal_port = 5433
  auto_start_machines = true

[[services.ports]]
    port = 5433
    handlers = ['pg_tls']

  [services.concurrency]
    type = 'connections'
    hard_limit = 1000
    soft_limit = 1000

[checks]
  [checks.pg]
    port = 5500
    type = 'http'
    interval = '15s'
    timeout = '10s'
    path = '/flycheck/pg'

  [checks.role]
    port = 5500
    type = 'http'
    interval = '15s'
    timeout = '10s'
    path = '/flycheck/role'

  [checks.vm]
    port = 5500
    type = 'http'
    interval = '15s'
    timeout = '10s'
    path = '/flycheck/vm'

[[metrics]]
  port = 9187
  path = '/metrics'

Ok… That looks like PG Flex, in which case you would need an image of the form flyio/postgres-flex:<version>, where <version> would have to match what the Machine was configured with before the recent attempted redeploy, :sweat_smile:

If you have a fly.toml, then you may have done a deploy years ago, in which case you might be able to just use fly releases --image to find the old image details in the history.

(Otherwise, it will require some detective work within the volume itself, etc.)


Aside: I would make a copy of the volume at this point, with fly vol fork, just in case there are mishaps…

You are an excellent person. Your advice was perfect, everything’s back up. Thank you very much!