https://supabase.com/ logo
#help
Title
# help
s

Spinney

02/08/2022, 8:38 PM
Anyone have any suggestion on this error I'm getting with docker? None of the containers are able to access the database during
docker-compose up
even though
supabase-db
is successfully created and started.
Here is the original question for reference: Hey guys, I'm getting an error running
docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up
using default .env details. Everything works great until one of the containers tries to query the database when I get the following:
Copy code
prolog
supabase-rest      | An error ocurred when trying to query database settings for the config parameters
supabase-rest      | ConnectionError (Just "connection to server at \"db\" (172.19.0.4), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n")
supabase-rest      | Attempting to connect to the database...
supabase-rest      | {"details":"connection to server at \"db\" (172.19.0.4), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n"}
...
supabase-auth      | level=fatal msg="running db migrations: Migrator: problem creating schema migrations: couldn't start a new transaction: could not create new transaction: failed to connect to `host=db user=postgres database=postgres`: dial error (dial tcp 172.19.0.4:5432: connect: connection refused)"
I'm pretty new to all of this (and especially docker) so I don't know what to try next. No error logs. I'm on Debian 11 on Digitalocean, but I also tried the one-click docker image on Ubuntu 20.04 and got the same issue. I don't think there are any firewall entries besides the ones docker has made. Don't see any relevant issues on Github, and can't find any good tutorials on how to properly self-host on a vps (besides the catch-all self-hosting docs). Any suggestions? I feel like I'm probably just missing something stupid 😦 Since I'm still using default .env so I shouldn't have to make any updates to docker-compose.yml right?
j

jason-lynx

02/09/2022, 3:04 AM
is there a reason you're specifying two yml files in your command?
if i recall right, the default
docker-compose.yml
should be enough?
s

Spinney

02/09/2022, 4:17 AM
@User The docker-compose.yml file includes instructions: # Usage # Start: docker-compose up # With helpers: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up # Stop: docker-compose down # Destroy: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans No idea what “helpers” are but I have tried plain old docker-compose up as well 😦
j

jason-lynx

02/09/2022, 6:38 AM
hmm not quite sure what the issue is, i just tried cloning and running it from scratch and it worked for me
do you have any other processes running on those ports?
s

Spinney

02/09/2022, 6:05 PM
It must be something specific to my workflow or to digitalocean. Just spun up a new docker droplet and installed docker compose v2 and supabase with nothing else, and I get the same error. @User
ss -ltp
shows only docker processes with the exception of ssh, so nothing else is running on any ports as far as I can tell. Here are the exact steps I took if anyone can point out something I'm doing wrong or wants to try to replicate the issue on DO's one-click docker image:
Copy code
bash
# Install Docker Compose v2:
$mkdir -p /usr/local/lib/docker/cli-plugins
$curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
$chmod +x /usr/local/lib/docker/cli-plugins/docker-compose

# Install Supabase:
$git clone --depth 1 https://github.com/supabase/supabase /etc/supabase
$cd /etc/supabase/docker
$cp .env.example .env
$docker-compose up
s

Scott P

02/09/2022, 6:17 PM
I've deployed a few self-hosted Supabase instances on DigitalOcean over the past year (using Docker on Ubuntu), hopefully the below can help. I don't use the 1-click Supabase image - I last tried it about 8 months ago and simply couldn't get it working properly. Firstly, deploy a new droplet using the docker image they provide as a base. Don't use the supabase premade image, just the docker image (see screenshot). Once it's created, I'd recommend installing Portainer: https://docs.portainer.io/v/ce-2.11/start/install/server/docker/linux . This makes it much easier to manage containers and will let you import the docker-compose file and get the stack running. Once that's setup, login to your Portainer dashboard, and then select 'Stacks' from the left menu, and then click on 'Add Stack'. Give your stack a name, and select 'Git repository'. For the repository URL, enter the full URL to the supabase repo (https://github.com/supabase/supabase). In the 'Compose path' field, enter
/docker/docker-compose.yml
. Copy the contents of the .env file (https://github.com/supabase/supabase/blob/master/docker/.env.example) to a blank file, and update the values. At the very least, change the
POSTGRES_PASSWORD
,
JWT_SECRET
,
ANON_KEY
and
SERVICE_ROLE_KEY
. Back in the Portainer dashboard, paste them into environmental variables (click 'Advanced' and it'll let you paste all of them). Click 'deploy' near the bottom, and after a few minutes it should be running. I did notice that some of the stacks didn't start properly when I did a recent deployment, and ultimately I think it was an issue with 1 or more of the containers not being on the correct network. At the very least, it's easier to view logs for each container in the stack and it should get you close enough that basic troubleshooting will help you get the final parts up and running.
I wrote a guide back in July (https://dev.to/chronsyn/self-hosting-with-supabase-1aii) - there's parts that might be a little out of date, and it covers getting it up and running under nginx (for the purpose of mapping domains to different instances), but most of the info should still be relevant
s

Spinney

02/09/2022, 7:19 PM
Nope, I spoke too soon. I pretty much get the same error on the auth container:
Copy code
time="2022-02-09T19:13:52Z" level=fatal msg="running db migrations: Migrator: problem creating schema migrations: couldn't start a new transaction: could not create new transaction: failed to connect to 'host=db user=postgres database=postgres': dial error (dial tcp 172.18.0.4:5432: connect: connection refused)"
but you're right, it is easier to view logs and retry in Portainer. I will take another look when I have some more time and see if I can find anything I missed before.