supabase / postgres

Unmodified Postgres with some useful plugins
https://supabase.com
PostgreSQL License
1.3k stars 128 forks source link

Docker build instructions outdated #580

Open kjcsb1 opened 1 year ago

kjcsb1 commented 1 year ago

The Docker build instructions on the wiki are out-of-date now that 15 is released.

Is it as simple as running docker build --tag custom-postgres:latest .?

That didn't work for me. I get an 80MB Docker image with only the extensions included, no Postgres.

Any suggestions appreciated.

jbergstroem commented 1 year ago

I still think you need to build through Ansible; check how the Dockerfile assumes certain args

allquantor commented 1 year ago

+1 on this.

rienheuver commented 1 year ago

Can someone help me understand why you'd want to user Docker for the database? Isn't that quite risky? In that when docker restarts, all your data is gone

jbergstroem commented 1 year ago

Can someone help me understand why you'd want to user Docker for the database? Isn't that quite risky? In that when docker restarts, all your data is gone

You would mount a persistent volume into the running instance of your container, making storage permanent;

$ docker volume create db
$ docker run -v db:/var/lib/postgresql ...
rienheuver commented 1 year ago

Right, that does make a lot more sense. Is there any documentation on how to do that? And if so, couldn't you do this using the regular Docker compose of supabase?

jbergstroem commented 1 year ago

Right, that does make a lot more sense. Is there any documentation on how to do that?

And if so, couldn't you do this using the regular Docker compose of supabase?

It already is!

https://github.com/supabase/supabase/blob/677a2288865d8d22f0ccedd575839d2da89ff377/docker/docker-compose.yml#L291-L298

rienheuver commented 1 year ago

Then why'd you need to decouple your database? Or am I overlooking something now?

jbergstroem commented 1 year ago

Then why'd you need to decouple your database? Or am I overlooking something now?

Yeah, I'm not quite sure what you are after here. This issue is about the open source bits and bobs of Supabase; how to build things yourself, perhaps hack on them or run the stack yourself be it locally or deploy it into your own ecosystem. How you want to deploy and run postgres is up to you and Supabase is kind enough to share documentation on how to achieve it (note: I do not work there)!

Here is for instance a recent project that shows you how you can deploy supabase on fly.io: https://github.com/nicholasoxford/SupaFly

rienheuver commented 1 year ago

I want to run the supabase Docker containers with a persisted database. I figured that the database would be wiped when you reboot the containers, since supabase advises to decouple them. If that's not the case I'm good to go I guess. Though I do wonder why they advise to decouple it then

michaelcooke commented 1 year ago

I'm putting a bounty of $150 over PayPal, donation to a non-political/non-religious charity, or to an OSS project of your choice; I need to build Supabase with TimescaleDB's community license and cannot make sense of the CI/CD here.

If I figure it out before anybody else, I'll post back here.

michaelcooke commented 1 year ago

Bounty expired. I was able to build the image by removing the final stage of the Dockerfile (Remove all lines after HEALTHCHECK ...)

sweatybridge commented 1 year ago

Bounty expired. I was able to build the image by removing the final stage of the Dockerfile (Remove all lines after HEALTHCHECK ...)

No need to delete anything. You can specify the build stage to docker via --target flag. For eg.

docker build . --target production -t supabase/postgres:latest