coolify: [Bug]: Supabase containers keep restarting due to authentication-related error
Description
When attempting to deploy Supabase using Coolify v4.0.0-beta.306, the process fails, and the logs of the containers indicate an authentication-related error.
Do note that it works fine on v4.0.0-beta.297 except for that fact that:
Minio Createbucketcontainer fails to run and exits.Supabase RestandRealtime Devshowsrunning (unhealthy).
Minimal Reproduction (if possible, example repository)
- Upgrade to Coolify v4.0.0-beta.306.
- Attempt to deploy Supabase.
- Observe the failure in the deployment process. Several containers would keep restarting.
- Check logs of the failed containers.
Exception or Error
No response
Version
v4.0.0-beta.306
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 13
- Comments: 43 (8 by maintainers)
Commits related to this issue
- Update supabase.yaml Based on solution here: https://github.com/coollabsio/coolify/issues/2696 Tested and working ! — committed to Lukyrouge3/coolify by Lukyrouge3 2 years ago
I’ve figured out the issue, can replicate and mitigate.
Coolify is setting the
POSTGRES_HOSTparameter to thePOSTGRES_HOSTenvironment parameter even though it has a hard coded value set.You can resolve the issue by setting
POSTGRES_HOSTto some other value likePOSTGRES_HOSTNAME, change all instances ofPOSTGRES_HOSTparameter inside thedocker-composeand then delete thePOSTGRES_HOSTafter saving.Issue: Postgres runs the init scripts before the network connection is ready by connecting directly to the socket, which is why for the
POSTGRES_HOST=/var/run/postgresqlenv variable onsupabase-dbit’s set to a path.When the env is incorrectly overridden the value is set to
supabase-dbwhich resolves to the docker network which isn’t initialised and is also not able to use the local access root.I might still be on to win my bet. 😂
Refs:
https://github.com/docker-library/postgres/issues/941 https://raw.githubusercontent.com/docker-library/postgres/master/15/bullseye/docker-entrypoint.sh https://github.com/supabase/postgres/blob/develop/migrations/db/migrate.sh
This will be fixed in the upcoming version.
This worked perfectly for me. For future reference, here are the steps I did to resolve :
POSTGRES_HOSTvariable withPOSTGRES_HOSTNAMEPOSTGRES_HOSTvariable withPOSTGRES_HOSTNAMEdocker compose down --volumesto remove the old db config@deozza Try stopping the stack, removing the associated
_supabase-db-datavolume and restart the stack.You can find the volume by running
docker volume lslook for the one which has<the_random_stack_string>_supabase-db-dataand then runningdocker volume rm <name>.For example my random stack string that is before my url etc is
rwkg84smy volume isrwkg84s_supabase-db-dataso I would rundocker volume rm rwkg84s_supabase-db-dataOnce you’ve done that you should be able to start the service again and hopefully the migrations will run correctly.
How would they sell their cloud services if self hosting was that easy? It’s just marketing and it has to be somehow possible. But they don’t want the mass to self host supabase…
@diegofino15 and @gBusato, I can confirm that @Mortalife (here) and @deozza (here) instructions worked for me (thank you both).
To reiterate, make sure to:
<uuid>_supabase-db-datavolume as per @Mortalife 's instructionsPOSTGRES_HOSTvariable toPOSTGRES_HOSTNAMEPOSTGRES_HOSTvariable toPOSTGRES_HOSTNAMEand save (this might make step 3 redundant but I didn’t test it)I had missed Step 4 and the stack just recreated that
POSTGRES_HOSTEnvironment Variable.I’m pretty sure that’s not meant to be running. Runs once the very first time you start things up to create the minIO bucket and never runs again AFAIK
Fair, I read through it in more detail and if I were a betting man, I’d have lost money! Haha Double checked the env’s passed to the containers and it’s correct. So my hypothesis was incorrect.