TiiRiiX
TiiRiiX

Reputation: 133

Traefik and PostgreSQL

I have server with Docker and open 80 port.

I use Traefik to redirect between containers. And I want to host PostgreSQL database. After start conteiner with this settings:

  postgresql:
    image: orchardup/postgresql
    environment:
      - "POSTGRESQL_PASS=***"
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Path:/postgresql/"

But is not work

enter image description here

What am I doing wrong?

Upvotes: 1

Views: 3038

Answers (3)

rodurico
rodurico

Reputation: 771

Postgres does have a http protocol, but I think its way easier to just run it outside of Traefik. Keep your backend and frontend inside traefik, and the db outside:

docker pull postgres:latest
docker run -p 5432:5432 postgres

Upvotes: 0

CageE
CageE

Reputation: 455

I guess name of your host should be name of the postgres container, not name of the service. I suggest using container_name in your compose to be persistent.

Upvotes: 0

Daniel Tomcej
Daniel Tomcej

Reputation: 234

Traefik is a layer 7 reverse proxy.

Postgres doesn't use http, and requires a layer 4 proxy.

You need to look at using another product to proxy Postgres connections.

Upvotes: 5

Related Questions