version: '3.3'
#name: swarmpit

services:
  app:
    image: swarmpit/swarmpit:latest
    environment:
      - SWARMPIT_DB=http://db:5984
      - SWARMPIT_INFLUXDB=http://influxdb:8086
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 888:8080
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080"]
      interval: 60s
      timeout: 10s
      retries: 3
    networks:
      - proxy
      - swarmpit-internal
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 1024M
        reservations:
          cpus: '0.25'
          memory: 512M
      placement:
        constraints:
          - node.role == manager

  db:
    image: couchdb:2.3.1
    volumes:
      - /mnt/docker/local/swarmpit/data/couchdb:/opt/couchdb/data
    networks:
      - swarmpit-internal
    deploy:
      resources:
        limits:
          cpus: '0.30'
          memory: 256M
        reservations:
          cpus: '0.15'
          memory: 128M

  influxdb:
    image: influxdb:latest
    volumes:
      - /mnt/docker/local/swarmpit/data/influxdb:/var/lib/influxdb
    networks:
      - swarmpit-internal
    deploy:
      resources:
        limits:
          cpus: '0.60'
          memory: 512M
        reservations:
          cpus: '0.30'
          memory: 128M

  agentarm:
    image: swarmpit/agent:2.1
    #platform: linux/arm64
    environment:
      - DOCKER_API_VERSION=1.35
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - swarmpit-internal
    deploy:
      mode: global
      labels:
        swarmpit.agent: 'true'
      placement:
        constraints:
          - node.labels.arch == aarch64
      resources:
        limits:
          cpus: '0.10'
          memory: 64M
        reservations:
          cpus: '0.05'
          memory: 32M

  agentx86:
    image: swarmpit/agent:latest
    #platform: linux/amd64
    environment:
      - DOCKER_API_VERSION=1.35
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - swarmpit-internal
    deploy:
      mode: global
      labels:
        swarmpit.agent: 'true'
      placement:
        constraints:
          - node.labels.arch == x86
      resources:
        limits:
          cpus: '0.10'
          memory: 64M
        reservations:
          cpus: '0.05'
          memory: 32M

networks:
  swarmpit-internal:
    external: true
  proxy:
    external: true
