postgres-ha icon indicating copy to clipboard operation
postgres-ha copied to clipboard

Postgres 15

Open davidspiess opened this issue 2 years ago • 7 comments

Since Postgres 15 was released recently, do you consider adding it in the near future? fly pg create --image-ref flyio/postgres:15

Thanks :)

davidspiess avatar Oct 19 '22 16:10 davidspiess

i created a new image and was messing around all day to get my DB to update. since it's staging i decided to destory it and create 15.2 from scratch. i started out with just creating a normal pg server.

to my surprise it created 15.2 itself! it used image flyio/postgres-flex:15.2@sha256:8e00d751bb9811bc8511d7129db2cc5a515449cf4a7def8f1d60faacb2be91c6 so perhaps this can be used to update also.

KristerV avatar Apr 03 '23 12:04 KristerV

Seems there is still no official Postgres 15 image...

angryziber avatar Apr 14 '23 09:04 angryziber

The Postgres-flex implementation defaults to PG 15: https://github.com/fly-apps/postgres-flex/tree/master

As long as you're running a recent version of flyctl, you should be good.

davissp14 avatar Apr 14 '23 12:04 davissp14

How do I tell if my Fly Postgres app is running postgres-ha or Postgres-flex? Or more simply, when I run fly image update on my postgres app, it's just updating within the postgres 14 docker images. How do I get it switched to 15?

bcomnes avatar May 23 '23 18:05 bcomnes

To see what image you're using, you can use:

fly image show --app <app-name>

If you want to move from Stolon -> Flex, your best bet is to use the fly pg import feature.

davissp14 avatar May 23 '23 19:05 davissp14

Cool thanks for the pointer! Looks like I'm running on stolon.

fly image show      
Image Details
MACHINE ID    	REGISTRY            	REPOSITORY    	TAG 	VERSION	DIGEST                                                                  
e286e91ce6e686	registry-1.docker.io	flyio/postgres	14.6	v0.0.41	sha256:3c25db96357a78e827ca7dbbf4963089bdfcd48fb05a40cd82cfff5c61fb7710	

bcomnes avatar May 23 '23 21:05 bcomnes

The process to migrate (for me) was approximately the following:

  • fly pg create a new Postgres instance. This is created with the new flex image.
  • fly pg import the old db to the new db.
  • fly secrets unset DATABASE_URL (detach didn't work for some reason)
  • flyctl postgres attach the new database
  • Update any other env vars that require database credentials.
  • Test a fly deploy on the app and ensure db credentials and migrations are working etc
  • Stop any machines on the old db instance

Note that this approach requires downtime. Shut down your app or put it into maintenance mode that prevents new writes.

bcomnes avatar May 24 '23 00:05 bcomnes