From 43129a46ca497bfa8edc7d612f407fb760b64530 Mon Sep 17 00:00:00 2001 From: Harry Vasanth Date: Mon, 17 Oct 2022 18:57:24 +0100 Subject: [PATCH] fix(configure): add check for valid FQDN --- sh/debian/configure.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sh/debian/configure.sh b/sh/debian/configure.sh index da1ce8f9..ac226092 100755 --- a/sh/debian/configure.sh +++ b/sh/debian/configure.sh @@ -219,6 +219,22 @@ function checkList() { echo " SSH private/public key pair generated" } +function runHTTPS() { + echo -e "Deploying HTTPS service: \n" + echo "Enter the server FQDN $(tput setaf 2)[System: $(hostname)]$(tput sgr0):" + read httpsFQDN + # Check if the FQDN is valid + if ping -c1 -W1 $httpsFQDN 2>/dev/null; then + cd /root/core/https + DOMAIN=$httpsFQDN ./run.sh + echo -e "HTTPS service is up! \n" + else + echo "$(tput setaf 1)$(tput bold)The FQDN: $httpsFQDN is not reachable$(tput sgr0)" + echo "$(tput setaf 1)Please check your DNS configuration$(tput sgr0)" + runHTTPS + fi +} + # Deploy core repositories function deployCore() { # Check for the presence of configurations @@ -237,12 +253,7 @@ function deployCore() { docker login docker.01-edu.org -u $dockerUsername -p $dockerPassword # Deploy HTTPS - echo -e "Deploying HTTPS service: \n" - echo "Enter the server FQDN $(tput setaf 2)[System: $(hostname)]$(tput sgr0):" - read httpsFQDN - cd /root/core/https - DOMAIN=$httpsFQDN ./run.sh - echo -e "HTTPS service is up! \n" + runHTTPS # Deploy Runner echo -e "Deploying Runner service: \n " @@ -265,7 +276,7 @@ function deployPlatform() { cd /root/$serverFQDN # Generate platform environment file automatically ./generate_env.sh --auto - docker-compose --build --detach + docker-compose up --build --detach ./redeploy.sh --latest }