# BPMN-Pilot on a Synology NAS (Container Manager > Project > Create)
# BPMN 2.0 editor in the browser, with an AI co-pilot and an MCP server for your own AI agents.
# Code and documentation: https://github.com/Leylines-Prism/bpmn-pilot
#
# Before you start:
# 1. In File Station, create the folder docker/bpmn-pilot/data (lowercase only).
# 2. Replace NAS_IP below with the local IP address of your NAS (for example 192.168.1.20).
# 3. Replace CHANGE_ME_LONG_RANDOM_TOKEN with a long random string: AI agents connecting
#    over MCP will need it.
# 4. Optional: put an API key below (Anthropic, OpenAI or Mistral) for the built-in AI co-pilot,
#    or leave them empty and enter your own key in the editor, under Options.
# Then open http://NAS_IP:8095
#
# Do not expose this port to the Internet: the server has no user accounts. Keep it on your
# local network, or put it behind a reverse proxy that requires a login.
 
services:
  editor:
    image: ghcr.io/leylines-prism/bpmn-pilot:1.4.6
    container_name: bpmn-pilot
    ports:
      - "8095:8080"
    depends_on:
      - mcp
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped
 
  # Prepares the data folder for the server user, then stops. "Exited (0)" is expected.
  data-init:
    image: ghcr.io/leylines-prism/bpmn-pilot-mcp:1.4.6
    container_name: bpmn-pilot-data-init
    user: "0:0"
    entrypoint:
      - sh
      - -c
      - >-
        mkdir -p /data/diagrams /data/exports &&
        chown -R 1026:100 /data ||
        echo "data-init - could not prepare /data, check the owner of the data folder"
    volumes:
      - /volume1/docker/bpmn-pilot/data:/data
    read_only: true
    network_mode: none
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
    security_opt:
      - no-new-privileges:true
    restart: "no"
 
  mcp:
    image: ghcr.io/leylines-prism/bpmn-pilot-mcp:1.4.6
    container_name: bpmn-pilot-mcp
    # 1026:100 is the first admin user and the "users" group on most Synology NAS.
    # Check yours with the command "id" over SSH, and use the same values in data-init.
    user: "1026:100"
    environment:
      # Your time zone: used for the names of diagrams saved by an AI agent and for the logs.
      TZ: Europe/Paris
      ANTHROPIC_API_KEY: ""
      OPENAI_API_KEY: ""
      MISTRAL_API_KEY: ""
      MCP_TOKEN: CHANGE_ME_LONG_RANDOM_TOKEN
      BPMN_EDITOR_ORIGINS: http://NAS_IP:8095
      MCP_ALLOWED_HOSTS: NAS_IP
    volumes:
      - /volume1/docker/bpmn-pilot/data:/data
    depends_on:
      data-init:
        condition: service_completed_successfully
    read_only: true
    tmpfs:
      - /tmp
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true
    # Ollama running on the NAS itself: http://host.docker.internal:11434/v1
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: unless-stopped
 