PhlexPlexico / G5V

A front-end for G5API to manage matches/seasons/tournaments for CS:GO
MIT License
56 stars 29 forks source link

Docker-Compose setup behind Traefik - Cant login to STEAM #178

Closed aronmgv closed 7 months ago

aronmgv commented 7 months ago

Hello,

I want to achieve setup of Get5API and Get5Vue via docker-compose and have it behind traefik reverse proxy. I am getting a webui but I cant log in to STEAM via provided button, it just redirects to the same page and does nothing. I have noticed that caddy configuration had this caddy.handle_path: /api/*, could it be the issue that I am not able to log in via STEAM? image

I am also curious how g5v knows where to contact g5api? I dont see any configuration on that part in docker-compose file.

My api key: image

docker-compose (edited from here https://shobhit-pathak.github.io/MatchZy/get5/):

version: "3.7"

services:
  g5v:
    image: ghcr.io/phlexplexico/g5v:latest
    depends_on:
      - g5api
    container_name: G5V-Front-End
    restart: always
    ports:
      - 5555:80

  g5api:
    image: ghcr.io/phlexplexico/g5api:latest
    depends_on:
      - get5db
    container_name: G5API
    ports:
      - 5556:3301
    volumes:
      - $PWD/public:/Get5API/public
    environment:
      - NODE_ENV=production
      - PORT=3301
      - DBKEY=*** #CHANGME https://www.random.org/cgi-bin/randbyte?nbytes=16&format=h
      - STEAMAPIKEY=***
      - HOSTNAME=https://cs.example.com
      - SHAREDSECRET=***
      - CLIENTHOME=https://cs.example.com
      - APIURL=https://cs.example.com/api
      - SQLUSER=get5
      - SQLPASSWORD=***
      - SQLPORT=3306
      - DATABASE=get5
      - SQLHOST=get5db
      - ADMINS=***
      - SUPERADMINS=***
      - REDISURL=redis://:***@redis:6379
      - REDISTTL=86400
      - USEREDIS=true
      - UPLOADDEMOS=true
      - LOCALLOGINS=false
    restart: always

  get5db:
    image: yobasystems/alpine-mariadb
    container_name: get5db
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=***
      - MYSQL_DATABASE=get5
      - MYSQL_USER=get5
      - MYSQL_PASSWORD=***
      - MYSQL_CHARSET=utf8mb4
      - MYSQL_COLLATION=utf8mb4_general_ci
    ports:
      - 3306:3306

  redis:
    image: redis:6
    command: redis-server --requirepass ***
    container_name: redis
    restart: always

networks:
  default:
    name: get5

traefik:

http:

  routers:
    cs.example.com:
      entryPoints:
        - websecure
      rule: Host(`cs.example.com`)
      service: cs.example.com
      middlewares:
        - ratelimit@file
        - security-headers-private@file

  services:
    cs.example.com:
      loadBalancer:
        passHostHeader: true
        servers:
          - url: 'http://192.168.255.12:5555'

Logs: https://pbin.aronmgv.com/blstT-Ei7Yx-9et39Bv6q

If somebody is willing to help me here I would appreciate it. Thanks!

aronmgv commented 7 months ago

SOLVED. I had to match host with api and bind it with get5api + have a middleware to strip api path from url:

http:

  routers:
    cs.example.com:
      entryPoints:
        - websecure
      rule: Host(`cs.example.com`)
      service: cs.example.com
      middlewares:
        - ratelimit@file
        - security-headers-private@file
    api.cs.example.com:
      entryPoints:
        - websecure
      rule: Host(`cs.example.com`) && PathPrefix(`/api`)
      service: api.cs.example.com
      middlewares:
        - ratelimit@file
        - security-headers-private@file
        - api.cs.example.com-stripprefix

  services:
    cs.example.com:
      loadBalancer:
        passHostHeader: true
        servers:
          - url: 'http://192.168.255.12:5555'
    api.cs.example.com:
      loadBalancer:
        passHostHeader: true
        servers:
          - url: 'http://192.168.255.12:5556'

  middlewares:
    api.cs.example.com-stripprefix:
      stripPrefix:
        prefixes:
          - '/api'