version: "3.3" services: proxy: image: traefik:v2.2 networks: - ${TRAEFIK_PUBLIC_NETWORK?Variable not set} - default volumes: - /var/run/docker.sock:/var/run/docker.sock command: # Enable Docker in Traefik, so that it reads labels from Docker services - --providers.docker # Add a constraint to only use services with the label for this stack # from the env var TRAEFIK_TAG - --providers.docker.constraints=Label(`traefik.constraint-label-stack`, `${TRAEFIK_TAG?Variable not set}`) # Do not expose all Docker services, only the ones explicitly exposed - --providers.docker.exposedbydefault=false # Enable the access log, with HTTP requests - --accesslog # Enable the Traefik log, for configurations and errors - --log # Enable the Dashboard and API - --api deploy: placement: constraints: - node.role == manager labels: # Enable Traefik for this service, to make it available in the public network - traefik.enable=true # Use the traefik-public network (declared below) - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set} # Use the custom label "traefik.constraint-label=traefik-public" # This public Traefik will only use services with this label - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set} # traefik-http set up only to use the middleware to redirect to https - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.scheme=https - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.permanent=true # Handle host with and without "www" to redirect to only one of them # Uses environment variable DOMAIN # To disable www redirection remove the Host() you want to discard, here and # below for HTTPS - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.entrypoints=http # traefik-https the actual router using HTTPS - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls=true # Use the "le" (Let's Encrypt) resolver created below - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls.certresolver=le # Define the port inside of the Docker service to use - traefik.http.services.${STACK_NAME?Variable not set}-proxy.loadbalancer.server.port=80 # Handle domain with and without "www" to redirect to only one # To disable www redirection remove the next line - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.regex=^https?://(www.)?(${DOMAIN?Variable not set})/(.*) # Redirect a domain with www to non-www # To disable it remove the next line - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.replacement=https://${DOMAIN?Variable not set}/$${3} # Redirect a domain without www to www # To enable it remove the previous line and uncomment the next # - traefik.http.middlewares.${STACK_NAME}-www-redirect.redirectregex.replacement=https://www.${DOMAIN}/$${3} # Middleware to redirect www, to disable it remove the next line - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.middlewares=${STACK_NAME?Variable not set}-www-redirect # Middleware to redirect www, and redirect HTTP to HTTPS # to disable www redirection remove the section: ${STACK_NAME?Variable not set}-www-redirect, - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.middlewares=${STACK_NAME?Variable not set}-www-redirect,${STACK_NAME?Variable not set}-https-redirect backend: image: "langflow:${TAG-latest}" build: context: ../ dockerfile: base.Dockerfile # user: your-non-root-user # Make sure your Dockerfile creates this user depends_on: - queue - db env_file: - backend.env ports: - "7860" volumes: - ../:/app - ./startup-backend.sh:/startup-backend.sh # Ensure the paths match command: /startup-backend.sh # Fixed the path healthcheck: test: "exit 0" deploy: labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(`/api/v1`) || PathPrefix(`/docs`) || PathPrefix(`/health`) - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=7860 db: image: postgres:15.4 volumes: - app-db-data:/var/lib/postgresql/data/pgdata env_file: - db.env environment: - PGDATA=/var/lib/postgresql/data/pgdata deploy: placement: constraints: - node.labels.${STACK_NAME?Variable not set}.app-db-data == true pgadmin: image: dpage/pgadmin4 networks: - ${TRAEFIK_PUBLIC_NETWORK?Variable not set} - default env_file: - ./pgadmin.env depends_on: - db volumes: - ./pgadmin:/var/lib/pgadmin deploy: labels: - traefik.enable=true - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set} - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.rule=Host(`pgadmin.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.middlewares=${STACK_NAME?Variable not set}-https-redirect - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.rule=Host(`pgadmin.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls.certresolver=le - traefik.http.services.${STACK_NAME?Variable not set}-pgadmin.loadbalancer.server.port=5050 queue: image: redis:6.2.5 ports: - "6379:6379" healthcheck: test: "exit 0" celeryworker: image: "langflow:${TAG-latest}" depends_on: queue: condition: service_healthy env_file: - ./celeryworker.env build: context: ../ dockerfile: base.Dockerfile command: celery -A langflow.worker.celery_app worker --loglevel=INFO --concurrency=1 -n lf-worker@%h healthcheck: test: "exit 0" deploy: replicas: 1 flower: image: mher/flower networks: - default depends_on: queue: condition: service_healthy celeryworker: condition: service_healthy env_file: - ./flower.env environment: - CELERY_BROKER_URL='redis://$${LANGFLOW_REDIS_PASSWORD:+default:$${LANGFLOW_REDIS_PASSWORD}@}$${LANGFLOW_REDIS_HOST}:$${LANGFLOW_REDIS_PORT}/$${LANGFLOW_REDIS_DB}' ports: - "5555:5555" deploy: labels: - traefik.enable=true - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set} - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.rule=Host(`flower.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.entrypoints=http - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.middlewares=${STACK_NAME?Variable not set}-https-redirect - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.rule=Host(`flower.${DOMAIN?Variable not set}`) - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.entrypoints=https - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls=true - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls.certresolver=le - traefik.http.services.${STACK_NAME?Variable not set}-flower.loadbalancer.server.port=5555 frontend: # user: your-non-root-user build: context: ../src/frontend dockerfile: Dockerfile args: - BACKEND_URL=http://backend:7860 depends_on: backend: condition: service_healthy env_file: - ./frontend.env restart: on-failure deploy: labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=PathPrefix(`/`) - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80 prometheus: image: prom/prometheus:v2.37.9 volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml command: - "--config.file=/etc/prometheus/prometheus.yml" ports: - "9090:9090" healthcheck: test: "exit 0" deploy: labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-prometheus-http.rule=PathPrefix(`/metrics`) - traefik.http.services.${STACK_NAME?Variable not set}-prometheus.loadbalancer.server.port=9090 grafana: image: grafana/grafana:8.2.6 depends_on: prometheus: condition: service_healthy ports: - "3000:3000" volumes: - grafana_data:/var/lib/grafana deploy: labels: - traefik.enable=true - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set} - traefik.http.routers.${STACK_NAME?Variable not set}-grafana-http.rule=PathPrefix(`/grafana`) - traefik.http.services.${STACK_NAME?Variable not set}-grafana.loadbalancer.server.port=3000 volumes: grafana_data: app-db-data: networks: traefik-public: # Allow setting it to false for testing external: false # ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-true}