####################################
# 🦎 KOMODO COMPOSE - PERIPHERY 🦎 #
####################################

## This compose file will deploy:
##   1. Komodo Periphery

services:
  periphery:
    image: ghcr.io/moghtech/komodo-periphery:${COMPOSE_KOMODO_IMAGE_TAG:-latest}
    restart: unless-stopped
    ## Full variable list + descriptions are available here:
    ## 🦎 https://github.com/moghtech/komodo/blob/main/config/periphery.config.toml 🦎
    environment:
      ## You only need to keep the config for one of the
      ## connection directions.
      ### ==============================
      ###  PERIPHERY -> CORE CONNECTION
      ### ==============================
      ## The address of Komodo Core to connect to.
      PERIPHERY_CORE_ADDRESS: komodo.example.com
      ## The name of the Komodo Server to connect as.
      ## Must match existing server.
      PERIPHERY_CONNECT_AS: server-name
      ## Create a Server Onboarding Key in the Komodo UI.
      ## This allows Periphery to create a new Server in the UI with the above name,
      ## and can be ommitted once the Server exists in Komodo.
      PERIPHERY_ONBOARDING_KEY: <your-key>
      ## Disable the inbound connection server.
      PERIPHERY_SERVER_ENABLED: false
      ### ==============================
      ###  CORE -> PERIPHERY CONNECTION
      ### ==============================
      ## List of accepted Core public keys
      # PERIPHERY_CORE_PUBLIC_KEYS: sFIibtOSCFLQelO4b4x6VoYIddkRn9Tj1Nas2eR1ME0=
      ### ================
      ###  GENERAL CONFIG
      ### ================
      ## Specify the root directory used by Periphery agent.
      ## All your compose files and repos need to be inside this directory
      ## for Periphery to interact with them.
      PERIPHERY_ROOT_DIRECTORY: ${PERIPHERY_ROOT_DIRECTORY:-/etc/komodo}
      ## Specify whether to disable the terminals feature
      ## and disallow remote shell access (inside the Periphery container).
      PERIPHERY_DISABLE_TERMINALS: false
      ## Specify whether to disable the container exec feature
      ## and disallow remote container shell access.
      PERIPHERY_DISABLE_CONTAINER_EXEC: false
      ## If the disk size is overreporting, can use one of these to 
      ## whitelist / blacklist the disks to filter them, whichever is easier.
      ## Accepts comma separated list of paths.
      ## Usually whitelisting just /etc/hostname gives correct size for single root disk.
      PERIPHERY_INCLUDE_DISK_MOUNTS: /etc/hostname
      # PERIPHERY_EXCLUDE_DISK_MOUNTS: /snap,/etc/repos
    volumes:
      ## Mount private key storage volume
      - keys:/config/keys
      ## Mount external docker socket
      - /var/run/docker.sock:/var/run/docker.sock
      ## Allow Periphery to see processes outside of container
      - /proc:/proc
      ## Specify the Periphery agent root directory.
      ## Must be the same inside and outside the container,
      ## or docker will get confused. See https://github.com/moghtech/komodo/discussions/180.
      ## Default: /etc/komodo.
      - ${PERIPHERY_ROOT_DIRECTORY:-/etc/komodo}:${PERIPHERY_ROOT_DIRECTORY:-/etc/komodo}
      ## Optionally mount a custom periphery.config.toml
      # - /path/to/periphery.config.toml:/config/config.toml
    ## If Periphery is being run in Core -> Periphery mode,
    ## the port may need to be exposed.
    # ports:
    #   - 8120:8120

volumes:
  keys: