mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 06:15:49 +00:00
Update Release
- Added images to `build/docker` - Update `quickstart` script to be more functional
This commit is contained in:
@@ -6,6 +6,7 @@ VINYLDNS_PORTAL_URL=http://localhost:9001
|
||||
PORTAL_PORT=9001
|
||||
PLAY_HTTP_SECRET_KEY=change-this-for-prod
|
||||
VINYLDNS_BACKEND_URL=http://vinyldns-api:9000
|
||||
LDAP_PROVIDER_URL=ldap://vinyldns-ldap:19004
|
||||
TEST_LOGIN=false
|
||||
|
||||
# API Settings
|
||||
|
@@ -26,10 +26,12 @@ The `quickstart-vinyldns.sh` script takes a number of optional arguments:
|
||||
|
||||
| Flag | Description |
|
||||
|:---|:---|
|
||||
| -a, --api-only | do not start up the VinylDNS Portal|
|
||||
| -b, --build | force a rebuild of the Docker images with the local code|
|
||||
| -r, --reset | reset any the running containers|
|
||||
| -s, --service | specify the service to run|
|
||||
| -t, --timeout | the time to wait (in seconds) for the portal and API to start (default: 60)|
|
||||
| -u, --update | remove the local quickstart images to force a re-pull from docker hub|
|
||||
| -v, --version-tag | specify Docker image tag version (default: latest)|
|
||||
| `-a, --api-only` | do not start up the VinylDNS Portal" |
|
||||
| `-b, --build` | force a rebuild of the Docker images with the local code" |
|
||||
| `-c, --clean` | stops all VinylDNS containers" |
|
||||
| `-d, --deps-only` | only start up the dependencies, not the API or Portal" |
|
||||
| `-r, --reset` | reset any the running containers" |
|
||||
| `-s, --service` | specify the service to run" |
|
||||
| `-t, --timeout` | the time to wait (in seconds) for the Portal and API to start (default: 60)" |
|
||||
| `-u, --update` | remove the local quickstart images to force a re-pull from Docker Hub" |
|
||||
| `-v, --version-tag` | specify Docker image tag version (default: latest)" |
|
||||
|
@@ -37,10 +37,12 @@ build:
|
||||
|
||||
run:
|
||||
@set -euo pipefail
|
||||
docker run -it --rm $(DOCKER_PARAMS) -v "$$(pwd)/application.conf:/opt/vinyldns/conf/vinyldns.conf" -v "$$(pwd)/logback.xml:/opt/vinyldns/conf/logback.xml" -p 9000:9000 $(IMAGE_NAME) $(ARG_SEPARATOR) $(WITH_ARGS)
|
||||
docker network create --driver bridge vinyldns_net &> /dev/null || true
|
||||
docker run -it --rm $(DOCKER_PARAMS) --network vinyldns_net -v "$$(pwd)/application.conf:/opt/vinyldns/conf/vinyldns.conf" -v "$$(pwd)/logback.xml:/opt/vinyldns/conf/logback.xml" -p 9000:9000 $(IMAGE_NAME) $(ARG_SEPARATOR) $(WITH_ARGS)
|
||||
|
||||
run-bg:
|
||||
@set -euo pipefail
|
||||
docker stop $(IMAGE_NAME) &> /dev/null || true
|
||||
docker rm $(IMAGE_NAME) &> /dev/null || true
|
||||
docker run -td --name $(IMAGE_NAME) --rm $(DOCKER_PARAMS) -v "$$(pwd)/application.conf:/opt/vinyldns/conf/vinyldns.conf" -v "$$(pwd)/logback.xml:/opt/vinyldns/conf/logback.xml" -p 9001:9001 $(IMAGE_NAME) -- /bin/bash
|
||||
docker network create --driver bridge vinyldns_net &> /dev/null || true
|
||||
docker run -td --name $(IMAGE_NAME) --rm $(DOCKER_PARAMS) --network vinyldns_net -v "$$(pwd)/application.conf:/opt/vinyldns/conf/vinyldns.conf" -v "$$(pwd)/logback.xml:/opt/vinyldns/conf/logback.xml" -p 9001:9001 $(IMAGE_NAME) -- /bin/bash
|
||||
|
@@ -5,7 +5,7 @@ COPY . /vinyldns
|
||||
|
||||
WORKDIR /vinyldns
|
||||
RUN cp /build/node_modules.tar.xz /vinyldns/modules/portal && \
|
||||
cd /vinyldns/modules/portal && tar Jxvf node_modules.tar.xz && \
|
||||
cd /vinyldns/modules/portal && tar Jxf node_modules.tar.xz && \
|
||||
cd /vinyldns
|
||||
|
||||
RUN sbt "set version in ThisBuild := \"${VINYLDNS_VERSION}\"; project portal; preparePortal"
|
||||
@@ -18,7 +18,7 @@ RUN apk add --update --no-cache bash
|
||||
COPY --from=builder /vinyldns/modules/portal/target/universal/portal.tgz /
|
||||
|
||||
RUN mkdir -p /opt && \
|
||||
tar -xzvf /portal.tgz && \
|
||||
tar -xzf /portal.tgz && \
|
||||
mv /portal /opt/vinyldns && \
|
||||
mkdir -p /opt/vinyldns/lib_extra
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
SHELL=bash
|
||||
IMAGE_NAME=vinyldns/portal:local-dev
|
||||
IMAGE_TAG=$(shell awk -F'"' '{print $$2}' ../../../version.sbt)
|
||||
IMAGE_NAME=vinyldns/portal
|
||||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
# Check that the required version of make is being used
|
||||
@@ -37,10 +38,12 @@ build:
|
||||
|
||||
run:
|
||||
@set -euo pipefail
|
||||
docker run -it --rm $(DOCKER_PARAMS) -p 9001:9001 $(IMAGE_NAME) $(ARG_SEPARATOR) $(WITH_ARGS)
|
||||
docker network create --driver bridge vinyldns_net &> /dev/null || true
|
||||
docker run -it --rm $(DOCKER_PARAMS) --network vinyldns_net -p 9001:9001 $(IMAGE_NAME) $(ARG_SEPARATOR) $(WITH_ARGS)
|
||||
|
||||
run-bg:
|
||||
@set -euo pipefail
|
||||
docker stop $(IMAGE_NAME) &> /dev/null || true
|
||||
docker rm $(IMAGE_NAME) &> /dev/null || true
|
||||
docker run -td --name $(IMAGE_NAME) --rm $(DOCKER_PARAMS) -p 9001:9001 $(IMAGE_NAME) -- /bin/bash
|
||||
docker network create --driver bridge vinyldns_net &> /dev/null || true
|
||||
docker run -td --name $(IMAGE_NAME) --rm $(DOCKER_PARAMS) --network vinyldns_net -p 9001:9001 $(IMAGE_NAME) -- /bin/bash
|
||||
|
@@ -39,6 +39,7 @@ crypto {
|
||||
}
|
||||
|
||||
http.port = 9001
|
||||
http.port = ${?PORTAL_PORT}
|
||||
|
||||
data-stores = ["mysql"]
|
||||
|
||||
@@ -58,3 +59,4 @@ mysql {
|
||||
|
||||
# You generate this yourself following https://www.playframework.com/documentation/2.7.x/ApplicationSecret
|
||||
play.http.secret.key = "rpkTGtoJvLIdIV?WU=0@yW^x:pcEGyAt`^p/P3G0fpbj9:uDnD@caSjCDqA0@tB="
|
||||
play.http.secret.key = ${?PLAY_HTTP_SECRET_KEY}
|
||||
|
@@ -8,7 +8,10 @@
|
||||
#####################################################################################################
|
||||
set -eo pipefail
|
||||
|
||||
DIR=$( cd "$(dirname "$0")" || exit ; pwd -P )
|
||||
DIR=$(
|
||||
cd "$(dirname "$0")" || exit
|
||||
pwd -P
|
||||
)
|
||||
source "${DIR}/../utils/includes/terminal_colors.sh"
|
||||
|
||||
function usage() {
|
||||
@@ -18,10 +21,12 @@ function usage() {
|
||||
echo -e "options:"
|
||||
echo -e "\t-a, --api-only do not start up the VinylDNS Portal"
|
||||
echo -e "\t-b, --build force a rebuild of the Docker images with the local code"
|
||||
echo -e "\t-c, --clean stops all VinylDNS containers"
|
||||
echo -e "\t-d, --deps-only only start up the dependencies, not the API or Portal"
|
||||
echo -e "\t-r, --reset reset any the running containers"
|
||||
echo -e "\t-s, --service specify the service to run"
|
||||
echo -e "\t-t, --timeout the time to wait (in seconds) for the portal and API to start (default: 60)"
|
||||
echo -e "\t-u, --update remove the local quickstart images to force a re-pull from docker hub"
|
||||
echo -e "\t-t, --timeout the time to wait (in seconds) for the Portal and API to start (default: 60)"
|
||||
echo -e "\t-u, --update remove the local quickstart images to force a re-pull from Docker Hub"
|
||||
echo -e "\t-v, --version-tag specify Docker image tag version (default: latest)"
|
||||
echo
|
||||
echo -e "\t-h, --help show this help"
|
||||
@@ -46,22 +51,31 @@ function wait_for_url() {
|
||||
fi
|
||||
done
|
||||
}
|
||||
function is_running() {
|
||||
if (docker ps --format "{{.Image}}" | grep -q "$1"); then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
function wait_for_api() {
|
||||
URL="$VINYLDNS_API_URL"
|
||||
wait_for_url "VinylDNS API"
|
||||
if is_running "vinyldns/api"; then
|
||||
URL="$VINYLDNS_API_URL"
|
||||
wait_for_url "VinylDNS API"
|
||||
fi
|
||||
}
|
||||
|
||||
function wait_for_portal() {
|
||||
# check if portal was skipped
|
||||
if [ "$SERVICE" != "api" ]; then
|
||||
if is_running "vinyldns/portal"; then
|
||||
URL="$VINYLDNS_PORTAL_URL"
|
||||
wait_for_url "VinylDNS Portal"
|
||||
fi
|
||||
}
|
||||
|
||||
# Source customizable env files ('-a' causes all variables to be exported)
|
||||
set -a; source "${DIR}/.env"; set +a
|
||||
set -a
|
||||
source "${DIR}/.env"
|
||||
set +a
|
||||
|
||||
# Set defaults and parse args
|
||||
export VINYLDNS_VERSION=latest
|
||||
@@ -71,6 +85,7 @@ SERVICE=""
|
||||
BUILD=""
|
||||
RESET_DOCKER=0
|
||||
UPDATE=0
|
||||
CLEAN=0
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-t | --timeout)
|
||||
@@ -78,10 +93,18 @@ while [[ $# -gt 0 ]]; do
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-d | --deps-only)
|
||||
SERVICE="integration ldap"
|
||||
shift
|
||||
;;
|
||||
-a | --api-only)
|
||||
SERVICE="api"
|
||||
shift
|
||||
;;
|
||||
-c | --clean)
|
||||
CLEAN=1
|
||||
shift
|
||||
;;
|
||||
-s | --service)
|
||||
SERVICE="$2"
|
||||
shift
|
||||
@@ -111,8 +134,12 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $RESET_DOCKER -eq 1 ]]; then
|
||||
if [[ $RESET_DOCKER -eq 1 ]] || [[ $CLEAN -eq 1 ]]; then
|
||||
"${DIR}/../utils/clean-vinyldns-containers.sh"
|
||||
if [[ $CLEAN -eq 1 ]]; then
|
||||
echo "${F_GREEN}Clean up completed!${F_RESET}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
export VINYLDNS_IMAGE_VERSION=${VINYLDNS_VERSION}
|
||||
@@ -134,17 +161,22 @@ if [ -n "${BUILD}" ]; then
|
||||
else
|
||||
echo "Starting VinylDNS (${VINYLDNS_IMAGE_VERSION}) the background..."
|
||||
fi
|
||||
docker-compose -f "${DOCKER_COMPOSE_CONFIG}" up ${BUILD} -d ${SERVICE} || (echo -e "${F_RED}Sorry, there was an error starting VinylDNS :-(\nTry resetting any existing containers with:\n\t${F_RESET}'$0 --reset'"; exit 1)
|
||||
docker-compose -f "${DOCKER_COMPOSE_CONFIG}" up ${BUILD} -d ${SERVICE} || (
|
||||
echo -e "${F_RED}Sorry, there was an error starting VinylDNS :-(\nTry resetting any existing containers with:\n\t${F_RESET}'$0 --reset'"
|
||||
exit 1
|
||||
)
|
||||
|
||||
echo
|
||||
wait_for_api
|
||||
wait_for_portal
|
||||
echo
|
||||
|
||||
if [ "${SERVICE}" != "api" ]; then
|
||||
echo "${F_GREEN}VinylDNS started. You can connect to the portal via ${F_RESET}${VINYLDNS_PORTAL_URL}"
|
||||
if is_running "vinyldns/portal"; then
|
||||
echo "${F_GREEN}VinylDNS started! You can connect to the portal via ${F_RESET}${VINYLDNS_PORTAL_URL}"
|
||||
elif is_running "vinyldns/api"; then
|
||||
echo "${F_GREEN}VinylDNS API started! You can connect to the API via ${F_RESET}${VINYLDNS_API_URL}"
|
||||
else
|
||||
echo "${F_GREEN}VinylDNS API started. You can connect to the API via ${F_RESET}${VINYLDNS_API_URL}"
|
||||
echo "${F_GREEN}VinylDNS dependencies started!${F_RESET}"
|
||||
fi
|
||||
echo "${F_GREEN}To clean up the running containers:${F_RESET}"
|
||||
echo " $0 --reset"
|
||||
echo " $0 --clean"
|
||||
|
Reference in New Issue
Block a user