Skip to content

Commit

Permalink
Added Dockerfile to individual components
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrohling committed May 24, 2017
1 parent 437ec41 commit 99238f7
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cmd/standalone/standalone-linux
cmd/agent/agent*
cmd/collector/collector*
cmd/query/query*
cmd/query/jaeger-ui-build/
crossdock/crossdock
crossdock/cmd/
crossdock/scripts/
Expand Down
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ matrix:
- go: 1.7
env:
- CROSSDOCK=true
- go: 1.7
env:
- DOCKER=true
# TODO 1.8 tests take way too long to run 900s vs 250s for 1.7
# - go: 1.8
# env:
Expand All @@ -35,11 +38,12 @@ env:

install:
- make install_ci
- if [ "$ALL_IN_ONE" == true ]; then bash ./travis/install-ui-deps.sh ; fi
- if [ "$ALL_IN_ONE" == true || "$DOCKER" == true ]; then bash ./travis/install-ui-deps.sh ; fi
- if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi

script:
- if [ "$TESTS" == true ]; then make test_ci ; else echo 'skipping tests'; fi
- if [ "$COVERAGE" == true ]; then travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true ; else echo 'skipping coverage'; fi
- if [ "$ALL_IN_ONE" == true ]; then bash ./travis/build-all-in-one-image.sh ; else echo 'skipping all_in_one'; fi
- if [ "$CROSSDOCK" == true ]; then bash ./travis/build-crossdock.sh ; else echo 'skipping crossdock'; fi
- if [ "$DOCKER" == true ]; then bash ./travis/build-docker-images.sh ; else echo 'skipping docker images'; fi
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ THRIFT_GEN_DIR=thrift-gen
PASS=$(shell printf "\033[32mPASS\033[0m")
FAIL=$(shell printf "\033[31mFAIL\033[0m")
COLORIZE=sed ''/PASS/s//$(PASS)/'' | sed ''/FAIL/s//$(FAIL)/''
DOCKER_NAMESPACE?=$(USER)

.DEFAULT_GOAL := test-and-lint

Expand All @@ -46,7 +47,7 @@ md-to-godoc-gen:

.PHONY: clean
clean:
rm -rf cover.out cover.html lint.log fmt.log
rm -rf cover.out cover.html lint.log fmt.log jaeger-ui-build

.PHONY: test
test: go-gen
Expand Down Expand Up @@ -111,6 +112,21 @@ build-query-linux:
build-collector-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/collector/collector-linux ./cmd/collector/main.go

.PHONY: docker
docker: build_ui build-agent-linux build-collector-linux build-query-linux
cp -r jaeger-ui-build/build/ cmd/query/jaeger-ui-build
docker build -t $(DOCKER_NAMESPACE)/jaeger-cassandra-schema plugin/storage/cassandra/ ; \
for component in agent collector query ; do \
docker build -t $(DOCKER_NAMESPACE)/jaeger-$$component cmd/$$component ; \
done
rm -rf cmd/query/jaeger-ui-build

.PHONY: docker-push
docker-push:
for component in agent cassandra-schema collector query ; do \
docker push $(DOCKER_NAMESPACE)/jaeger-$$component ; \
done

.PHONY: build-crossdock-linux
build-crossdock-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./crossdock/crossdock ./crossdock/main.go
Expand Down
6 changes: 6 additions & 0 deletions cmd/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM centos:7
EXPOSE 5775/udp 6831/udp 6832/udp 5778

COPY agent-linux /go/bin/

CMD ["/go/bin/agent-linux"]
6 changes: 6 additions & 0 deletions cmd/collector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM centos:7
EXPOSE 14267

COPY collector-linux /go/bin/

CMD ["/go/bin/collector-linux"]
7 changes: 7 additions & 0 deletions cmd/query/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM centos:7
EXPOSE 16686

COPY query-linux /go/bin/
ADD jaeger-ui-build /go/jaeger-ui/

CMD ["/go/bin/query-linux", "--query.static-files=/go/jaeger-ui/"]
2 changes: 1 addition & 1 deletion jaeger-ui
8 changes: 8 additions & 0 deletions plugin/storage/cassandra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# TODO: replace this by the final Cassandra image
FROM jpkroehling/cassandra

COPY cassandra3v001-schema.sh /cassandra-schema/
COPY create-schema.sh /cassandra-schema/

ENV CQLSH_HOST=cassandra
CMD ["/cassandra-schema/create-schema.sh"]
31 changes: 31 additions & 0 deletions plugin/storage/cassandra/create-schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

CQLSH_HOST=${CQLSH_HOST:-"cassandra"}
CASSANDRA_WAIT_TIMEOUT=${CASSANDRA_WAIT_TIMEOUT:-"60"}
DATACENTER=${DATACENTER:-"dc1"}
KEYSPACE=${KEYSPACE:-"jaeger_v1_${DATACENTER}"}

total_wait=0
while true
do
ping -c 1 ${CQLSH_HOST} > /dev/null 2>&1
if (( $? == 0 )); then
break
else
if (( total_wait >= ${CASSANDRA_WAIT_TIMEOUT} )); then
echo "Timed out waiting for Cassandra."
exit 1
fi
echo "Cassandra is still not up at ${CQLSH_HOST}. Waiting 1 second."
sleep 1s
((total_wait++))
fi
done

echo "Generating the schema for the keyspace ${KEYSPACE} and datacenter ${DATACENTER}"
export KEYSPACE

# the `test` parameter is to force the script to use a SimpleStrategy instead of
# NetworkTopologyStrategy .
/cassandra-schema/cassandra3v001-schema.sh test "${DATACENTER}" | \
/opt/apache-cassandra-3.0.12/bin/cqlsh
17 changes: 17 additions & 0 deletions travis/build-docker-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
# Only push the docker container to Docker Hub for master branch
if [[ "$BRANCH" == "master" && "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then echo 'upload to Docker Hub'; else echo 'skip docker upload for PR'; exit 0; fi

source ~/.nvm/nvm.sh
nvm use 6
DOCKER_NAMESPACE=jaegertracing make docker

for component in agent cassandra-schema collector query
do
export REPO="jaegertracing/jaeger-${component}"
bash ./travis/upload-to-docker.sh
done

0 comments on commit 99238f7

Please sign in to comment.