mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-22 02:02:14 +00:00
Fixes #744 Overhauls our docker release process to run releases of docker outside of SBT. This was tested through the signing process deploying SNAPSHOT images to docker hub. All images do a git clone to pull vinyldns, and perform the build of the container based on that git clone. - A new `build` directory contains the things to be built, for this PR only the docker images are here. Anticipate possibly pulling in other artifacts in the future. - `build/docker` contains all of the docker setup - `build/docker/test` contains a func test docker image that can be used to test any VinylDNS API instance - `build/docker/test-bind9` contains our bind9 setup - `build/docker/api` is a MySQL only API distribution - `build/docker/portal` is a MySQL only Portal distribution In addition, a few files are added to make the build easier: - `build/start.sh` starts a given vinyldns version - `build/stop.sh` stops the current running vinyldns setup - `build/release.sh` this is the **MAIN** guy that performs the build. Lots of arguments that are useful for testing. Can provide a repository (for publishing to a docker register that is not docker hub), for building clean vs. assuming docker images. Besides building everything, also runs func tests (smoke tests) against the docker image before completing. Added a `README.md` for others to follow along with To test.. 1. Make sure you increase your docker machine settings to 4GB (the default of 2GB failed) 2. Go to the `build` directory 3. From there, run `./release.sh -c -t 111` to only build the docker images, this should build `0.9.4-b111` 4. Start it up, run `./start.sh -v 0.9.4-b111` 5. Login to the portal at http://localhost:9001 6. When finished, run `./stop.sh` from the build directory *If you see an error code 137 error, you need to increase your memory*
74 lines
1.4 KiB
Bash
Executable File
74 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
CURDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
function usage() {
|
|
printf "usage: start.sh [OPTIONS]\n\n"
|
|
printf "starts a specific version of vinyldns\n\n"
|
|
printf "options:\n"
|
|
printf "\t-v, --version: the version to start up; required\n"
|
|
}
|
|
|
|
function wait_for_url() {
|
|
URL=$1
|
|
DATA=""
|
|
RETRY="60"
|
|
echo "pinging $URL ..."
|
|
while [ "$RETRY" -gt 0 ]; do
|
|
DATA=$(curl -I -s "${URL}" -o /dev/null -w "%{http_code}")
|
|
if [ $? -eq 0 ]; then
|
|
echo "Succeeded in connecting to ${URL}!"
|
|
break
|
|
else
|
|
echo "Retrying" >&2
|
|
|
|
let RETRY-=1
|
|
sleep 1
|
|
|
|
if [ "$RETRY" -eq 0 ]; then
|
|
echo "Exceeded retries waiting for ${URL} to be ready, failing"
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Default the build to -SNAPSHOT if not set
|
|
VINYLDNS_VERSION=
|
|
|
|
while [ "$1" != "" ]; do
|
|
case "$1" in
|
|
-v | --version)
|
|
VINYLDNS_VERSION="$2"
|
|
shift 2
|
|
;;
|
|
*)
|
|
usage
|
|
exit
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "$VINYLDNS_VERSION" ]; then
|
|
echo "VINYLDNS_VERSION not set"
|
|
usage
|
|
exit
|
|
else
|
|
export VINYLDNS_VERSION=$VINYLDNS_VERSION
|
|
fi
|
|
|
|
# Actually starts up our docker images
|
|
docker-compose -f $CURDIR/docker/docker-compose.yml up --no-build -d api portal
|
|
|
|
# Waits for the URL to be available
|
|
wait_for_url "http://localhost:9001"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "VinylDNS started and available at http://localhost:9001"
|
|
exit 0
|
|
else
|
|
echo "VinylDNS startup failed!"
|
|
$CURDIR/stop.sh
|
|
exit 1
|
|
fi
|