From 4491ed44a2e24c211fc78d05db76fd9635397d1c Mon Sep 17 00:00:00 2001 From: Michael Hausenblas Date: Fri, 21 Jun 2019 11:02:29 +0100 Subject: [PATCH] adds scripts to launch and stop the UI (proxy) --- launch-ui.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ stop-ui.sh | 17 +++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 launch-ui.sh create mode 100755 stop-ui.sh diff --git a/launch-ui.sh b/launch-ui.sh new file mode 100755 index 0000000..34ad77a --- /dev/null +++ b/launch-ui.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail + +############################################################################### +### DEPENDENCIES CHECKS + +EKSPHEMERAL_URL=$(aws cloudformation describe-stacks --stack-name eksp | jq '.Stacks[].Outputs[] | select(.OutputKey=="EKSphemeralAPIEndpoint").OutputValue' -r) + +CONTROLPLANE_STATUS=$(curl -sL -w "%{http_code}" -o /dev/null "$EKSPHEMERAL_URL/status/*") + +if [ ! $CONTROLPLANE_STATUS == "200" ] +then + echo "I don't know which EKSphemeral control plane to use, please set the EKSPHEMERAL_URL environment variable" + exit 1 +else + export EKSPHEMERAL_URL=$EKSPHEMERAL_URL +fi + +if [[ $(docker info >/dev/null 2>&1) -ne 0 ]] +then + echo "Pre-flight check failed: Docker is not running" >&2 + exit 1 +fi + +############################################################################### +### MAIN + + +cd ui/ + +# if the container image is not yet available locally, build it: +if [[ $(make verify > /dev/null 2>&1) -ne 0 ]] +then + make build +fi + +# make sure to stop the already running one and otherwise launch the UI proxy: + +if [[ $(docker ps | grep ekspui >/dev/null 2>&1) -eq 0 ]] +then + make stop > /dev/null +fi + +make run > /dev/null + +# show user the logs: +docker logs --follow ekspui + +cd - \ No newline at end of file diff --git a/stop-ui.sh b/stop-ui.sh new file mode 100755 index 0000000..ba1bb90 --- /dev/null +++ b/stop-ui.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail + + +############################################################################### +### MAIN + + +cd ui/ + +make stop + +cd - \ No newline at end of file