Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Add docker-compose integration test #1201

Merged
merged 16 commits into from
Jul 19, 2019
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
language: go
go:
- 1.x
dist: xenial
dist: bionic

go_import_path: github.com/google/keytransparency

services:
- docker
cache:
directories:
- "$HOME/gcloud/"
Expand All @@ -28,9 +30,12 @@ before_install:
- source "$HOME/gcloud/google-cloud-sdk/path.bash.inc"
- gcloud -q components update
- gcloud -q version
- wget --version

install:
- gcloud -q components install kubectl
- docker --version
- docker-compose --version
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0
- if [ "$GO111MODULE" = "auto" ]; then go get -t -v ./... ; fi

Expand All @@ -39,13 +44,12 @@ script:
- golangci-lint run --deadline=5m
- go test ./... -coverprofile=coverage1.txt
- go test ./impl/integration/ -coverprofile=coverage2.txt -coverpkg=./...
- ./scripts/integration.sh

after_success:
- bash <(curl -s https://codecov.io/bash)

before_deploy:
- docker --version
- docker-compose --version
- openssl aes-256-cbc -K $encrypted_555d9b2948d2_key -iv $encrypted_555d9b2948d2_iv
-in client_secrets.json.enc -d | gcloud auth activate-service-account --key-file /dev/stdin
- go get github.com/google/trillian/server/trillian_log_server
Expand Down
25 changes: 11 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
depends_on:
- server
- sequencer
image: us.gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
image: gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
build:
context: .
dockerfile: deploy/prometheus/Dockerfile
Expand All @@ -30,10 +30,7 @@ services:
- 9090:9090

db:
image: us.gcr.io/key-transparency/db
build:
context: ../trillian
dockerfile: examples/deployment/docker/db_server/Dockerfile
image: gcr.io/trillian-opensource-ci/db_server:latest
restart: always
ports:
- "3306"
Expand All @@ -42,10 +39,10 @@ services:
MYSQL_USER: test
MYSQL_DATABASE: test

log-server:
log-server:
depends_on:
- db
image: us.gcr.io/trillian/log-server:latest
image: gcr.io/trillian-opensource-ci/log_server:latest
restart: always
command:
- --mysql_uri=test:zaphod@tcp(db:3306)/test
Expand All @@ -64,7 +61,7 @@ services:
log-signer:
depends_on:
- db
image: us.gcr.io/trillian/log-signer:latest
image: gcr.io/trillian-opensource-ci/log_signer:latest
restart: always
command:
- --mysql_uri=test:zaphod@tcp(db:3306)/test
Expand All @@ -86,7 +83,7 @@ services:
map-server:
depends_on:
- db
image: us.gcr.io/trillian/map-server:latest
image: gcr.io/trillian-opensource-ci/map_server:latest
restart: always
command:
- --mysql_uri=test:zaphod@tcp(db:3306)/test
Expand All @@ -107,7 +104,7 @@ services:
- db
- log-server
- map-server
image: us.gcr.io/key-transparency/keytransparency-server:${TRAVIS_COMMIT}
image: gcr.io/key-transparency/keytransparency-server:${TRAVIS_COMMIT}
build:
context: .
dockerfile: ./cmd/keytransparency-server/Dockerfile
Expand All @@ -124,7 +121,7 @@ services:
- --tls-cert=/kt/server.crt
- --auth-type=insecure-fake
- --alsologtostderr
- --v=5
- --v=1
labels:
kompose.service.type: LoadBalancer
healthcheck:
Expand All @@ -138,7 +135,7 @@ services:
- db
- log-server
- map-server
image: us.gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
image: gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
build:
context: .
dockerfile: ./cmd/keytransparency-sequencer/Dockerfile
Expand All @@ -163,7 +160,7 @@ services:
retries: 5

init:
image: us.gcr.io/key-transparency/init:latest
image: gcr.io/key-transparency/init:latest
restart: "on-failure"
deploy:
restart_policy:
Expand All @@ -179,7 +176,7 @@ services:
depends_on:
- server
- sequencer
image: us.gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
image: gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
build:
context: .
dockerfile: ./cmd/keytransparency-monitor/Dockerfile
Expand Down
26 changes: 26 additions & 0 deletions scripts/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -ex
set -o pipefail

if [ ! -f genfiles/server.key ]; then
./scripts/prepare_server.sh -f
fi

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
trap "docker-compose down" INT EXIT

wget -T 60 --spider --retry-connrefused --waitretry=1 http://localhost:8081/metrics
wget -T 60 -O /dev/null --no-check-certificate \
--retry-connrefused --waitretry=1 \
--retry-on-http-error=405,404 \
https://localhost/v1/directories/default

PASSWORD="foobar"
go run ./cmd/keytransparency-client authorized-keys create-keyset --password=${PASSWORD}
go run ./cmd/keytransparency-client post [email protected] \
--insecure \
--data='dGVzdA==' \
--password=${PASSWORD} \
--kt-url=localhost:443 \
--verbose \
--logtostderr