Supabase self-hosted experience report and hints #8004
Replies: 7 comments 8 replies
-
PLEASE HELP await Supabase.initialize( BUT IT SHOWING CONNECTION REFUSE BY POSTGRES, SIR PLEASE HELP |
Beta Was this translation helpful? Give feedback.
-
I thought, bucket (storage system) on self-hosted was not available yet. Did it really just you can enable it? Would you mind to consider for open source it? (I mean the supabase source code for docker) |
Beta Was this translation helpful? Give feedback.
-
@christianfl, Thank you for this help, I use the same guide as you, but in English. I wish I could thank the guy that wrote it. Trying to update sb without losing my db, but am confused on what you wrote here "So I copied the previously created container from /var/lib/docker/" Where are these files you speak of? Also do you get these errors in your sb console. Everything appears to work, wonder what it is. Thanks |
Beta Was this translation helpful? Give feedback.
-
Can someone please give step-by-step instructions for the "disappearing database"? I understand why the volume needs to be changed and I tried what @rgfx said to do but it's not working. Right now I have the new |
Beta Was this translation helpful? Give feedback.
-
Why the hell compose up recreates the db without checking anything. Is it to avoid creating migrations? |
Beta Was this translation helpful? Give feedback.
-
Can you give an update on this part? Hopefully you've updated your services by now 😆 |
Beta Was this translation helpful? Give feedback.
-
How do you update the value of |
Beta Was this translation helpful? Give feedback.
-
Hi guys! I thought it might be interesting for some people to hear a short real life experience from someone who recently deployed Supabase to production – what went really well, which obstacles were there and how Supabase saved me/us hundreds of hours either way.
Background
We launched a mobile app for Android and iOS built with Flutter last Friday. As we are situated in Germany, hosting in the US is not really an option keeping the GDPR and the abrogated Safe Harbour and Privacy Shield in mind. I love Open Source so we decided to use only Open Source in our full tech stack. Only our own source code is not open so far (I hope you don't mind) but that is also an option for the future. I found Supabase back then when developing began: I liked it, used the hosting variant for testing and developing and in the end hosted our own instance on a dedicated server.
Deployment
Installing Supabase itself with Docker was as easy as it can get. Just building up the
.env
file according to your own needs and you are basically done.HTTPS
Of course, we need a secure connection. So we use nginx as a reverse proxy to handle our requests. I'd love to see a basic configuration for that on https://supabase.com/docs/guides/hosting/docker . Basically I used this doc which meets our needs and gives us the possibility for hiding the dashboard behind basic auth.
However, that doc is missing some important part: On production I noticed the problem that uploading files was impossible... So don't miss to add:
as we did. Also,
client_max_body_size
is a very important flag. Didn't enable it at the beginning and the default value is just 1MB. Not worth mentioning that someone gave us the hint that uploading videos does not work really well... After setting that flag, everything was fine! We use the file storage backend at this moment.Happy it was that easy getting a working Supabase instance
Really, I was happy as f. The self hosted Supabase instance works reliable, is fast as hell and just is a lot of fun. But things were too easy.
Getting magic links / email changing links to work
I noticed that the auto generated e-mail links don't have a clickable link. It was also mentioned in the external doc mentioned above but I, yeah, overlooked that. Basically you have to edit the
docker-compose.yml
and addAPI_EXTERNAL_URL: ${SITE_URL}
in the GoTrue section. After that: Worked like a charm. I just looked up in the source code of Supabase in this minute; and that flag is there now by default. Nice!As I said, we are situated in Germany and at first we are only targeting German users. What does that mean? – E-Mails have to use our own German text. So I followed this doc and added the following things in the same section of the compose file:
The subjects worked but not the text itself. I couldn't believe that but after further research I could explain that with my overtied condition: The subjects need a string text; however, the templates need a weblink which itself points to a file with the template... The docs do mention this but that behaviour was so strange to my mind that I haven't even think about that in the beginning.
Docker and the vanished database
Changing some of the variables (see above) I had to do
docker compose down
anddocker compose up -d
to bring Supabase to live again. But what was that? I logged in to the Dashboard and all tables etc. are gone. 😵💫I am no Docker expert but after some time I got the underlying reason:
The
docker-compose.yaml
for the db container has the default volume path of- ./volumes/db/init:/docker-entrypoint-initdb.d
. This creates the database when starting up the container but if noone changes that, it means, this will always be repeated on every start. The compose file has the comment value# - ./volumes/db/data:/var/lib/postgresql/data
. So I copied the previously created container from/var/lib/docker/
to that path, removed the init volume path, uncomment the other and after the nextdocker compose up -d
the database was there again. :-)Updating the self hosted instance
I can't say anything to that until now. We have updated our instance yet. 😃
The "end"
I just want to say thank you to the whole Supabase stuff and all the people here making Supabase easier to use. You have built and are building a great product which makes developing and hosting a very convenient thing. There are only just a few things which made it a little bit less easy to deploy Supabase (from which most of these are only "missing" docs.). I'd like to pay one day for this product respectively for support and further developing but unfortunately I am not able to do that today. I would also love to see some of the hosted Supabase dashboard features in the self hosted variant, too: E.g. the storage explorer, logs and functions definitions. We use PLV8 functions and sometimes this would make life easier by seeing differences between source code and deployed functions.
Hope you are doing fine! For further questions, feel free to ask. Every comment is welcome!
Beta Was this translation helpful? Give feedback.
All reactions