version: "3.7"

services:
  redis:
    image: redis:latest
    command: [
        "redis-server",
        "--appendonly",
        "yes",
        "--port",
        "6379"
      ]
    volumes:
      - redis_data:/data
    networks:
      - network_public
    deploy:
      placement:
        constraints:
          - node.role == manager
          #- node.hostname == worker1
      resources:
        limits:
          cpus: "0.5"
          memory: 1024M

volumes:
  redis_data:
    external: true
    name: redis_data

networks:
  network_public:
    external: true
    name: network_public
