Create a docker image from source

Steps I took:

  1. pull master branch
  2. reset to ca68a34d39afce6ffaf47befefccc0bc3e044c06 which is v0.8.3
  3. build all binary with go install github.com/dgraph-io/dgraph/cmd/...
  4. then use dgraph/dgraph:master as base image and replace all binaries ( dgraph dgraph-bulk-loader dgraph-converter dgraph-live-loader dgraphzero postingiterator)
  5. test run locally. mkdir -p ~/dgraph
    docker run -it -p 8080:8080 -p 9080:9080 -v ~/dgraph:/dgraph --name dgraph new-dgraph:latest dgraphzero -w zw
    docker exec -it dgraph dgraph --bindall=true --memory_mb 2048 -peer 127.0.0.1:8888

It does not seem to work because I cannot access Dgraph UI via localhost:8080

logs from dgraph zero:

Setting up listener at: localhost:8888
Setting up listener at: localhost:8889
2017/10/23 00:59:46 node.go:246: Group 0 found 0 entries
2017/10/23 00:59:46 raft.go:567: INFO: 1 became follower at term 0
2017/10/23 00:59:46 raft.go:316: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2017/10/23 00:59:46 raft.go:567: INFO: 1 became follower at term 1
Running Dgraph zero…
2017/10/23 00:59:49 raft.go:749: INFO: 1 is starting a new election at term 1
2017/10/23 00:59:49 raft.go:580: INFO: 1 became candidate at term 2
2017/10/23 00:59:49 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2
2017/10/23 00:59:49 raft.go:621: INFO: 1 became leader at term 2
2017/10/23 00:59:49 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2
2017/10/23 01:00:06 zero.go:239: Got connection request: id:1 addr:“localhost:12345”
2017/10/23 01:00:06 pool.go:104: == CONNECT ==> Setting localhost:12345
2017/10/23 01:00:06 raft.go:253: Applied proposal: {Id:3127895948 Member:id:1 group_id:1 addr:“localhost:12345” Tablet: MaxLeaseId:0}
2017/10/23 01:00:06 raft.go:253: Applied proposal: {Id:683498661 Member:id:1 group_id:1 addr:“localhost:12345” leader:true last_update:1508720406 Tablet: MaxLeaseId:0}

logs from dgraph

2017/10/23 02:29:05 pool.go:104: == CONNECT ==> Setting 127.0.0.1:8888
2017/10/23 02:29:05 gRPC server started. Listening on port 9080
2017/10/23 02:29:05 HTTP server started. Listening on port 8080
2017/10/23 02:29:05 worker.go:105: Worker listening at address: [::]:12345
2017/10/23 02:29:05 groups.go:114: Connected to group zero. State: counter:5 groups:<key:1 value:<members:<key:1 value:<id:1 group_id:1 addr:“localhost:12345” > > > > zeros:<key:1 value:<id:1 addr:“localhost:8888” leader:true > >
2017/10/23 02:29:05 draft.go:143: Node ID: 1 with GroupID: 1
2017/10/23 02:29:05 pool.go:104: == CONNECT ==> Setting localhost:8888
2017/10/23 02:29:05 node.go:246: Group 1 found 0 entries
2017/10/23 02:29:05 draft.go:702: New Node for group: 1
2017/10/23 02:29:05 raft.go:567: INFO: 1 became follower at term 0
2017/10/23 02:29:05 raft.go:316: INFO: newRaft 1 [peers: , term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2017/10/23 02:29:05 raft.go:567: INFO: 1 became follower at term 1
2017/10/23 02:29:05 raft.go:749: INFO: 1 is starting a new election at term 1
2017/10/23 02:29:05 raft.go:580: INFO: 1 became candidate at term 2
2017/10/23 02:29:05 raft.go:664: INFO: 1 received MsgVoteResp from 1 at term 2
2017/10/23 02:29:05 raft.go:621: INFO: 1 became leader at term 2
2017/10/23 02:29:05 node.go:301: INFO: raft.node: 1 elected leader 1 at term 2

update: Build with following Dockerfile failes to access UI as well

#FROM dgraph/dgraph:master
FROM ubuntu:14.04
MAINTAINER Dgraph Labs contact@dgraph.io

RUN apt-get update

RUN apt-get -y --force-yes install wget curl tar
RUN apt-get install -y --force-yes software-properties-common python-software-properties && sudo add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get install -y --force-yes g+±4.9

COPY bin/dgraph /usr/local/bin/dgraph
COPY bin/dgraphzero /usr/local/bin/dgraphzero
COPY bin/dgraph-bulk-loader /usr/local/bin/dgraph-bulk-loader
COPY bin/dgraph-converter /usr/local/bin/dgraph-converter
COPY bin/dgraph-live-loader /usr/local/bin/dgraph-live-loader
COPY bin/postingiterator /usr/local/bin/postingiterator

RUN mkdir /dgraph

EXPOSE 8080
EXPOSE 9080
WORKDIR /dgraph

CMD [“dgraph”]

Looks like a port issue to me. Try exposing 8888 as well.

May I ask why are you wanting to install from source? (I’m curious).

I will try that. I try to build from source to extend the timeout at https://github.com/dgraph-io/dgraph/blob/master/dgraph/server.go#L231 as some of our queries are taking longer than 1 min to get result

It’s strange that queries would take that long, they must be visiting a large number of nodes?

If you really have a need to run queries that take more than 60s, you could raise a ticket on github and we can consider making it configurable.

Yes there are more than 110K of nodes. For sure that will be much nicer if the time out is configuable.
BTW I figured out the I actually missing dashboard asset. So the solution will be

  1. cd into dashboad then run npm install and npm run build
  2. copy everything in the build folder in to the docker image
  3. use flag -ui /build when running dgraph command.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.