Skip to content

Comments

Add Docker build files#607

Merged
gdbelvin merged 6 commits intogoogle:masterfrom
gdbelvin:docker
May 23, 2017
Merged

Add Docker build files#607
gdbelvin merged 6 commits intogoogle:masterfrom
gdbelvin:docker

Conversation

@gdbelvin
Copy link
Contributor

Support building trillian clusters by defining docker build files.
They should be run like so:
docker build -f server/trillian_log_server/Dockerfile . from $GOPATH/src/github.com/google/trillian

Please correct me if these are the wrong binaries to be defining definitions for.
I see that there's also a server/main.go which has some duplicate functionality.

WORKDIR /go/src/github.com/google/trillian

RUN go get -d -v ./server/trillian_log_server
RUN go install ./server/trillian_log_server
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you tell go get not to install trillian_log_server (using the -d flag), then immediately install it using go install?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'm following Dockerfile examples

Looks like doing it in one line is ok too.

ENV RPC_PORT 8090
ENV HTTP_PORT 8091

ENV DUMP_METRICS 0s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call

@AlCutter
Copy link
Member

How we doing with this one?
There seems to be a bunch of unrelated proto changes in here too, did they sneak in by accident?

@gdbelvin
Copy link
Contributor Author

This is updated and ready for review.
@AlCutter the proto changes slipped in, they're now removed.
@RJPercival How does this PR intersect with some of your work to use Kubernetes?


RUN go get ./server/vmap/trillian_map_server

# Run the outyet command by default when the container starts.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"outyet command"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. This was left over from an example file.

--http_endpoint="$HOST:$HTTP_PORT" \
--dump_metrics_interval="$DUMP_METRICS" \
--sequencer_guard_window="$SEQUENCER_GUARD_WINDOW" \
--force_master="$FORCE_MASTER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the --alsologtostderr flag that the other Dockerfiles have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added.

@@ -0,0 +1,30 @@
FROM golang

ENV DB_USER=test \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use ARG rather than ENV, so that these values can be overridden when building the image. I'm ok with ENV though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV allows the arguments to be overridden at runtime which might be even more flexible than fixing them at build time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation suggests using both, by declaring an ARG first and then using its value to initialize the ENV. I'm fine with leaving it as it is though, just thought I'd highlight this option.

MYSQL_DATABASE=test \
MYSQL_RANDOM_ROOT_PASSWORD=yes

ADD storage/mysql/storage.sql /docker-entrypoint-initdb.d/storage.sql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this Dockerfile for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Docker equivalent of ./script/resetdb since this particular mysql image runs all the sql scripts in /docker-entrypoint-initdb.d when it's being initialized.

@gdbelvin
Copy link
Contributor Author

PTAL

gdbelvin added 6 commits May 23, 2017 10:12
Support building trillian clusters by defining docker build files.
They should be run like so:
`docker build -f server/trillian_log_server/Dockerfile .`
from
`$GOPATH/src/github.com/google/trillian`
@RJPercival
Copy link
Contributor

To answer your question about Kubernetes, I'll use these Dockerfiles to create images that can be run by Kubernetes. Then I need to write some Kubernetes config files that tell it how to configure and run the Trillian server and signer, and where to find the MySQL server.

@gdbelvin gdbelvin merged commit 1f6c173 into google:master May 23, 2017
@gdbelvin gdbelvin deleted the docker branch May 23, 2017 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants