# Cannot Deploy Prebuilt Postgres with custom fly.toml

**URL:** <https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728>\
**Category:** Build debugging\
**Tags:** postgres\
**Created:** [November 16, 2022, 9:30pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728 "2022-11-16T21:30:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 16, 2022, 9:30pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/1 "2022-11-16T21:30:37Z")

</div>

I’m trying to [deploy my postgress app with a custom fly.toml](https://fly.io/docs/postgres/the-basics/connecting/) (from External Port Configuration) to connect my other fly app to the postgres port.

I thought internal the ports are open to my other apps, but it didn’t work, so i think i have to open the port in order to use it internally (other app, same user)

It loggs:

```auto
name@Names-MBP cell-map-analyser-db % fly deploy . --app cell-map-analyser-db --image flyio/postgres:14 --local-only
==> Verifying app config
--> Verified app config
==> Building image
Searching for image 'flyio/postgres:14' locally...
Searching for image 'flyio/postgres:14' remotely...
image found: img_e1zd4mre8nqv02yw
? This feature is highly experimental and may produce unexpected results. Proceed? Yes
Deploying with rolling strategy ✓

```

But nothing deployes…

When I run it a second time it fails:

```auto
name@Names-MBP cell-map-analyser-db % fly deploy . --app cell-map-analyser-db --image flyio/postgres:14          
==> Verifying app config
--> Verified app config
==> Building image
Searching for image 'flyio/postgres:14' remotely...
image found: img_e1zd4mre8nqv02yw
? This feature is highly experimental and may produce unexpected results. Proceed? Yes
Deploying with rolling strategy ✓
Error failed to update VM 9e784436f43583: Post "http://[fdaa:0:cea6::3]:4280/v1/apps/cell-map-analyser-db/machines/9e784436f43583": EOF

```

ALSO building on remote in general doesn’t work:  
In my other project (cell-map-analyser-backend) it gets stuck on:

```auto
name@Names-MBP cell-map-analyser-backend % fly deploy --remote-only
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-autumn-voice-538 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon 18.94kB
[+] Building 19.4s (0/1)                                                                                           
 => [internal] load remote build context    

```

So are your remote builders broken, or am I missing something?

Greets!

---

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 16, 2022, 9:42pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/2 "2022-11-16T21:42:57Z")

</div>

My cell-map-analyser-db App is now actually broken. I can’t connect anymore etc…

```auto
name@Names-MBP cell-map-analyser-db % fly pg connect -a cell-map-analyser-db                     
Oops, something went wrong! Could you try that again?
name@Names-MBP cell-map-analyser-db % fly pg restart --app cell-map-analyser-db                  
Attempting to acquire lease(s)
  Machine 9e784436f43583: success
Error no active leader found

```

Please fix this asap, I hope it didn’t fucked my Database etc…

Greets!

---

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 17, 2022, 10:20am UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/3 "2022-11-17T10:20:46Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 17, 2022, 11:37am UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/4 "2022-11-17T11:37:09Z")

</div>

I’ve managed to get my DB App back to working state with [this Tipp](https://community.fly.io/t/cannot-enable-postgis/8688/3). But I still can’t deploy how the Guide is advising me. I think all of your Cloud builders are broken or something like that. I really need to open these Ports. Please 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:** [November 17, 2022, 1:34pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/5 "2022-11-17T13:34:13Z")

</div>

I would try deleting your builder `fly-builder-autumn-voice-538` and try again.

---

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 17, 2022, 4:58pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/6 "2022-11-17T16:58:17Z")

</div>

Hi shaun, thanks for your answer!

I’ve deleted the builder. But it wasn’t created by cell-map-analyser-db. I’ve deleted the builders hundreds of times before… Because they obviously don’t work in ANY case. I’ve switched for all my apps completely to local builds. But this isn’t possible for `fly deploy . --app <app-name> --image flyio/postgres:<major-version> `. What should I do?

---

<div class="post-metadata">

**Author:** ![josh-university](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@josh-university](https://community.fly.io/u/josh-university)\
**Post date:** [November 18, 2022, 9:28am UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/7 "2022-11-18T09:28:35Z")

</div>

@shaun is there maybe something with my account wrong? Because I haven’t had a single remote-builder working.

---

<div class="post-metadata">

**Author:** ![pan](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/pan/32/16505_2.png) [@pan](https://community.fly.io/u/pan)\
**Post date:** [November 20, 2022, 8:20pm UTC](https://community.fly.io/t/cannot-deploy-prebuilt-postgres-with-custom-fly-toml/8728/8 "2022-11-20T20:20:42Z")

</div>

I am experiencing the same issue. Unable to deploy to an existing postgres database to open ports. Hangs forever on ‘Deploying with rolling strategy’.

Edit: I was able to deploy successfully after disabling my VPN on the machine I am running the command from. Seems to be a common problem that flyctl doesn’t play nice with VPN connections.
