# fly migrate-to-v2 - postgres edition

**URL:** <https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140>\
**Category:** Fresh Produce\
**Created:** [April 10, 2023, 5:35pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140 "2023-04-10T17:35:20Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 18, 2023, 8:33pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/21 "2023-04-18T20:33:53Z")

</div>

It finally died 10-15 mins ago. I am guessing that it rolled back the creation and the one that is left is the one I cloned.

Appreciate your help.

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [April 18, 2023, 8:39pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/22 "2023-04-18T20:39:03Z")

</div>

> [@pier](#):
>
> No, you’re right. Just checked my machines PG instance. It’s not there when doing `select * from pg_extension;`.

PostGIS is included in the image, but we do not enable the extension automatically. You can do this by running:

`CREATE EXTENSION postgis;`

---

<div class="post-metadata">

**Author:** ![DAlperin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dalperin/32/50875_2.png) [@DAlperin](https://community.fly.io/u/DAlperin)\
**Post date:** [April 18, 2023, 9:02pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/23 "2023-04-18T21:02:56Z")

</div>

@danwetherald you’re all set. Sorry about that.

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 18, 2023, 9:04pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/24 "2023-04-18T21:04:10Z")

</div>

Thank you so much for the help!

---

<div class="post-metadata">

**Author:** ![pier](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/pier/32/74_2.png) [@pier](https://community.fly.io/u/pier)\
**Post date:** [April 18, 2023, 9:19pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/25 "2023-04-18T21:19:08Z")

</div>

Thanks!

BTW this info should be in your docs 😉

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 19, 2023, 12:01am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/26 "2023-04-19T00:01:25Z")

</div>

@DAlperin - Getting an error trying to upgrade a pretty old pg app.

`Error: 404: 404 page not found`

app: `rotator-api-pg`

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![DAlperin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dalperin/32/50875_2.png) [@DAlperin](https://community.fly.io/u/DAlperin)\
**Post date:** [April 19, 2023, 12:29am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/27 "2023-04-19T00:29:48Z")

</div>

Yeah it seems like you’ve identified a weird bug where the auto image update isn’t working. I’m gonna look into that tomorrow.

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 19, 2023, 3:16am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/28 "2023-04-19T03:16:32Z")

</div>

Thank you. Let me know if you need anything from me.

---

<div class="post-metadata">

**Author:** ![DAlperin](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dalperin/32/50875_2.png) [@DAlperin](https://community.fly.io/u/DAlperin)\
**Post date:** [April 20, 2023, 5:16pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/29 "2023-04-20T17:16:06Z")

</div>

@danwetherald I fixed a bug in the migrator that I think was causing the problems you were having. The fix is out in [the latest flyctl version](https://github.com/superfly/flyctl/releases/tag/v0.0.530).

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 20, 2023, 6:08pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/30 "2023-04-20T18:08:00Z")

</div>

Looks like 0.530 isnt latest yet.

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [April 21, 2023, 4:19pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/31 "2023-04-21T16:19:06Z")

</div>

@DAlperin We are still getting the same error as before when trying to upgrade an old pg deployment on version`0.532`

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [May 3, 2023, 1:27am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/32 "2023-05-03T01:27:46Z")

</div>

@DAlperin I am still not able to migrate old PG apps to v2, any ideas?

I am still getting Error: 404: 404 page not found

app:`rotator-api-pg`

I can also not restart these pg apps either:

```auto
fly apps restart rotator-api-pg                                                                                                                                                                    
Error: postgres apps should use `fly pg restart` instead

fly pg restart                                                                                                                                                                                       
Error: command is not compatible with this image

```

running fly version `0.549`

---

<div class="post-metadata">

**Author:** ![stakindotcom](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@stakindotcom](https://community.fly.io/u/stakindotcom)\
**Post date:** [May 3, 2023, 10:18am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/33 "2023-05-03T10:18:29Z")

</div>

Hello, getting the following error when running the `fly migrate-to-v2` command for my Postgres app:

```auto
 2 desired, 1 placed, 0 healthy, 1 unhealthy
--> v1 failed - Failed due to unhealthy allocations and deploying as v2 

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
failed while migrating: abort
==> (!) An error has occurred. Attempting to rollback changes...
> Disabling readonly
failed while rolling back application: can't get role for fdaa:0:476d:a7b:5adc:1:6276:2: Get "http://fdaa:0:476d:a7b:5adc:1:6276:2:5500/commands/admin/role": connect tcp [fdaa:0:476d:a7b:5adc:1:6276:2]:5500: operation timed out
Error: abort

```

Then I tried a couple more times, but I kept getting:

```auto
==> Migrating db to the V2 platform
> Upgrading postgres image
> Setting postgres primary to readonly
failed while migrating: 404: 404 page not found

==> (!) An error has occurred. Attempting to rollback changes...
> Disabling readonly
failed while rolling back application: 404: 404 page not found

Error: 404: 404 page not found

```

Running fly v0.0.549

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [May 4, 2023, 1:10am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/34 "2023-05-04T01:10:27Z")

</div>

I am still stuck with a postgres app running in v1 with a VM that is stuck in a bad state, I am not able to re-deploy, restart, or migrate. At the moment I at least have been able to scale to 2 VMs so that its at least working but it would be nice to get migrated to v2 and get back to a 100% healthy state.

Any ideas @DAlperin ?

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [May 4, 2023, 7:49pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/35 "2023-05-04T19:49:04Z")

</div>

@stakindotcom Could you try running `fly agent restart` and try again?

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [May 4, 2023, 7:56pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/36 "2023-05-04T19:56:35Z")

</div>

@danwetherald

Can you confirm everything looks good on your end?

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [May 4, 2023, 10:54pm UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/37 "2023-05-04T22:54:09Z")

</div>

@shaun nope, nothing has changed, haven’t been directed to try anything new. Everything is still the same on my end.

> [@Old fly postgres app running V1 can not be migrated and is stuck in bad state - restart not available - migrate not available](https://community.fly.io/t/old-fly-postgres-app-running-v1-can-not-be-migrated-and-is-stuck-in-bad-state-restart-not-available-migrate-not-available/12702):
>
> We have a few old fly pg deployments on v1 and we are completely stuck, we are not able to restart these or migrate them to v2. We cant seem to find a way to get that second VM to properly restart and begin to pass all its checks. Error: cmd/keeper.go:720 cannot get configured pg parameters {"error": "dial unix /tmp/.s.PGSQL.5433: connect: no such file or directory"} ERROR cmd/keeper.go:1452 different local dbUID but init mode is none, this shouldn't happen. Something bad happened …

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [May 5, 2023, 12:23am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/38 "2023-05-05T00:23:21Z")

</div>

@danwetherald What app are you having trouble with?

---

<div class="post-metadata">

**Author:** ![danwetherald](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/danwetherald/32/37600_2.png) [@danwetherald](https://community.fly.io/u/danwetherald)\
**Post date:** [May 5, 2023, 12:43am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/39 "2023-05-05T00:43:46Z")

</div>

@shaun rotator-api-pg

---

<div class="post-metadata">

**Author:** ![shaun](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@shaun](https://community.fly.io/u/shaun)\
**Post date:** [May 5, 2023, 12:46am UTC](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140/40 "2023-05-05T00:46:17Z")

</div>

What issues are you experiencing? It looks healthy on my end.

[Previous page](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140.md?page=1)

[Next page](https://community.fly.io/t/fly-migrate-to-v2-postgres-edition/12140.md?page=3)
