Deploying Dgraph to Docker Swarm

I am deploying a simple configuration to docker swarm and I am having issues. Initially I thought I might have port issues, so I decided to just deploy to a single server and still seems to be a problem with the connections.

I am using dgraph/latest which should now map to 1.0.6

Following is the docker-compose.yml I am using:

version: “3”
networks:
dgraph:
services:
zero:
image: dgraph/dgraph:latest
volumes:
- /home/docker:/dgraph
ports:
- 5080:5080
- 6080:6080
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == ip-172-31-38-132.ec2.internal
command: dgraph zero --my=zero:5080
server_1:
image: dgraph/dgraph:latest
hostname: “server_1”
volumes:
- /home/docker:/dgraph
ports:
- 8080:8080
- 9080:9080
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == ip-172-31-38-132.ec2.internal
command: dgraph server --my=server_1:7080 --lru_mb=2048 --zero=zero:5080
ratel:
image: dgraph/dgraph:latest
hostname: “ratel”
ports:
- 8000:8000
networks:
- dgraph
deploy:
placement:
constraints:
- node.hostname == ip-172-31-38-132.ec2.internal
command: dgraph-ratel

The errors I am seeing on the logs for zero:

Setting up grpc listener at: 0.0.0.0:5080
Setting up http listener at: 0.0.0.0:6080
2018/07/13 20:56:59 node.go:244: Group 0 found 1 entries
2018/07/13 20:56:59 raft.go:567: INFO: 1 became follower at term 0
2018/07/13 20:56:59 raft.go:315: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2018/07/13 20:56:59 raft.go:567: INFO: 1 became follower at term 1
Running Dgraph zero…
2018/07/13 20:56:59 node.go:135: Setting conf state to nodes:1
2018/07/13 20:56:59 zero.go:333: Got connection request: addr:“server_1:7080”
2018/07/13 20:56:59 pool.go:161: Echo error from server_1:7080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup server_1 on 127.0.0.11:53: no such host”
2018/07/13 20:56:59 pool.go:108: == CONNECT ==> Setting server_1:7080
2018/07/13 20:57:02 raft.go:749: INFO: 1 is starting a new election at term 1
2018/07/13 20:57:02 raft.go:580: INFO: 1 became candidate at term 2
2018/07/13 20:57:02 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2
2018/07/13 20:57:02 raft.go:621: INFO: 1 became leader at term 2
2018/07/13 20:57:02 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2
2018/07/13 20:57:02 zero.go:441: Connected
2018/07/13 20:57:09 oracle.go:421: No healthy connection found to leader of group 1

Any help will be greatly appreciated.

Your yml seems ok to me. Try to clean that folder " /home/docker".
It can not be a connection problem because Zero can see the Server as your log report.
This may be a remnant settings of previous attempts. Clean the folder and try again.

Ref: https://docs.dgraph.io/get-started#docker-compose

I cleaned up the /home/docker file and it seems like the zero instance starts ok. However, I am not sure the server is working properly as I can see errors in the log.

Zero log:

Setting up grpc listener at: 0.0.0.0:5080
Setting up http listener at: 0.0.0.0:6080
2018/07/13 23:50:45 node.go:244: Group 0 found 1 entries
2018/07/13 23:50:45 raft.go:567: INFO: 1 became follower at term 0
2018/07/13 23:50:45 raft.go:315: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2018/07/13 23:50:45 raft.go:567: INFO: 1 became follower at term 1
Running Dgraph zero…
2018/07/13 23:50:45 node.go:135: Setting conf state to nodes:1
2018/07/13 23:50:46 zero.go:333: Got connection request: addr:“server_1:7080”
2018/07/13 23:50:46 pool.go:108: == CONNECT ==> Setting server_1:7080
2018/07/13 23:50:49 raft.go:749: INFO: 1 is starting a new election at term 1
2018/07/13 23:50:49 raft.go:580: INFO: 1 became candidate at term 2
2018/07/13 23:50:49 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2
2018/07/13 23:50:49 raft.go:621: INFO: 1 became leader at term 2
2018/07/13 23:50:49 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2
2018/07/13 23:50:49 zero.go:441: Connected

Server logs:

2018/07/13 23:50:45 server.go:116: Setting Badger option: default
2018/07/13 23:50:45 server.go:131: Setting Badger table load option: mmap
2018/07/13 23:50:45 server.go:143: Setting Badger value log load option: mmap
2018/07/13 23:50:45 server.go:153: Opening postings Badger DB with options: {Dir:p ValueDir:p SyncWrites:true TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:2147483647 MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:32 NumMemtables:5 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741824 ValueLogMaxEntries:1000000 NumCompactors:3 managedTxns:false DoNotCompact:false maxBatchCount:0 maxBatchSize:0 ReadOnly:false Truncate:false}
2018/07/13 23:50:45 groups.go:77: Current Raft Id: 0
2018/07/13 23:50:45 gRPC server started. Listening on port 9080
2018/07/13 23:50:45 HTTP server started. Listening on port 8080
2018/07/13 23:50:45 worker.go:89: Worker listening at address: [::]:7080
2018/07/13 23:50:45 pool.go:161: Echo error from zero:5080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:45 pool.go:108: == CONNECT ==> Setting zero:5080
2018/07/13 23:50:45 groups.go:94: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:45 groups.go:94: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:45 groups.go:94: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:45 groups.go:94: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:46 groups.go:94: Error while connecting with group zero: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = “transport: Error while dialing dial tcp: lookup zero on 127.0.0.11:53: no such host”
2018/07/13 23:50:49 groups.go:104: Connected to group zero. Assigned group: 1
2018/07/13 23:50:49 draft.go:150: Node ID: 1 with GroupID: 1
2018/07/13 23:50:49 node.go:244: Group 1 found 1 entries
2018/07/13 23:50:49 draft.go:1032: New Node for group: 1
2018/07/13 23:50:49 raft.go:567: INFO: 1 became follower at term 0
2018/07/13 23:50:49 raft.go:315: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2018/07/13 23:50:49 raft.go:567: INFO: 1 became follower at term 1
2018/07/13 23:50:49 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:49 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:49 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:49 node.go:135: Setting conf state to nodes:1
2018/07/13 23:50:49 raft.go:749: INFO: 1 is starting a new election at term 1
2018/07/13 23:50:49 raft.go:580: INFO: 1 became candidate at term 2
2018/07/13 23:50:49 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2
2018/07/13 23:50:49 raft.go:621: INFO: 1 became leader at term 2
2018/07/13 23:50:49 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2
2018/07/13 23:50:49 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:49 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:49 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:49 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:50 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:50 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:51 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:51 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:52 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:52 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:53 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:53 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:721: WARNING: We don’t have address of any dgraphzero leader.
2018/07/13 23:50:54 groups.go:490: WARNING: We don’t have address of any Zero server.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:54 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:55 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:55 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:55 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:55 groups.go:159: Error while proposing initial schema: Tablet isn’t being served by this instance.
2018/07/13 23:50:55 groups.go:356: Serving tablet for: predicate
2018/07/13 23:50:55 mutation.go:147: Done schema update predicate:“predicate” value_type:STRING list:true
2018/07/13 23:50:55 groups.go:494: Got address of a Zero server: zero:5080

Thanks

I do not know what it can be. Do the following. Enter this site here: https://labs.play-with-docker.com/

Create an instance (in this case a set of instances in Swarm - I think that you can do that play.with) Then create a .yml

touch docker-compose.yml

Then click the “Editor” button or access via SSH itself. When you click “Editor” will appear the “Root” then click to edit “docker-compose.yml” and paste there your compose template or even the template that I passed the link.

I tested here with the Dgraph compose model and it’s working as I write this.

Please, if you wanna me to test your compose, share it via https://gist.github.com/
To keep the syntax intact

But try yourself
Swarm mode https://blog.docker.com/2017/07/best-way-learn-docker-free-play-docker-pwd/

I have tried using v1.0.5 and things are working for me. It seems that the latest version has some issues.

I am going to try now deploying to multiple servers to see if that works too.

Thanks