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

Upgrade and pin mattes/migrate to the v3.0.0 tag #1151

Merged
merged 3 commits into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
30 changes: 4 additions & 26 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}" up
do
iter=$(( iter+1 ))
if [[ $iter -gt 30 ]]; then
Expand All @@ -20,24 +20,13 @@ 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)
if [ "$pre" != "$post" ]; then
echo "notaryserver database migrated to latest version"
else
echo "notaryserver database already at latest version"
fi
else
echo "notaryserver database migration failed"
exit 1
fi
echo "notaryserver database migrated to latest version"
;;
notary_signer)
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
do
iter=$(( iter+1 ))
if [[ $iter -gt 30 ]]; then
Expand All @@ -47,17 +36,6 @@ 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)
if [ "$pre" != "$post" ]; then
echo "notarysigner database migrated to latest version"
else
echo "notarysigner database already at latest version"
fi
else
echo "notarysigner database migration failed"
exit 1
fi
echo "notarysigner database migrated to latest version"
;;
esac
6 changes: 2 additions & 4 deletions server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ MAINTAINER David Lawrence "david.lawrence@docker.com"

RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*

# Pin to the specific v1 version
RUN git clone -b v1 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
# Pin to the specific v3.0.0 version
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
6 changes: 2 additions & 4 deletions signer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ MAINTAINER David Lawrence "david.lawrence@docker.com"

RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*

# Pin to the specific v1 version
RUN git clone -b v1 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
# Pin to the specific v3.0.0 version
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