I have decided to self host Supabase via Docker. However, my experience with docker is pretty low. So I am probably making some rookie mistakes here.
I am able to run all the containers of supabase which were defined in the docker-compose.yml file as an example. https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml
So at this point I am able to get to all the functionality with the public IP of my VM like this:
- http://152.0.255.240:8000 => Supabase Studio
- http://152.0.255.240:8000/functions/v1/hello => An example function which returns a string.
To make it a bit more user friendly, I created a subdomain abc.example.com and pointed its A records to the IP address of my VM. So far so good.
However, I would like to make the containers accessible only via HTTPS to make it a bit safer. Therefore I found on the internet two solutions.
- Using Kong ( https://towardsdev.com/self-hosted-supabase-with-lets-encrypt-certificate-for-kong-2a6a8dd298db ) , but this explanation is not that good in my opinion. At least not for a beginner in Docker like me
- Using Traefik. By adding the following labels to the Kong container
docker-compose.yml, all my problems would be solved (surprise, this is not the case).
:
labels: - "traefik.enable=true" - "traefik.http.routers.kong.rule=Host(`abc.example.com`)" - "traefik.http.routers.kong.entrypoints=websecure" - "traefik.http.routers.kong.tls=true" - "traefik.http.routers.kong.tls.certresolver=letsencrypt" - "traefik.http.services.kong.loadbalancer.server.port=8000"In option 2, the https://abc.example.com works perfectly, as it shows me the Supabase Studio, but the https://abc.example.com/functions/v1/hello does not return the string. It's still on the Studio app/container, but with an error page since there is no functions/v1/hello path defined in Studio.
What option is best/easiest to get https working for all the running Supabase containers?