Skip to content

Non-functional behind Traefik reverse-proxy #11

@Jekotia

Description

@Jekotia

I have deployed LogForge behind traefik, while still leaving port 3000 exposed for testing purposes.

When I access https://logforge.example.com:

  • Sometimes the header loads, but the body simply reads "network error"
  • Sometimes the header loads, but the list of docker containers is empty
  • Sometimes everything loads, but clicking on "Edit Alert Keywords" opens a dialogue that never loads

When I access http://logforge.example.com:3000, none of the above applies.


My changes from your compose file can be summarised as such:

  • separate each component service into its own file, pulled together at run-time with "include"
  • rename services & containers to use a dot instead of a dash as the "separator" character, and apply to all references (to follow the existing conventions of my service deployments)
  • add hashes to the image tags (I hate using "latest" and want consistency and manually-elected updates)
  • remove all lines relevent to watchtower, for the same reason as the above
  • add labels for traefik reverse proxy
  • change NOTIFIER_WEB_PORT in .env to 8085, to be consistent with the majority of instances of this port

compose.yaml

include:
  - backend.yaml
  - frontend.yaml
  - notifier.yaml
  - ../../networks/proxy_private.yaml

networks:
  logforge:

backend.yaml

services:
  logforge.backend:
    image: madanb13/logforge-backend:latest@sha256:c349b0386d5dbb891c8dd0efb970762035de02bf16180932db0028d8d51967b8
    container_name: logforge.backend
    environment:
      PORT: "${BACKEND_SERVICE_PORT:-8000}"
      NOTIFIER_SERVICE_CONTAINER_NAME: "${NOTIFIER_SERVICE_CONTAINER_NAME:-logforge.notifier}"
      NOTIFIER_PLAIN_PORT: "${NOTIFIER_PLAIN_PORT:-8083}"
    networks:
      - logforge
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /srv/application_data/logforge/backend/data:/app/core/data
    restart: always
    ports:
      - "${EXPOSED_BACKEND_PORT:-8000}:${BACKEND_SERVICE_PORT:-8000}"

frontend.yaml

services:
  logforge.frontend:
    image: madanb13/logforge-frontend:latest@sha256:ccaf62ebec73cdbe6b1070359c95898e7b4a0fbfb03445b1f1d10dfb5032b24d
    container_name: ${FRONTEND_SERVICE_CONTAINER_NAME:-logforge.frontend}
    environment:
      VITE_BACKEND_SERVICE_HOST: "http://${BACKEND_SERVICE_CONTAINER_NAME:-logforge.backend}"
      VITE_BACKEND_SERVICE_PORT: "${BACKEND_SERVICE_PORT:-8000}"
      VITE_EXPOSED_BACKEND_PORT: "${EXPOSED_BACKEND_PORT:-8000}"
      VITE_NOTIFIER_PORT: "${NOTIFIER_WEB_PORT:-8085}"
    ports:
      - "${EXPOSED_FRONTEND_PORT:-3000}:${FRONTEND_SERVICE_PORT:-3000}"
    networks:
      - proxy_private
      - logforge
    depends_on:
      - logforge.backend
    labels:
      traefik.enable: "true"
      # Frontend => Router
      traefik.http.routers.logforge.entrypoints: websecure
      traefik.http.routers.logforge.rule: Host(`${LOGFORGE_URL_PREFIX:-logforge.}${NETWORK_DOMAIN}`)
      traefik.http.routers.logforge.tls.certresolver: dns-cloudflare
      # Frontend => Services
      traefik.http.routers.logforge.service: logforge
      traefik.http.services.logforge.loadbalancer.server.port: 3000

notifier.yaml

services:
  logforge.notifier:
    image: madanb13/logforge-notifier:latest@sha256:8f9f55ea14de57ca79b9e2e4548df4d23e31c16dca4e1c062a1c1b7a066bd1ff
    container_name: ${NOTIFIER_SERVICE_CONTAINER_NAME:-logforge.notifier}
    ports:
      - "${NOTIFIER_PLAIN_PORT:-8083}:8083"
      - "${NOTIFIER_WEB_PORT:-8085}:8085"
    volumes:
      - /srv/application_data/logforge/notifier/data:/app/data
      - /etc/localtime:/etc/localtime:ro
    networks:
      - logforge
    restart: unless-stopped

../../networks/proxy_private.yaml

networks:
  proxy_private:
    name: bootstrap_proxy_private
    external: true

.env

# LOGFORGE_URL_PREFIX=
NETWORK_DOMAIN=example.com

BACKEND_SERVICE_CONTAINER_NAME="logforge.backend"
BACKEND_SERVICE_PORT="8000"
EXPOSED_BACKEND_PORT="8000"

FRONTEND_SERVICE_CONTAINER_NAME="logforge.frontend"
FRONTEND_SERVICE_PORT="3000"
EXPOSED_FRONTEND_PORT="3000"

NOTIFIER_SERVICE_CONTAINER="logforge.notifier"
NOTIFIER_PLAIN_PORT="8083"
NOTIFIER_WEB_PORT="8085"

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions