Postgres not being backed up when expected

According to this, it seems as though my postgresql database should be being backed up daily, but it isn’t.

I don’t see in the docs where this would be configured, because I’m sure I’ve missed something. Could anyone point me in the right direction?

Hi @littletheorem, if you can share what you’ve tried and what result you saw, it’ll be easier to narrow down the problem.

There’s no configuration to do; daily snapshots are automatic.

Sure thing! Sorry if my approach comes off as pretty basic. I’ve migrated from Heroku – I didn’t find the one-click migration tool to be helpful because it didn’t migrate over my database, so I created an app from “scratch” (i.e. used my same source files but deployed anew on fly).

For the database, I ran:

flyctl pg create --name <my-other-app-name>-db --org personal --region sea --vm-size shared-cpu-1x --initial-cluster-size=1 --volume-size 1

From there I was able to set the env variables in my app to read from the db, so it is working in that regard. But when I go to the volumes tab on the database app I only see one, from the date I created it (Nov 11th).

Edit: When in doubt, turn to flyctl! We’re CLI-first so not all capabilities show up straight away in the web dashboard.

The general Fly.io docs on Postgres snapshot restores are at Backup, Restores, & Snapshots · Fly Docs.

Your one volume should have several daily snapshots to choose from at this point.

Briefly:

Get the volume id with

fly volumes list --app <app-name>

and then armed with that id, do

fly volumes snapshots list <volume-id>

if you want to restore a snapshot to a database, use

fly postgres create --snapshot-id <snapshot-id>

Hope that helps!

Thanks for the link and commands! When I run them, I do not see a list of snapshots as I’d expect from the doc you linked. I’m sure my syntax just needs a tweak, but here is what I’m running:

flyctl volumes snapshot list <volume_id_I_copied_from_previous_command>

And what I see:

Commands for managing Fly Volumes associated with an application

Usage:
  flyctl volumes [command]

Aliases:
  volumes, volume, vol

Available Commands:
  create      Create new volume for app
  delete      Delete a volume from the app
  extend      Extend a target volume
  list        List the volumes for app
  show        Show details of an app's volume
  snapshots   Manage volume snapshots

Flags:
  -h, --help   help for volumes

Global Flags:
  -t, --access-token string   Fly API Access Token
  -j, --json                  json output
      --verbose               verbose output

Use "flyctl volumes [command] --help" for more information about a command.

I’ve tried flyctl volumes snapshot <vol_id> and flyctl snapshot list <vol_id but no luck with those.

Try

fly volumes snapshots list <volume-id>

with an “s” :slight_smile:

Maybe we should add an alias…

That did the trick! Thank you! I do see all of my daily snapshots now, and I’m confident I could restore from them if need be. I think I just misunderstood volumes =/= snapshots.

1 Like