Connection refused when reaching PostgreSQL

Issues information

  • OS: Windows
  • databases: postgresql 12.6.0
  • Programming language and version: Python and Django

Your issue
Hello, i’m having issue connecting to the postgresql db for project “brasserie-76-flo”. I have a connection refused when i run qovery run.

I pinged the ip adresse and it returns the packets, so i guess a port issue ? Or maybe i a have a confusion with ENV given by Qovery.

My settings seems ok :
Screenshot 2021-06-07 132117

Am i missing something ?

Dockerfile content (if any)

FROM python:3.8.0-alpine

WORKDIR /usr/src/app

ENV PYTHONDONTWRITEBYTECODE 1

ENV PYTHONUNBUFFERED 1

COPY . .

RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev

RUN pip install --upgrade pip

RUN pip install -r requirements.txt

RUN python3 -V

RUN python3 ./bakpak_project/manage.py collectstatic --noinput

RUN python3 ./bakpak_project/manage.py makemigrations

RUN python3 ./bakpak_project/manage.py migrate

EXPOSE 8000

CMD [“python3”, “./bakpak_project/manage.py”, “runserver”, “0.0.0.0:8000”]

Yml content :

application:
name: brasserie-76-flo
project: brasserie-76-flo
port: 8000
publicly_accessible: true
databases:

  • type: postgresql
    name: bakpakerdb
    version: “12.6.0”
    routers:
  • name: main
    routes:
    • application_name: brasserie-76-flo
      paths:
      • /

Thanks !

Hello,
did you manage to connect to the db using postgres client ?

psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W.

Hello,
I encounter the same error :
Screenshot 2021-06-08 102614
also with “-d bakpakerdb”

I tried with a random password and it returns the same error.

Same result with PgAdminV4.

You’re trying to use db before it deployment

2021-06-08T09:37:15Z	ERROR	APPLICATION	ERROR	The command '/bin/sh -c python3 ./bakpak_project/manage.py makemigrations' returned a non-zero code: 1

You must find a way to let app deploy then migrate. At the moment the crash makes all things stuck.

Ok it’s up and running now.
I had to deploy in 2 steps:

  • first in order to initialize the container and the db
  • second time to set up the db (aplply migration and create a superuser)

Thank you Enzo

1 Like