Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add m3coordinator Dockerfile and update Prometheus test to use standalone coordinator #792

Merged
merged 4 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ services:
- "9000-9004"
ports:
- "0.0.0.0:9000-9004:9000-9004"
- "0.0.0.0:7201:7201"
- "0.0.0.0:2379-2380:2379-2380"
networks:
- backend
build:
context: .
dockerfile: Dockerfile
image: m3db_dbnode01:latest
dockerfile: ./docker/m3dbnode/Dockerfile
image: m3dbnode01:latest
volumes:
- "~/m3db:/var/lib/m3db"
coordinator01:
expose:
- "7201"
ports:
- "0.0.0.0:7201:7201"
networks:
- backend
build:
context: .
dockerfile: ./docker/m3coordinator/Dockerfile
image: m3coordinator01:latest
networks:
backend:
27 changes: 27 additions & 0 deletions docker/m3coordinator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# stage 1: build
FROM golang:1.10-alpine AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install Glide
RUN apk add --update glide git make bash
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should reuse these steps across the Dockerfiles at some point, but let's just move forward quickly for now to unblock others using the images?


# Add source code
RUN mkdir -p /go/src/github.com/m3db/m3db
ADD . /go/src/github.com/m3db/m3db

# Build m3coordinator binary
RUN cd /go/src/github.com/m3db/m3db/ && \
git submodule update --init && \
make m3coordinator-linux-amd64

# stage 2: lightweight "release"
FROM alpine:latest
LABEL maintainer="The M3DB Authors <[email protected]>"

EXPOSE 7201/tcp 7203/tcp

COPY --from=builder /go/src/github.com/m3db/m3db/bin/m3coordinator /bin/
COPY --from=builder /go/src/github.com/m3db/m3db/src/coordinator/config/m3coordinator-local-etcd.yml /etc/m3coordinator/m3coordinator.yml

ENTRYPOINT [ "/bin/m3coordinator" ]
CMD [ "-f", "/etc/m3coordinator/m3coordinator.yml" ]
6 changes: 2 additions & 4 deletions Dockerfile → docker/m3dbnode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ LABEL maintainer="The M3DB Authors <[email protected]>"
EXPOSE 2379/tcp 2380/tcp 7201/tcp 9000-9004/tcp

COPY --from=builder /go/src/github.com/m3db/m3db/bin/m3dbnode /bin/
COPY --from=builder /go/src/github.com/m3db/m3db/src/dbnode/config/m3dbnode-local-etcd.yml \
/go/src/github.com/m3db/m3db/src/dbnode/config/m3dbnode-local.yml \
/etc/m3dbnode/
COPY --from=builder /go/src/github.com/m3db/m3db/src/dbnode/config/m3dbnode-local-etcd.yml /etc/m3dbnode/m3dbnode.yml

ENTRYPOINT [ "/bin/m3dbnode" ]
CMD [ "-f", "/etc/m3dbnode/m3dbnode-local-etcd.yml" ]
CMD [ "-f", "/etc/m3dbnode/m3dbnode.yml" ]
2 changes: 1 addition & 1 deletion scripts/integration-tests/docker-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -xe

echo "Build docker image"

docker build -t "m3dbnode:$(git rev-parse HEAD)" -f Dockerfile .
docker build -t "m3dbnode:$(git rev-parse HEAD)" -f ./docker/m3dbnode/Dockerfile .

echo "Run docker container"

Expand Down
24 changes: 17 additions & 7 deletions scripts/integration-tests/prometheus/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ services:
dbnode01:
expose:
- "9000-9004"
- "7201"
- "7203"
- "2379-2380"
ports:
- "0.0.0.0:9000-9004:9000-9004"
- "0.0.0.0:7201:7201"
- "0.0.0.0:7203:7203"
- "0.0.0.0:2379-2380:2379-2380"
networks:
- backend
build:
context: ../../../
dockerfile: Dockerfile
image: m3db_dbnode01:latest
dockerfile: ./docker/m3dbnode/Dockerfile
image: m3dbnode01:latest
volumes:
- "./:/etc/m3dbnode/"
- "/tmp/m3dbdata:/var/lib/m3db"
coordinator01:
expose:
- "7201"
- "7203"
ports:
- "0.0.0.0:7201:7201"
- "0.0.0.0:7203:7203"
networks:
- backend
build:
context: ../../../
dockerfile: ./docker/m3coordinator/Dockerfile
image: m3coordinator01:latest
volumes:
- "./:/etc/m3coordinator/"
prometheus01:
expose:
- "9090"
Expand Down
45 changes: 45 additions & 0 deletions scripts/integration-tests/prometheus/m3coordinator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
listenAddress: 0.0.0.0:7201
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this never going to be useful for end users ? Maybe consider it moving out of integration-tests ?


metrics:
scope:
prefix: "coordinator"
prometheus:
handlerPath: /metrics
listenAddress: 0.0.0.0:7203 # until https://github.com/m3db/m3db/issues/682 is resolved
sanitization: prometheus
samplingRate: 1.0
extended: none

clusters:
- namespaces:
- namespace: prometheus_metrics
storageMetricsType: unaggregated
retention: 48h
client:
config:
service:
env: default_env
zone: embedded
service: m3db
cacheDir: /var/lib/m3kv
etcdClusters:
- zone: embedded
endpoints:
- dbnode01:2379
writeConsistencyLevel: majority
readConsistencyLevel: unstrict_majority
writeTimeout: 10s
fetchTimeout: 15s
connectTimeout: 20s
writeRetry:
initialBackoff: 500ms
backoffFactor: 3
maxRetries: 2
jitter: true
fetchRetry:
initialBackoff: 500ms
backoffFactor: 2
maxRetries: 3
jitter: true
backgroundHealthCheckFailLimit: 4
backgroundHealthCheckFailThrottleFactor: 0.5
209 changes: 0 additions & 209 deletions scripts/integration-tests/prometheus/m3dbnode-local-etcd.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ set -xe
rm -rf /tmp/m3dbdata/
mkdir -p /tmp/m3dbdata/

echo "Build M3DB docker image"
echo "Build docker images"

docker-compose -f docker-compose.yml build

echo "Run M3DB docker container"
echo "Run m3dbnode and m3coordinator containers"

docker-compose -f docker-compose.yml up -d dbnode01
docker-compose -f docker-compose.yml up -d coordinator01

echo "Sleeping for a bit to ensure db"
echo "Sleeping for a bit to ensure db up"

sleep 10 # TODO Replace sleeps with logic to determine when to proceed

Expand Down
Loading