Skip to content

Commit

Permalink
attempting to fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lawrence committed May 8, 2017
1 parent ef07f20 commit 5f66149
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
14 changes: 7 additions & 7 deletions migrations/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case $SERVICE_NAME in
MIGRATIONS_PATH=${MIGRATIONS_PATH:-migrations/server/mysql}
DB_URL=${DB_URL:-mysql://server@tcp(mysql:3306)/notaryserver}
# have to poll for DB to come up
until migrate -path=$MIGRATIONS_PATH -url=$DB_URL version > /dev/null
until migrate -path=$MIGRATIONS_PATH -database=$DB_URL version > /dev/null
do
iter=$(( iter+1 ))
if [[ $iter -gt 30 ]]; then
Expand All @@ -20,8 +20,8 @@ case $SERVICE_NAME in
echo "waiting for $DB_URL to come up."
sleep 1
done
pre=$(migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" version)
if migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" up ; then
pre=$(migrate -path=$MIGRATIONS_PATH -database="${DB_URL}" version)
if migrate -path=$MIGRATIONS_PATH -database="${DB_URL}" up ; then
post=$(migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" version)
if [ "$pre" != "$post" ]; then
echo "notaryserver database migrated to latest version"
Expand All @@ -37,7 +37,7 @@ case $SERVICE_NAME in
MIGRATIONS_PATH=${MIGRATIONS_PATH:-migrations/signer/mysql}
DB_URL=${DB_URL:-mysql://signer@tcp(mysql:3306)/notarysigner}
# have to poll for DB to come up
until migrate -path=$MIGRATIONS_PATH -url=$DB_URL up version > /dev/null
until migrate -path=$MIGRATIONS_PATH -database=$DB_URL up version > /dev/null
do
iter=$(( iter+1 ))
if [[ $iter -gt 30 ]]; then
Expand All @@ -47,9 +47,9 @@ case $SERVICE_NAME in
echo "waiting for $DB_URL to come up."
sleep 1
done
pre=$(migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" version)
if migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" up ; then
post=$(migrate -path=$MIGRATIONS_PATH -url="${DB_URL}" version)
pre=$(migrate -path=$MIGRATIONS_PATH -database="${DB_URL}" version)
if migrate -path=$MIGRATIONS_PATH -database="${DB_URL}" up ; then
post=$(migrate -path=$MIGRATIONS_PATH -database="${DB_URL}" version)
if [ "$pre" != "$post" ]; then
echo "notarysigner database migrated to latest version"
else
Expand Down
4 changes: 1 addition & 3 deletions server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ MAINTAINER David Lawrence "david.lawrence@docker.com"
RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*

# Pin to the specific v3.0.0 version
RUN git clone -b v3.0.0 https://github.com/mattes/migrate.git /go/src/github.com/mattes/migrate/ && \
go get github.com/mattes/migrate && \
go build -tags 'mysql' -o /usr/local/bin/migrate github.com/mattes/migrate
RUN go get -tags 'mysql postgres file' github.com/mattes/migrate/cli && mv /go/bin/cli /go/bin/migrate

ENV NOTARYPKG github.com/docker/notary

Expand Down
4 changes: 1 addition & 3 deletions signer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ MAINTAINER David Lawrence "david.lawrence@docker.com"
RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*

# Pin to the specific v3.0.0 version
RUN git clone -b v3.0.0 https://github.com/mattes/migrate.git /go/src/github.com/mattes/migrate/ && \
go get github.com/mattes/migrate && \
go build -tags 'mysql' -o /usr/local/bin/migrate github.com/mattes/migrate
RUN go get -tags 'mysql postgres file' github.com/mattes/migrate/cli && mv /go/bin/cli /go/bin/migrate

ENV NOTARYPKG github.com/docker/notary

Expand Down

0 comments on commit 5f66149

Please sign in to comment.