version: "3.9"
services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: WATCHTOWER
    hostname: watchtower
    networks:
      - prometheus-net
    mem_limit: 128m
    mem_reservation: 50m
    cpu_shares: 256
    security_opt:
      - no-new-privileges=true
    read_only: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      TZ: Europe/Stockholm
      WATCHTOWER_CLEANUP: true # Remove old images after updating
      WATCHTOWER_REMOVE_VOLUMES: false # Remove attached volumes after updating
      DOCKER_API_VERSION: 1.41 # SSH docker version
      WATCHTOWER_INCLUDE_RESTARTING: true # Restart containers after update
      WATCHTOWER_INCLUDE_STOPPED: false # Update stopped containers
      WATCHTOWER_SCHEDULE: "0 0 */2 * * *" # Update & Scan containers every 2 hours
      WATCHTOWER_LABEL_ENABLE: false
      WATCHTOWER_ROLLING_RESTART: true
      WATCHTOWER_TIMEOUT: 30s
      WATCHTOWER_HTTP_API_METRICS: true # Metrics for Prometheus
      WATCHTOWER_HTTP_API_TOKEN: mariushostingisthebest 
     # Token for Prometheus #If you installed premtheus & Grafana  using Marius guide
      WATCHTOWER_NOTIFICATIONS: gotify # you need to install gotify use the link bellow
      #https://mariushosting.com/how-to-install-gotify-on-your-synology-nas/  
      WATCHTOWER_NOTIFICATION_GOTIFY_URL: http://192.168.x.x:6742  # Your NAS IP
      WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN: TOKENTOKEN # Paste the token frpm gotify
      restart: on-failure:5

networks:
  prometheus-net:
    external: true