rr- / szurubooru

Image board engine, Danbooru-style.
GNU General Public License v3.0
704 stars 178 forks source link

Accessing the service via subdomain #318

Closed Pingumania closed 4 years ago

Pingumania commented 4 years ago

Hello, I deploy all my services with different subdomains. Like: service1.example.com service2.example.com

Is it possible to set this up instead of a different path/base url?

My docker-compose.yml

  szuru-server:
    image: szurubooru/server:latest
    container_name: szuru-server
    depends_on:
      - szuru-db
    environment:
      POSTGRES_HOST: szuru-db
      POSTGRES_USER: ***
      POSTGRES_PASSWORD: ***
    volumes:
      - /opt/docker/szuru/data:/data
      - /opt/docker/szuru/config.yaml:/opt/app/config.yaml

  szuru-client:
    image: szurubooru/client:latest
    container_name: szuru-client
    depends_on:
      - szuru-server
    environment:
      BACKEND_HOST: szuru-server
      PORT: 127.0.0.1:80
    volumes:
      - /opt/docker/szuru/data:/data:ro
    ports:
      - 1337:80
    labels:
      - traefik.enable=true
      - traefik.http.routers.szuru.entrypoints=web,web-secure
      - traefik.http.routers.szuru.rule=Host(`szuru.***.xyz`)
      - traefik.http.routers.szuru.tls.domains[0].main=***.xyz
      - traefik.http.routers.szuru.tls.domains[0].sans=*.***.xyz
      - traefik.http.services.szuru.loadbalancer.server.port=80
      - traefik.http.services.szuru.loadbalancer.server.scheme=http

  szuru-db:
    image: postgres:11-alpine
    container_name: szuru-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: ***
      POSTGRES_PASSWORD: ***
    volumes:
      - /opt/docker/postgres:/var/lib/postgresql/data
sgsunder commented 4 years ago

Yes, absolutely.

This line can be removed, it doesn't do anything (no port variable is read in the client container):

      PORT: 127.0.0.1:80

I don't think you should have this if you are using traefik:

    ports:
      - 1337:80
Pingumania commented 4 years ago

Facepalm I am an idiot traefik and szuru-client where not on the same network. Sorry for the trouble.