Skip to content

Docker Compose Configuration

The docker-compose.yaml file orchestrates the various services that make up the Bergwerk application. It establishes a network for all services, manages dependencies, and initiates each component in the correct order. The following services are defined within this configuration:

  • Bergwerk Admin: Provides an admin panel for the entire Bergwerk system
  • Bergwerk Wiki: Hosts the wiki-based content management system, where chatbot data is stored and maintained.
  • Bergwerk API: Provides access to the wiki, allowing for import/export operations and data management.
  • Bergwerk Cron: Schedules tasks to automatically create and update wiki pages from conversation logs in the database.
  • Bergwerk Database: A MySQL database used to store wiki and conversation data.
  • Bergwerk SocketIO: Manages real-time communication with the Rasa Webchat plugin, enabling interactive chat features.
  • Bergwerk Caddy: Acts as a reverse HTTP(S) proxy, providing SSL termination and serving both the Wiki and API components.

This configuration ensures that all services interact seamlessly, with dependencies managed and connections secured. Using Docker Compose simplifies deployment and scaling, making Bergwerk easy to set up and operate.

docker-compose.yaml

services:
  wiki:
    env_file:
      - config.env
    build:
      context: ./bergwerk-wiki
    restart: always
    networks:
      - netzwerk
    depends_on:
      db:
        condition: service_healthy

  api:
    env_file:
      - config.env
    build:
      context: ./bergwerk-api
    restart: always
    volumes:
      - ./bergwerk-api/app:/app  
    networks:
      - netzwerk
    depends_on:
      wiki:
        condition: service_started

  socketio:
    build:
      context: ./bergwerk-socketio
    restart: always
    volumes:
      - ./bergwerk-socketio/app:/app
    networks:
      - netzwerk
    depends_on:
      wiki:
        condition: service_started
      api:
        condition: service_started


  caddy:
    image: caddy:latest
    env_file:
      - config.env
    restart: always
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./bergwerk-caddy/Caddyfile:/etc/caddy/Caddyfile
      - ./bergwerk-caddy/html:/var/www/html
      - ./persist/caddy_data:/data
      - ./persist/caddy_config:/config
    networks:
      - netzwerk
    depends_on:
      wiki:
        condition: service_started
      api:
        condition: service_started
      socketio:
        condition: service_started

  admin:
    build: ./bergwerk-admin
    restart: always
    depends_on:
      - redis
    volumes:
      - ./bergwerk-admin/app:/app
    networks:
      - netzwerk

  db:
    env_file:
      - config.env
    build:
      context: ./bergwerk-db
    restart: always
    ports:
      - "3307:3306"
    volumes:
      - ./persist/db_data:/var/lib/mysql
    networks:
      - netzwerk
    healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
        timeout: 20s
        retries: 10

  cron:
    env_file:
      - config.env
    build:
      context: ./bergwerk-cron
    restart: always
    volumes:
      - ./bergwerk-cron/app:/usr/src/app
    networks:
      - netzwerk
    depends_on:
      wiki:
        condition: service_started
      db:
        condition: service_healthy

  # ollama:
  #   image: ollama/ollama:latest
  #   volumes:
  #     - ./persist/ollama_code:/code
  #     - ./persist/ollama:/root/.ollama
  #   pull_policy: always
  #   tty: true
  #   restart: always
  #   environment:
  #     - OLLAMA_KEEP_ALIVE=24h
  #     - OLLAMA_HOST=0.0.0.0
  #   networks:
  #     - netzwerk

  redis:
    image: redis:latest
    restart: always
    networks:
      - netzwerk

  init:
    build: ./bergwerk-init
    depends_on:
      - redis
    command: ["python", "load_config.py"]
    volumes:
      - ./config.yaml:/app/config.yaml
      - ./config.yaml.example:/app/config.yaml.example
    networks:
      - netzwerk

networks:
  netzwerk:
    driver: bridge