Skip to content

Commit

Permalink
Docker build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Jenkins committed Dec 12, 2015
1 parent e485c17 commit 1f8d77d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@
FROM centos:latest
# OS setup
RUN yum install -y make golang git
RUN mkdir -p /app/dispatchd
RUN yum install -y python-setuptools.noarch
RUN mkdir -p /app/dispatchd && mkdir -p /data/dispatchd/
RUN yum install -y python-setuptools.noarch gcc-c++ glibc-headers
RUN easy_install mako
RUN yum install -y gcc-c++ glibc-headers

# protobuf
RUN cd /tmp && curl -L -o protobuf-2.6.1.tar.gz https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
RUN cd /tmp && tar -xzf protobuf-2.6.1.tar.gz
RUN cd /tmp/protobuf-2.6.1/ && ./configure && make install

# Build dispatchd
RUN mkdir -p /app/dispatchd/src/github.com/jeffjenkins/dispatchd/
COPY . /app/dispatchd/src/github.com/jeffjenkins/dispatchd/
ENV BUILD_DIR /app/dispatchd/src/github.com/jeffjenkins/dispatchd/
RUN mkdir -p $BUILD_DIR
COPY . $BUILD_DIR
ENV GOPATH /app/dispatchd
RUN cd /app/dispatchd/src/github.com/jeffjenkins/dispatchd/ && PATH=$PATH:$GOPATH/bin make install
RUN cd $BUILD_DIR && PATH=$PATH:$GOPATH/bin make install

# Runtime configuration
# TODO: when running for real this should have a volume for
# the database directories
RUN mkdir -p /data/dispatchd/
ENV STATIC_PATH /app/dispatchd/src/github.com/jeffjenkins/dispatchd/static
ENTRYPOINT ["/app/dispatchd/bin/server"]
ENV STATIC_PATH $BUILD_DIR/static
RUN cp $BUILD_DIR/config.default.json /etc/dispatchd.json
CMD ["/app/dispatchd/bin/server", "-config-file=/etc/dispatchd.json", "-persist-dir=/data/dispatchd/"]
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ protoc_present:
which protoc

deps:
go get github.com/boltdb/bolt
go get github.com/gogo/protobuf/gogoproto
go get github.com/gogo/protobuf/proto
go get github.com/gogo/protobuf/protoc-gen-gogo
go get github.com/rcrowley/go-metrics
go get github.com/streadway/amqp
go get github.com/wadey/gocovmerge
go get golang.org/x/crypto/bcrypt
go get github.com/boltdb/bolt \
github.com/gogo/protobuf/gogoproto \
github.com/gogo/protobuf/proto \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/rcrowley/go-metrics \
github.com/streadway/amqp \
github.com/wadey/gocovmerge \
golang.org/x/crypto/bcrypt

gen_all: deps gen_pb gen_amqp

Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ These options can be overridden if `-config-file` is specified. The config file

Right now the only config file exclusive options are for users and passwords. In the future the config file will have tuning parameters as well.

## Packages
## Running Dispatchd

Dispatchd is currently only packaged as a docker image
Dispatchd is currently only packaged as a docker image. You can run it with this command:

docker run \
-p=8080:8080 \
-p=5672:5672 \
--volume=YOUR_CONFIG_FILE:/etc/dispatchd.json \
--volume=YOUR_DATA_DIR:/data/dispatchd/ \
dispatchd/dispatchd

Config file can be left out for the default behaviors. The data volume needs
to be specified so that data is persisted outside of the container.

## Security/Auth

Expand Down
8 changes: 8 additions & 0 deletions config.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"amqp-port" : 1111,
"users" : {
"guest" : {
"password_bcrypt_base64" : "JDJhJDExJENobGk4dG5rY0RGemJhTjhsV21xR3VNNnFZZ1ZqTzUzQWxtbGtyMHRYN3RkUHMuYjF5SUt5"
}
}
}
1 change: 0 additions & 1 deletion dev/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"amqp-port" : 1111,
"users" : {
"guest" : {
"password_bcrypt_base64" : "JDJhJDExJENobGk4dG5rY0RGemJhTjhsV21xR3VNNnFZZ1ZqTzUzQWxtbGtyMHRYN3RkUHMuYjF5SUt5"
Expand Down

0 comments on commit 1f8d77d

Please sign in to comment.