2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-31 06:15:49 +00:00
- Simplify build config
- Add TTY check to Makefiles for running Docker containers
- Update `fs2` to latest patch
- Update `sbt-assembly` plugin
- Update portal to remove chatty console
- Update portal scripts to add license header
- Update prepare-portal/Gruntfile to combine js and css where applicable
- Remove unused gentelella files from final portal artifact
- Add support for shared zones to quickstart/docker images
- Consolidate built artifacts in `artifacts/` to make eventual release easier
This commit is contained in:
Emerle, Ryan
2021-11-02 17:06:24 -04:00
parent 45e7ce6a6a
commit e1743e5342
62 changed files with 626 additions and 1119 deletions

View File

@@ -1,39 +0,0 @@
# Build VinylDNS API if the JAR doesn't already exist
ARG VINYLDNS_VERSION=latest
FROM vinyldns/build:base-build as base-build
ARG DOCKER_FILE_PATH
COPY . /build/
WORKDIR /build
## Run the build if we don't already have a vinyldns.jar
RUN mkdir -p /opt/vinyldns/conf && \
if [ -f assembly/vinyldns.jar ]; then cp assembly/vinyldns.jar /opt/vinyldns/; fi && \
if [ ! -f /opt/vinyldns/vinyldns.jar ]; then \
env SBT_OPTS="-XX:+UseConcMarkSweepGC -Xmx4G -Xms1G" \
sbt -Dbuild.scalafmtOnCompile=false -Dbuild.lintOnCompile=fase ";project api;coverageOff;assembly" \
&& cp assembly/vinyldns.jar /opt/vinyldns/; \
fi
FROM adoptopenjdk/openjdk11:jdk-11.0.8_10-alpine
RUN apk add --update --no-cache bash
COPY --from=base-build /opt/vinyldns /opt/vinyldns
# This will set the vinyldns version, make sure to have this in config... version = ${?VINYLDNS_VERSION}
ARG VINYLDNS_VERSION="0.0.0-local-dev"
ENV VINYLDNS_VERSION=$VINYLDNS_VERSION
RUN mkdir -p /opt/vinyldns/lib_extra
# Mount the volume for config file and lib extras
# Note: These volume names are used in the build.sbt
VOLUME ["/opt/vinyldns/lib_extra/", "/opt/vinyldns/conf"]
EXPOSE 9000
ENTRYPOINT ["java", "-Dconfig.file=/opt/vinyldns/conf/vinyldns.conf", \
"-Dlogback.configurationFile=/opt/vinyldns/conf/logback.xml",\
"-Dvinyldns.base-version=${VINYLDNS_VERSION}",\
"-cp", "/opt/vinyldns/lib_extra/*",\
"-jar", "/opt/vinyldns/vinyldns.jar"]

View File

@@ -1,50 +0,0 @@
SHELL=bash
IMAGE_NAME=vinyldns/api:local-dev
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# Check that the required version of make is being used
REQ_MAKE_VER:=3.82
ifneq ($(REQ_MAKE_VER),$(firstword $(sort $(MAKE_VERSION) $(REQ_MAKE_VER))))
$(error The version of MAKE $(REQ_MAKE_VER) or higher is required; you are running $(MAKE_VERSION))
endif
# Extract arguments for `make run`
EXTRACT_ARGS=true
ifeq (run,$(firstword $(MAKECMDGOALS)))
EXTRACT_ARGS=true
endif
ifeq ($(EXTRACT_ARGS),true)
# use the rest as arguments for "run"
WITH_ARGS ?= $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
endif
ifdef $(WITH_ARGS)
ARG_SEPARATOR=--
endif
%:
@:
.ONESHELL:
.PHONY: all build run
all: build run
build:
@set -euo pipefail
cd ../..
docker build -t $(IMAGE_NAME) --build-arg DOCKER_FILE_PATH="$$(realpath --relative-to="." "$(ROOT_DIR)")" -f "$(ROOT_DIR)/Dockerfile" .
run:
@set -euo pipefail
docker network create --driver bridge vinyldns_net &> /dev/null || true
test -t 1 && USE_TTY="-t"
docker run -i $${USE_TTY} --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 network create --driver bridge vinyldns_net &> /dev/null || true
test -t 1 && USE_TTY="-t"
docker run -d $${USE_TTY}--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

View File

@@ -1,346 +0,0 @@
vinyldns {
base-version = "0.0.0-local-dev"
version = ${vinyldns.base-version} # default to the base version if not overridden
version = ${?VINYLDNS_VERSION} # override the base version via env var
# How often to any particular zone can be synchronized in milliseconds
sync-delay = 10000
sync-delay = ${?SYNC_DELAY}
# If we should start up polling for change requests, set this to false for the inactive cluster
processing-disabled = false
processing-disabled = ${?PROCESSING_DISABLED}
# Number of records that can be in a zone
max-zone-size = 60000
max-zone-size = ${?MAX_ZONE_SIZE}
# Types of unowned records that users can access in shared zones
shared-approved-types = ["A", "AAAA", "CNAME", "PTR", "TXT"]
# Batch change settings
batch-change-limit = 1000
batch-change-limit = ${?BATCH_CHANGE_LIMIT}
manual-batch-review-enabled = true
manual-batch-review-enabled = ${?MANUAL_BATCH_REVIEW_ENABLED}
scheduled-changes-enabled = true
scheduled-changes-enabled = ${?SCHEDULED_CHANGES_ENABLED}
multi-record-batch-change-enabled = true
multi-record-batch-change-enabled = ${?MULTI_RECORD_BATCH_CHANGE_ENABLED}
# configured backend providers
backend {
# Use "default" when dns backend legacy = true
# otherwise, use the id of one of the connections in any of your backends
default-backend-id = "default"
# this is where we can save additional backends
backend-providers = [
{
class-name = "vinyldns.api.backend.dns.DnsBackendProviderLoader"
settings = {
legacy = false
backends = [
{
id = "default"
zone-connection = {
name = "vinyldns."
key-name = "vinyldns."
key-name = ${?DEFAULT_DNS_KEY_NAME}
key = "nzisn+4G2ldMn0q1CV3vsg=="
key = ${?DEFAULT_DNS_KEY_SECRET}
primary-server = "127.0.0.1"
primary-server = ${?DEFAULT_DNS_ADDRESS}
}
transfer-connection = {
name = "vinyldns."
key-name = "vinyldns."
key-name = ${?DEFAULT_DNS_KEY_NAME}
key = "nzisn+4G2ldMn0q1CV3vsg=="
key = ${?DEFAULT_DNS_KEY_SECRET}
primary-server = "127.0.0.1"
primary-server = ${?DEFAULT_DNS_ADDRESS}
},
tsig-usage = "always"
},
{
id = "func-test-backend"
zone-connection = {
name = "vinyldns."
key-name = "vinyldns."
key-name = ${?DEFAULT_DNS_KEY_NAME}
key = "nzisn+4G2ldMn0q1CV3vsg=="
key = ${?DEFAULT_DNS_KEY_SECRET}
primary-server = "127.0.0.1"
primary-server = ${?DEFAULT_DNS_ADDRESS}
}
transfer-connection = {
name = "vinyldns."
key-name = "vinyldns."
key-name = ${?DEFAULT_DNS_KEY_NAME}
key = "nzisn+4G2ldMn0q1CV3vsg=="
key = ${?DEFAULT_DNS_KEY_SECRET}
primary-server = "127.0.0.1"
primary-server = ${?DEFAULT_DNS_ADDRESS}
},
tsig-usage = "always"
}
]
}
}
]
}
queue {
class-name = "vinyldns.sqs.queue.SqsMessageQueueProvider"
messages-per-poll = 10
polling-interval = 250.millis
settings {
# AWS access key and secret.
access-key = "test"
access-key = ${?AWS_ACCESS_KEY}
secret-key = "test"
secret-key = ${?AWS_SECRET_ACCESS_KEY}
# Regional endpoint to make your requests (eg. 'us-west-2', 'us-east-1', etc.). This is the region where your queue is housed.
signing-region = "us-east-1"
signing-region = ${?SQS_REGION}
# Endpoint to access queue
service-endpoint = "http://vinyldns-integration:19003/"
service-endpoint = ${?SQS_SERVICE_ENDPOINT}
# Queue name. Should be used in conjunction with service endpoint, rather than using a queue url which is subject to change.
queue-name = "vinyldns"
queue-name = ${?SQS_QUEUE_NAME}
}
}
email {
class-name = "vinyldns.api.notifier.email.EmailNotifierProvider"
class-name = ${?EMAIL_CLASS_NAME}
settings = {
from = "VinylDNS <do-not-reply@vinyldns.io>"
}
}
sns {
class-name = "vinyldns.apadi.notifier.sns.SnsNotifierProvider"
class-name = ${?SNS_CLASS_NAME}
settings {
topic-arn = "arn:aws:sns:us-east-1:000000000000:batchChanges"
topic-arn = ${?SNS_TOPIC_ARN}
access-key = "test"
access-key = ${?SNS_ACCESS_KEY}
secret-key = "test"
secret-key = ${?SNS_SECRET_KEY}
service-endpoint = "http://vinyldns-integration:19003"
service-endpoint = ${?SNS_SERVICE_ENDPOINT}
signing-region = "us-east-1"
signing-region = ${?SNS_REGION}
}
}
rest {
host = "0.0.0.0"
port = 9000
port=${?API_SERVICE_PORT}
}
approved-name-servers = [
"172.17.42.1.",
"ns1.parent.com."
"ns1.parent.com1."
"ns1.parent.com2."
"ns1.parent.com3."
"ns1.parent.com4."
]
crypto {
type = "vinyldns.core.crypto.NoOpCrypto"
}
data-stores = ["mysql"]
mysql {
settings {
# JDBC Settings, these are all values in scalikejdbc-config, not our own
# these must be overridden to use MYSQL for production use
# assumes a docker or mysql instance running locally
name = "vinyldns"
name = ${?DATABASE_NAME}
driver = "org.h2.Driver"
driver = ${?JDBC_DRIVER}
migration-url = "jdbc:h2:mem:vinyldns;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE;IGNORECASE=TRUE;INIT=RUNSCRIPT FROM 'classpath:test/ddl.sql'"
migration-url = ${?JDBC_MIGRATION_URL}
url = "jdbc:h2:mem:vinyldns;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE;IGNORECASE=TRUE;INIT=RUNSCRIPT FROM 'classpath:test/ddl.sql'"
url = ${?JDBC_URL}
user = "sa"
user = ${?JDBC_USER}
password = ""
password = ${?JDBC_PASSWORD}
# see https://github.com/brettwooldridge/HikariCP
connection-timeout-millis = 1000
idle-timeout = 10000
max-lifetime = 600000
maximum-pool-size = 20
minimum-idle = 20
register-mbeans = true
}
# Repositories that use this data store are listed here
repositories {
zone {
# no additional settings for now
}
batch-change {
# no additional settings for now
}
user {
}
record-set {
}
group {
}
membership {
}
group-change {
}
zone-change {
}
record-change {
}
}
}
backends = []
# FQDNs / IPs that cannot be modified via VinylDNS
# regex-list used for all record types except PTR
# ip-list used exclusively for PTR records
high-value-domains = {
regex-list = [
"high-value-domain.*" # for testing
]
ip-list = [
# using reverse zones in the vinyldns/bind9 docker image for testing
"192.0.2.252",
"192.0.2.253",
"fd69:27cc:fe91:0:0:0:0:ffff",
"fd69:27cc:fe91:0:0:0:ffff:0"
]
}
# FQDNs / IPs / zone names that require manual review upon submission in batch change interface
# domain-list used for all record types except PTR
# ip-list used exclusively for PTR records
manual-review-domains = {
domain-list = [
"needs-review.*"
]
ip-list = [
"192.0.1.254",
"192.0.1.255",
"192.0.2.254",
"192.0.2.255",
"192.0.3.254",
"192.0.3.255",
"192.0.4.254",
"192.0.4.255",
"fd69:27cc:fe91:0:0:0:ffff:1",
"fd69:27cc:fe91:0:0:0:ffff:2",
"fd69:27cc:fe92:0:0:0:ffff:1",
"fd69:27cc:fe92:0:0:0:ffff:2",
"fd69:27cc:fe93:0:0:0:ffff:1",
"fd69:27cc:fe93:0:0:0:ffff:2",
"fd69:27cc:fe94:0:0:0:ffff:1",
"fd69:27cc:fe94:0:0:0:ffff:2"
]
zone-name-list = [
"zone.requires.review."
"zone.requires.review1."
"zone.requires.review2."
"zone.requires.review3."
"zone.requires.review4."
]
}
# FQDNs / IPs that cannot be modified via VinylDNS
# regex-list used for all record types except PTR
# ip-list used exclusively for PTR records
high-value-domains = {
regex-list = [
"high-value-domain.*" # for testing
]
ip-list = [
# using reverse zones in the vinyldns/bind9 docker image for testing
"192.0.1.252",
"192.0.1.253",
"192.0.2.252",
"192.0.2.253",
"192.0.3.252",
"192.0.3.253",
"192.0.4.252",
"192.0.4.253",
"fd69:27cc:fe91:0:0:0:0:ffff",
"fd69:27cc:fe91:0:0:0:ffff:0",
"fd69:27cc:fe92:0:0:0:0:ffff",
"fd69:27cc:fe92:0:0:0:ffff:0",
"fd69:27cc:fe93:0:0:0:0:ffff",
"fd69:27cc:fe93:0:0:0:ffff:0",
"fd69:27cc:fe94:0:0:0:0:ffff",
"fd69:27cc:fe94:0:0:0:ffff:0"
]
}
global-acl-rules = [
{
group-ids: ["global-acl-group-id"],
fqdn-regex-list: [".*shared[0-9]{1}."]
},
{
group-ids: ["another-global-acl-group"],
fqdn-regex-list: [".*ok[0-9]{1}."]
}
]
}
akka {
loglevel = "INFO"
loggers = ["akka.event.slf4j.Slf4jLogger"]
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
logger-startup-timeout = 30s
actor {
provider = "akka.actor.LocalActorRefProvider"
}
}
akka.http {
server {
# The time period within which the TCP binding process must be completed.
# Set to `infinite` to disable.
bind-timeout = 5s
# Show verbose error messages back to the client
verbose-error-messages = on
}
parsing {
# Spray doesn't like the AWS4 headers
illegal-header-warnings = on
}
}

View File

@@ -1,32 +0,0 @@
<configuration>
<!-- Test configuration, log to console so we can get the docker logs -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d [test] %-5p | \(%logger{4}:%line\) | %msg %n</pattern>
</encoder>
</appender>
<logger name="org.flywaydb" level="DEBUG">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.flywaydb.core.internal.dbsupport.SqlScript" level="DEBUG">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.flywaydb.core.internal.command.DbMigrate" level="DEBUG">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="vinyldns.core.route.Monitor" level="OFF">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="scalikejdbc.StatementExecutor$$anon$1" level="OFF">
<appender-ref ref="CONSOLE"/>
</logger>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

View File

@@ -15,7 +15,7 @@ services:
context: ../
dockerfile: test/api/integration/Dockerfile
args:
VINYLDNS_VERSION: "${VINYLDNS_VERSION}"
VINYLDNS_BASE_VERSION: "${VINYLDNS_BASE_VERSION}"
environment:
RUN_SERVICES: "deps-only tail-logs"
LOCALSTACK_EXT_HOSTNAME: *integration_hostname
@@ -30,12 +30,12 @@ services:
image: "vinyldns/api:${VINYLDNS_IMAGE_VERSION}"
build:
context: ../
dockerfile: quickstart/api/Dockerfile
dockerfile: build/docker/api/Dockerfile
args:
VINYLDNS_VERSION: "${VINYLDNS_VERSION}"
DOCKER_FILE_PATH: "quickstart/api"
VINYLDNS_VERSION: "${VINYLDNS_IMAGE_VERSION}"
DOCKER_FILE_PATH: "../build/docker/api"
volumes:
- ./api/application.conf:/opt/vinyldns/conf/vinyldns.conf
- ../build/docker/api/application.conf:/opt/vinyldns/conf/vinyldns.conf
env_file:
.env
ports:
@@ -48,14 +48,16 @@ services:
image: "vinyldns/portal:${VINYLDNS_IMAGE_VERSION}"
build:
context: ../
dockerfile: quickstart/portal/Dockerfile
dockerfile: build/docker/portal/Dockerfile
args:
DOCKER_FILE_PATH: "../build/docker/portal"
VINYLDNS_VERSION: "${VINYLDNS_IMAGE_VERSION}"
env_file:
.env
ports:
- "${PORTAL_PORT}:${PORTAL_PORT}"
volumes:
- ./portal/application.ini:/opt/vinyldns/conf/application.ini
- ./portal/application.conf:/opt/vinyldns/conf/application.conf
- ../build/docker/portal/application.conf:/opt/vinyldns/conf/application.conf
depends_on:
- api
- ldap

View File

@@ -1,34 +0,0 @@
FROM vinyldns/build:base-build-portal as builder
ARG VINYLDNS_VERSION="0.0.0-local-dev"
COPY . /vinyldns
WORKDIR /vinyldns
RUN cp /build/node_modules.tar.xz /vinyldns/modules/portal && \
cd /vinyldns/modules/portal && tar Jxf node_modules.tar.xz && \
cd /vinyldns
RUN sbt "set version in ThisBuild := \"${VINYLDNS_VERSION}\"; project portal; preparePortal"
RUN sbt "set version in ThisBuild := \"${VINYLDNS_VERSION}\"; project portal; universal:packageZipTarball"
FROM adoptopenjdk/openjdk11:jdk-11.0.8_10-alpine
RUN apk add --update --no-cache bash
COPY --from=builder /vinyldns/modules/portal/target/universal/portal.tgz /
RUN mkdir -p /opt && \
tar -xzf /portal.tgz && \
mv /portal /opt/vinyldns && \
mkdir -p /opt/vinyldns/lib_extra
# This will set the vinyldns version, make sure to have this in config... version = ${?VINYLDNS_VERSION}
ENV VINYLDNS_VERSION=$VINYLDNS_VERSION
# Mount the volume for config file and lib extras
# Note: These volume names are used in the build.sbt
VOLUME ["/opt/vinyldns/lib_extra/", "/opt/vinyldns/conf"]
EXPOSE 9001
ENTRYPOINT ["/opt/vinyldns/bin/portal"]

View File

@@ -1,51 +0,0 @@
SHELL=bash
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
REQ_MAKE_VER:=3.82
ifneq ($(REQ_MAKE_VER),$(firstword $(sort $(MAKE_VERSION) $(REQ_MAKE_VER))))
$(error The version of MAKE $(REQ_MAKE_VER) or higher is required; you are running $(MAKE_VERSION))
endif
# Extract arguments for `make run`
EXTRACT_ARGS=true
ifeq (run,$(firstword $(MAKECMDGOALS)))
EXTRACT_ARGS=true
endif
ifeq ($(EXTRACT_ARGS),true)
# use the rest as arguments for "run"
WITH_ARGS ?= $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
endif
ifdef $(WITH_ARGS)
ARG_SEPARATOR=--
endif
%:
@:
.ONESHELL:
.PHONY: all build run
all: build run
build:
@set -euo pipefail
cd ../..
docker build -t $(IMAGE_NAME) -f "$(ROOT_DIR)/Dockerfile" .
run:
@set -euo pipefail
docker network create --driver bridge vinyldns_net &> /dev/null || true
test -t 1 && USE_TTY="-t"
docker run -i $${USE_TTY} --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 network create --driver bridge vinyldns_net &> /dev/null || true
test -t 1 && USE_TTY="-t"
docker run -d $${USE_TTY} --name $(IMAGE_NAME) --rm $(DOCKER_PARAMS) --network vinyldns_net -p 9001:9001 $(IMAGE_NAME) -- /bin/bash

View File

@@ -1,62 +0,0 @@
LDAP {
# For OpenLDAP, this would be a full DN to the admin for LDAP / user that can see all users
user = "cn=admin,dc=planetexpress,dc=com"
# Password for the admin account
password = "GoodNewsEveryone"
# Keep this as an empty string for OpenLDAP
domain = ""
# This will be the name of the LDAP field that carries the user's login id (what they enter in the username in login form)
userNameAttribute = "uid"
# For organization, leave empty for this demo, the domainName is what matters, and that is the LDAP structure
# to search for users that require login
searchBase = [
{organization = "", domainName = "ou=people,dc=planetexpress,dc=com"},
]
context {
initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory"
securityAuthentication = "simple"
# Note: The following assumes a purely docker setup, using container_name = vinyldns-ldap
providerUrl = "ldap://vinyldns-ldap:19004"
providerUrl = ${?LDAP_PROVIDER_URL}
}
# This is only needed if keeping vinyldns user store in sync with ldap (to auto lock out users who left your
# company for example)
user-sync {
enabled = false
hours-polling-interval = 1
}
}
# Note: This MUST match the API or strange errors will ensure, NoCrypto should not be used for production
crypto {
type = "vinyldns.core.crypto.NoOpCrypto"
}
http.port = 9001
http.port = ${?PORTAL_PORT}
data-stores = ["mysql"]
# Note: The default mysql settings assume a local docker compose setup with mysql named vinyldns-mysql
# follow the configuration guide to point to your mysql
# Only 3 repositories are needed for portal: user, task, user-change
mysql {
repositories {
user {
}
task {
}
user-change {
}
}
}
# 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}

View File

@@ -1,3 +0,0 @@
# uncomment to set custom trustStore
# don't forget to mount trustStore to docker image
#-Djavax.net.ssl.trustStore=/opt/docker/conf/trustStore.jks

View File

@@ -51,6 +51,7 @@ function wait_for_url() {
fi
done
}
function is_running() {
if (docker ps --format "{{.Image}}" | grep -q "$1"); then
return 0
@@ -77,8 +78,14 @@ set -a
source "${DIR}/.env"
set +a
# Set defaults and parse args
# The version of VinylDNS docker image to run
export VINYLDNS_VERSION=latest
# The base/starting version of VinylDNS docker build image to use (vinyldns/build:<version>)
export VINYLDNS_BASE_VERSION=latest
# The version of the images to build
export VINYLDNS_IMAGE_VERSION=${VINYLDNS_VERSION}
# Defaults
TIMEOUT=60
DOCKER_COMPOSE_CONFIG="${DIR}/docker-compose.yml"
SERVICE=""
@@ -124,6 +131,8 @@ while [[ $# -gt 0 ]]; do
;;
-v | --version-tag)
export VINYLDNS_VERSION=$2
export VINYLDNS_BASE_VERSION=${VINYLDNS_VERSION}
export VINYLDNS_IMAGE_VERSION=${VINYLDNS_VERSION}
shift
shift
;;
@@ -142,18 +151,22 @@ if [[ $RESET_DOCKER -eq 1 ]] || [[ $CLEAN -eq 1 ]]; then
fi
fi
export VINYLDNS_IMAGE_VERSION=${VINYLDNS_VERSION}
if [ -n "${BUILD}" ] || [ -n "$(docker images vinyldns/portal:local-dev --format '{{.Repository}}:{{.Tag}}')" ]; then
VINYLDNS_IMAGE_VERSION="local-dev"
fi
# Update images if requested
if [[ $UPDATE -eq 1 ]]; then
echo "${F_YELLOW}Removing local docker images tagged ${F_RESET}'${VINYLDNS_IMAGE_VERSION}'${F_YELLOW}...${F_RESET}"
echo "${F_YELLOW}Removing any local docker containers tagged ${F_RESET}'${VINYLDNS_IMAGE_VERSION}'${F_YELLOW}...${F_RESET}"
"${DIR}/../utils/clean-vinyldns-containers.sh"
docker rmi "vinyldns/build:base-test-integration-${VINYLDNS_IMAGE_VERSION}"
docker rmi "vinyldns/portal:${VINYLDNS_IMAGE_VERSION}"
docker rmi "vinyldns/api:${VINYLDNS_IMAGE_VERSION}"
echo "${F_YELLOW}Removing any local docker images tagged ${F_RESET}'${VINYLDNS_IMAGE_VERSION}'${F_YELLOW}...${F_RESET}"
docker rmi "vinyldns/build:base-test-integration-${VINYLDNS_IMAGE_VERSION}" &> /dev/null || true
docker rmi "vinyldns/portal:${VINYLDNS_IMAGE_VERSION}" &> /dev/null || true
docker rmi "vinyldns/api:${VINYLDNS_IMAGE_VERSION}" &> /dev/null || true
echo "${F_GREEN}Removed all local docker images and containers tagged ${F_RESET}'${VINYLDNS_IMAGE_VERSION}'${F_YELLOW}...${F_RESET}"
fi
if [ -n "${BUILD}" ] || [ -n "$(docker images vinyldns/portal:local-dev --format '{{.Repository}}:{{.Tag}}')" ]; then
VINYLDNS_IMAGE_VERSION="local-dev"
export VINYLDNS_VERSION=${VINYLDNS_IMAGE_VERSION}
fi
if [ -n "${BUILD}" ]; then
@@ -162,14 +175,16 @@ 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
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 is_running "vinyldns/portal" || is_running "vinyldns/api"; then
echo
wait_for_api
wait_for_portal
echo
fi
if is_running "vinyldns/portal"; then
echo "${F_GREEN}VinylDNS started! You can connect to the portal via ${F_RESET}${VINYLDNS_PORTAL_URL}"