Can't add postgis extension to postgres


So i run into a problem while trying to add postgis extension to postgres.
I read some similar topics here, but nothing helps.
I have an configured app with postgres db, then

fly postgres connect -a my-app-db
postgres=# \c my_app
You are now connected to database “my_app” as user “postgres”.
my_app=# CREATE EXTENSION postgis;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.

I tryed fly scale memory to 1024 or even 2048, but this didn’t help.
Also fly pg restart has no effect.

Interesting thing - if i run CREATE EXTENSION postgis before \c my_app it sometimes passed.

Bummer, sorry to hear this, postgis on Fly is something I’ve wanted to play with at some point.

Is there anything in the logs for the Postgres app that might help? I’m wondering if maybe the extension is broken and causing the server to segfault/crash. I’ll see if I can duplicate it myself.

I believe I’ve figured it out.

I was able to duplicate this on our development configuration with 256 MB. The app did indeed crash and a few minutes later I received an email telling me I’d ran out of memory.

I spun up a larger shared cluster with 4 GB of RAM, though, and was able to install the extension.

I imagine you don’t need the full cluster or even 4 GB of RAM, but I suspect 256 MB is too small for postgis. Maybe try a custom configuration with a bit more RAM?

Hope that helps, let me know if it doesn’t.

@nolan-fly hello there!

Yep, i’ve tried with 1 and 2 gb configuration with same result (4 isn’t available on my machine).
Could you please try to reproduce it on 1 or 2 gb config, so we could figure out 4 gb is a must, or there is something else?

@nolan-fly i think i got it. I scaling my only machine visible via

fly machine list

but this is not the machine, where is postgres running. How could i scale exactly machine with postgres? Couldn’t see it in machine list command.

I was able to load postgis on a performance-1x configuration which uses 2 GB of RAM.

You’ll need to specify an app to list machines. So for instance for my cluster, named nolan-pg, I’d run:
fly m list -a nolan-pg
If you don’t remember your cluster name, you can find it with either fly pg ls or fly app ls since it’s just an app after all.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.