create postgres machine using fly-apps/postgres-flex

Hello
I wanted to deploy postgre as a machine from

I wanted to take higher ownership control of fly.io postgres configuration after last setup and also being able to install LTREE extension.

Can you confirm steps for me because I can’t seem to get it to work. What am I missing?


Instructions that need correction:

git clone GitHub - fly-apps/postgres-flex: Postgres HA setup using repmgr
cd postgres-flex

fly version
fly launch
An existing fly.toml file was found for app postgres-flex
? Would you like to copy its configuration to the new app? Yes

An existing fly.toml file was found for app postgres-flex
? Would you like to copy its configuration to the new app? Yes
Scanning source code
Detected a Go app
App ‘postgres-flex’ already exists. You can deploy to it with fly deploy.
? Continue launching a new app? Yes
Creating app in /home/lucas/projects/postgres-flex
We’re about to launch your Go app on Fly.io. Here’s what you’re getting:

Organization: Lucas (fly launch defaults to the personal org)
Name: postgres-flex-sun-lucas-7947 (generated)
Region: Chicago, Illinois (US) (from your fly.toml)
App Machines: shared-cpu-1x, 1GB RAM (from your fly.toml)
Postgres: (not requested)
Redis: (not requested)
Tigris: (not requested)

? Do you want to tweak these settings before proceeding? Yes
Opening "https: //fly.io/cli/launch/657764786d6sdd/

Waiting for launch data… Done
Created app ‘postgres-flex-sun-lucas-7947’ in organization lucas
Admin URL:
Hostname: postgres-flex-
FlyV1 fm2_lJPECAAAAAAAAFZyxBAYUptm6KOg==
Setting FLY_API_TOKEN secret in GitHub repository settings
failed setting FLY_API_TOKEN secret in GitHub repository settings: %w exit status 1
? Overwrite “/home/lucas/projects/postgres-flex/.github/workflows/fly-deploy.yml”? Yes
Wrote config file fly.toml
Validating /home/files/projects/postgres-flex/fly.toml
✓ Configuration is valid
==> Building image
Remote builder fly-builder–hill-4119 ready
Remote builder fly-builder–hill-4119 ready
==> Building image with Docker
→ docker host: 24.0.7 linux x86_64
[+] Building 0.6s (12/13)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 307B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 45B 0.1s
=> [internal] load metadata for Docker Hub Container Image Library | App Containerization 0.2s
=> [internal] load metadata for Docker Hub Container Image Library | App Containerization 0.2s
=> [builder 1/6] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 7.39kB 0.1s
=> CACHED [stage-1 1/2] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> CACHED [builder 2/6] WORKDIR /usr/src/app 0.0s
=> CACHED [builder 3/6] COPY go.mod go.sum ./ 0.0s
=> CACHED [builder 4/6] RUN go mod download && go mod verify 0.0s
=> [builder 5/6] COPY . . 0.0s
=> ERROR [builder 6/6] RUN go build -v -o /run-app . 0.2s

[builder 6/6] RUN go build -v -o /run-app .:
0.175 no Go files in /usr/src/app


==> Building image
✓ compatible remote builder found
INFO Override builder host with: https://fly-builder--hill-4119.fly.dev (was tcp://[fdaa:0:cee7::89e9:2]:2375)

Remote builder fly-builder–hill-4119 ready
INFO Override builder host with: https://fly-builder--hill-4119.fly.dev (was tcp://[fdaa:0:cee7:9e9:2]:2375)

Remote builder fly-builder–hill-4119 ready
==> Building image with Docker
→ docker host: 24.0.7 linux x86_64
[+] Building 0.4s (12/13)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 307B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 45B 0.1s
=> [internal] load metadata for Docker Hub Container Image Library | App Containerization 0.1s
=> [internal] load metadata for Docker Hub Container Image Library | App Containerization 0.1s
=> [builder 1/6] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 5.36kB 0.1s
=> CACHED [stage-1 1/2] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> CACHED [builder 2/6] WORKDIR /usr/src/app 0.0s
=> CACHED [builder 3/6] COPY go.mod go.sum ./ 0.0s
=> CACHED [builder 4/6] RUN go mod download && go mod verify 0.0s
=> CACHED [builder 5/6] COPY . . 0.0s
=> ERROR [builder 6/6] RUN go build -v -o /run-app . 0.1s

[builder 6/6] RUN go build -v -o /run-app .:
0.131 no Go files in /usr/src/app


Error: failed to fetch an image or build from source: error building: failed to solve: process “/bin/sh -c go build -v -o /run-app .” did not complete successfully: exit code: 1

Any suggestions here? or running your own PostgreSQL docker, and controlling it in deeper way is not possible?

Hello
Any updates on this?

Do I need to buy the paid support to get an answer on this?
Anyone was able to build customer docker using the template?

or are there alternative ways to start default PostgreSQL fly and being able to install PostgreSQL modules?

Hi… The list of what paid support does and does not cover can be found at the bottom of the following page:

https://fly.io/docs/about/support/#scope-of-support

postgres-flex falls under “unmanaged Postgres”, which is way over in that rightmost column.

Given what you’ve said here and in your other thread, I think your best bet would be to wait until Managed Postgres supports extensions, which I don’t think will be too far off in the future. You might try emailing beta@fly.io and letting them know that LTREE is of particular interest to you.

In contrast, the postgres-flex images are officially deprecated now, after spending ~2 years in a kind of limbo, and even skilled and attentive operators will find it rougher and rougher sailing as time progresses. It’s generally not a good idea to create new databases that way, anymore…

1 Like

When you say Deprecated now, are you speaking on behalf of fly.io?

And when you say:

What is the way?

Update:
Using some help and chatgpt, I was able to deploy the flexpostgres, but if fails after few minutes for “resource limitations”. I’ve compared the hardware instance to the one generated by fly pg create, and they are the same. Note that I had to look at the secrets created by pg create to figure out how to make the postgre-flex stable enough to run.

Why would the pg create run just fine on same machine but postgre-flex die and complain about resource limits?

**Goal of this discussion is to get a postgres server developer to configure it to its needs and then build the app he/she wants. Only then then deploy it by scaling it to prod version, and if it takes off scale again to usage or shut it down in 6months if idea doesn’t generate value for customers. Then doing it again with next project.

I don’t speak for Fly, and neither does @mayailurus. We’re customers who enjoy advising other customers.

Fly employees do sometimes do pro bono app fix work in response to launch/deployment struggles here. I also have not ever used the paid support feature, and I’d let Fly speak to that.

However, in general, I’d say that the above failed build is an app/devops level problem that the engineer would need to address themselves. The division of labour in general is the customer produces a working app, the host offers support for the hosting. So networking, secrets, all the devops tooling that Fly simplifies; that’s all for Fly.

1 Like

I’ve been using the free tier of Supabase recently, and I have to say, it has been a very good experience. I just had a quick peek; they support the LTREE extension. I’d probably recommend something along those lines just to relieve yourself of the headache of having to be a DBA; it is not a trivial undertaking, as the many crash recovery stories in this forum might attest.