Skip to content

Commit

Permalink
make better use of the repo already copied into the containers
Browse files Browse the repository at this point in the history
Signed-off-by: David Lawrence <[email protected]> (github: endophage)
  • Loading branch information
David Lawrence committed Feb 5, 2016
1 parent 3cf25b9 commit e891420
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
14 changes: 5 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@ notaryserver:
- notarymysql
- notarysigner
environment:
- SERVICE_NAME=notaryserver
volumes:
- ./migrations:/migrations
- SERVICE_NAME="notaryserver"
ports:
- "8080"
- "4443:4443"
entrypoint: /bin/bash
command: -c "/migrations/migrate.sh; notary-server -config=fixtures/server-config.json"
command: -c "./migrations/migrate.sh && notary-server -config=fixtures/server-config.json"
notarysigner:
build: .
dockerfile: signer.Dockerfile
links:
- notarymysql
environment:
- SERVICE_NAME=notarysigner
volumes:
- ./migrations:/migrations
- SERVICE_NAME="notarysigner"
entrypoint: /bin/bash
command: -c "/migrations/migrate.sh; notary-signer -config=fixtures/signer-config.json"
command: -c "./migrations/migrate.sh && notary-signer -config=fixtures/signer-config.json"
notarymysql:
volumes:
- ./notarymysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
Expand All @@ -32,4 +28,4 @@ notarymysql:
ports:
- "3306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
- MYSQL_ALLOW_EMPTY_PASSWORD="true"
19 changes: 17 additions & 2 deletions migrations/migrate.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
#!/bin/bash

# When run in the docker containers, the working directory
# is the root of the repo.

iter=0

case $SERVICE_NAME in
notaryserver)
# have to poll for DB to come up
until migrate -path=/migrations/server/mysql -url="mysql://server@tcp(notarymysql:3306)/notaryserver" up
until migrate -path=migrations/server/mysql -url="mysql://server@tcp(notarymysql:3306)/notaryserver" up
do
((iter++))
if (( iter > 30 )); then
exit 1;
fi
echo "waiting for notarymysql to come up."
sleep 1
done
echo "notaryserver database migrated to latest version"
;;
notarysigner)
# have to poll for DB to come up
until migrate -path=/migrations/signer/mysql -url="mysql://signer@tcp(notarymysql:3306)/notarysigner" up
until migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(notarymysql:3306)/notarysigner" up
do
((iter++))
if (( iter > 30 )); then
exit 1;
fi
echo "waiting for notarymysql to come up."
sleep 1
done
echo "notarysigner database migrated to latest version"
Expand Down
2 changes: 0 additions & 2 deletions notarymysql/data/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion server.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1.5.3
MAINTAINER Diogo Monica "diogo@docker.com"
MAINTAINER David Lawrence "david.lawrence@docker.com"

RUN apt-get update && apt-get install -y \
libltdl-dev \
Expand Down
2 changes: 1 addition & 1 deletion signer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1.5.3
MAINTAINER Diogo Monica "diogo@docker.com"
MAINTAINER David Lawrence "david.lawrence@docker.com"

RUN apt-get update && apt-get install -y \
libltdl-dev \
Expand Down

0 comments on commit e891420

Please sign in to comment.