github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/contrib/config/docker/docker-compose-multi.yml (about) 1 # This file can be used to setup a Dgraph cluster with 3 Dgraph Alphas and 1 Dgraph Zero node on a 2 # Docker Swarm with replication.to 3 # It expects three virtual machines with hostnames aws01, aws02, and aws03 to be part of the swarm. 4 # There is a constraint to make sure that each Dgraph Alpha runs on a particular host. 5 6 # Data would be persisted to a Docker volume called data-volume on the virtual machines which are 7 # part of the swarm. 8 # Run `docker stack deploy -c docker-compose-multi.yml` on the Swarm leader to start the cluster. 9 10 version: "3.2" 11 networks: 12 dgraph: 13 services: 14 zero: 15 image: dgraph/dgraph:latest 16 volumes: 17 - data-volume:/dgraph 18 ports: 19 - 5080:5080 20 - 6080:6080 21 networks: 22 - dgraph 23 deploy: 24 placement: 25 constraints: 26 - node.hostname == aws01 27 command: dgraph zero --my=zero:5080 --replicas 3 28 alpha_1: 29 image: dgraph/dgraph:latest 30 hostname: "alpha_1" 31 volumes: 32 - data-volume:/dgraph 33 ports: 34 - 8080:8080 35 - 9080:9080 36 networks: 37 - dgraph 38 deploy: 39 placement: 40 constraints: 41 - node.hostname == aws01 42 command: dgraph alpha --my=alpha_1:7080 --lru_mb=2048 --zero=zero:5080 43 alpha_2: 44 image: dgraph/dgraph:latest 45 hostname: "alpha_2" 46 volumes: 47 - data-volume:/dgraph 48 ports: 49 - 8081:8081 50 - 9081:9081 51 networks: 52 - dgraph 53 deploy: 54 replicas: 1 55 placement: 56 constraints: 57 - node.hostname == aws02 58 command: dgraph alpha --my=alpha_2:7081 --lru_mb=2048 --zero=zero:5080 -o 1 59 alpha_3: 60 image: dgraph/dgraph:latest 61 hostname: "alpha_3" 62 volumes: 63 - data-volume:/dgraph 64 ports: 65 - 8082:8082 66 - 9082:9082 67 networks: 68 - dgraph 69 deploy: 70 replicas: 1 71 placement: 72 constraints: 73 - node.hostname == aws03 74 command: dgraph alpha --my=alpha_3:7082 --lru_mb=2048 --zero=zero:5080 -o 2 75 ratel: 76 image: dgraph/dgraph:latest 77 hostname: "ratel" 78 ports: 79 - 8000:8000 80 networks: 81 - dgraph 82 command: dgraph-ratel 83 volumes: 84 data-volume: