diff --git a/Dockerfile b/Dockerfile index 7ce6fb1..056d8b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,9 @@ 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 @@ -16,14 +15,13 @@ 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/"] diff --git a/Makefile b/Makefile index fcda1dc..21065ed 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index bd77de8..862deb8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/config.default.json b/config.default.json new file mode 100644 index 0000000..374b191 --- /dev/null +++ b/config.default.json @@ -0,0 +1,8 @@ +{ + "amqp-port" : 1111, + "users" : { + "guest" : { + "password_bcrypt_base64" : "JDJhJDExJENobGk4dG5rY0RGemJhTjhsV21xR3VNNnFZZ1ZqTzUzQWxtbGtyMHRYN3RkUHMuYjF5SUt5" + } + } +} \ No newline at end of file diff --git a/dev/config.json b/dev/config.json index 374b191..1fe3430 100644 --- a/dev/config.json +++ b/dev/config.json @@ -1,5 +1,4 @@ { - "amqp-port" : 1111, "users" : { "guest" : { "password_bcrypt_base64" : "JDJhJDExJENobGk4dG5rY0RGemJhTjhsV21xR3VNNnFZZ1ZqTzUzQWxtbGtyMHRYN3RkUHMuYjF5SUt5"