# Download this file only. Supply settings/passwords via the shell or an optional .env. # Docker Compose >= 2.30.0 (not docker stack deploy). See REGISTRY.md. # Example image: git.example.home/your-user/homegate:0.6.0 name: homegate x-runtime: &runtime image: "${HOMEGATE_IMAGE:?Set the full registry/owner/homegate:version image name}" restart: unless-stopped init: true user: "1000:1000" read_only: true tmpfs: - /tmp:rw,noexec,nosuid,size=16m cap_drop: [ALL] security_opt: - no-new-privileges:true pids_limit: 64 mem_limit: 256m cpus: 0.5 logging: driver: json-file options: max-size: 5m max-file: "3" x-environment: &environment PYTHONDONTWRITEBYTECODE: "1" PYTHONUNBUFFERED: "1" HOMEGATE_CONFIG: /config/services.yaml services: initialize: <<: *runtime # Compose copies configs.content into the container before starting it. read_only: false entrypoint: [python, /app/bootstrap.py] command: [] user: "0:0" restart: "no" network_mode: none # Only prepares permissions/configuration, then exits. No secrets or API calls. cap_add: [CHOWN, DAC_OVERRIDE, FOWNER] environment: <<: *environment HOMEGATE_STATE: /data HOMEGATE_CONTROL: /control volumes: - config:/config - state:/data - control:/control configs: - source: initial-config target: /run/configs/homegate-seed.yaml homegate: <<: *runtime # Compose requires a writable root filesystem for secrets.environment. read_only: false depends_on: initialize: condition: service_completed_successfully environment: <<: *environment HOMEGATE_STATE: /data HOMEGATE_CONTROL: /control NPM_URL: "${NPM_URL:?Set the NPM management URL without /api}" NPM_IDENTITY: "${NPM_IDENTITY:?Set the NPM login email}" NPM_PASSWORD_FILE: /run/secrets/npm_password PIHOLE_URL: "${PIHOLE_URL:-}" PIHOLE_PASSWORD_FILE: /run/secrets/pihole_password API_CA_BUNDLE: "${API_CA_BUNDLE:-}" volumes: - config:/config:ro - state:/data - control:/control secrets: [npm_password, pihole_password] healthcheck: test: [CMD, python, /app/homegate.py, health] interval: 30s timeout: 5s start_period: 120s retries: 3 ssh-export: <<: *runtime command: [serve] depends_on: initialize: condition: service_completed_successfully environment: <<: *environment SSH_BIND_IP: "${HOMEGATE_LAN_IP:?Set the Docker host private IPv4 address}" ports: - "${HOMEGATE_LAN_IP:?Set HOMEGATE_LAN_IP}:${SSH_PORT:-8099}:8080" volumes: - config:/config:ro healthcheck: test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=3).read()"] interval: 30s timeout: 5s retries: 3 ui: <<: *runtime # Compose requires a writable root filesystem for secrets.environment. read_only: false entrypoint: [python, /app/homegate_ui.py] command: [] depends_on: initialize: condition: service_completed_successfully environment: <<: *environment HOMEGATE_CONTROL: /control UI_BIND_IP: "${HOMEGATE_LAN_IP:?Set HOMEGATE_LAN_IP}" UI_ORIGIN: "${UI_ORIGIN:?Set the exact panel URL, for example http://192.168.0.10:8098}" UI_PASSWORD_FILE: /run/secrets/ui_password SSH_PUBLIC_URL: "http://${HOMEGATE_LAN_IP}:${SSH_PORT:-8099}/ssh-config" ports: - "${HOMEGATE_LAN_IP:?Set HOMEGATE_LAN_IP}:${UI_PORT:-8098}:8081" volumes: - config:/config - control:/control secrets: [ui_password] healthcheck: test: [CMD, python, -c, "import os,urllib.request,urllib.parse; r=urllib.request.Request('http://127.0.0.1:8081/',headers={'Host':urllib.parse.urlsplit(os.environ['UI_ORIGIN']).netloc}); urllib.request.urlopen(r,timeout=3).read()"] interval: 30s timeout: 5s retries: 3 # Seed is copied only when config/services.yaml does not exist in the volume. # After the first start edit settings in the UI; this seed never overwrites them. configs: initial-config: content: | proxy_ip: ${HOMEGATE_PROXY_IP:?Set the private IP of NPM} allowed_networks: ${HOMEGATE_ALLOWED_NETWORKS:?Set a YAML list of allowed LAN subnets} domain_zones: ${HOMEGATE_ZONES:-[home, home.arpa, lab.internal]} dns_mode: ${HOMEGATE_DNS_MODE:-pihole6} interval_seconds: 60 services: [] ssh_hosts: [] # Compose creates secret files. Passwords are not container environment variables. secrets: npm_password: environment: NPM_PASSWORD pihole_password: environment: PIHOLE_PASSWORD ui_password: environment: UI_PASSWORD volumes: config: state: control: