services:
  config-sync:
    image: rclone/rclone:latest
    container_name: config-sync
    entrypoint: ["/bin/sh", "-c"]
    command: >
      "while true; do 
         rclone sync /data/core minio:backups/configs --exclude '*.stat' --exclude '*.log' --verbose; 
         echo 'Sync complete. Waiting 5 minutes...'; 
         sleep 300; 
       done"
    environment:
      - RCLONE_CONFIG_MINIO_TYPE=${MINIO_TYPE}
      - RCLONE_CONFIG_MINIO_PROVIDER=${MINIO_PROVIDER}
      - RCLONE_CONFIG_MINIO_ACCESS_KEY_ID=${MINIO_KEY}
      - RCLONE_CONFIG_MINIO_SECRET_ACCESS_KEY=${MINIO_SECRET}
      - RCLONE_CONFIG_MINIO_ENDPOINT=${MINIO_ENDPOINT}
    volumes:
      - /docker:/data:ro
    restart: always