From bd1da46fcca4986af0b29f3fd2ed73445adfc5cd Mon Sep 17 00:00:00 2001 From: hael Date: Tue, 23 May 2023 16:25:55 +0000 Subject: [PATCH] local backend deploy --- install.sh | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index fe42bae..a7110ba 100755 --- a/install.sh +++ b/install.sh @@ -16,6 +16,18 @@ ask_envs() { SMARTHOST_PROXY="no"; else SMARTHOST_PROXY="yes"; + echo "Please fill in the domain name: (localhost)"; + read -r DOMAIN; + if [ "$DOMAIN" == "" ] then + DOMAIN="localhost"; + fi + A=$(echo $DOMAIN | cut -d '.' -f1) + B=$(echo $DOMAIN | cut -d '.' -f2) + # if not FQDN + if [ "$A" == "$B" ]; then + echo "Warning! It seems it's not a FQDN. Self-signed certificate will be created only."; + SELF_SIGNED_CERTIFICATE="true"; + fi; fi echo "Local proxy? (Y/n)"; @@ -24,14 +36,17 @@ ask_envs() { LOCAL_PROXY="no"; else LOCAL_PROXY="yes"; + if [ "$SMARTHOST_PROXY" == "no" ]; then + echo "Warning! Local proxy will not work without smarthost proxy service."; + fi; fi - echo "VPN proxy? (Y/n)"; + echo "VPN proxy? (y/N)"; read -r ANSWER; - if [ "$ANSWER" == "n" ] || [ "$ANSWER" == "N" ]; then - VPN_PROXY="no"; - else + if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ]; then VPN_PROXY="yes"; + else + VPN_PROXY="no"; fi echo "Cron? (Y/n)"; @@ -181,6 +196,7 @@ install_docker_apt() { if [ "$DOCKER_SOURCE" == "0" ]; then # add docker source to the source list $SUDO_CMD echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$VERSION_CODENAME" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + $SUDO_CMD apt-get update fi $SUDO_CMD apt-get -y install --no-install-recommends docker-ce docker-ce-cli containerd.io @@ -278,13 +294,25 @@ $SUDO_CMD docker run \ --env LOCAL_PROXY=$LOCAL_PROXY \ --env VPN_PROXY=$VPN_PROXY \ --env CRON=$CRON \ +--env DOMAIN=$DOMAIN \ --volume /etc/user/:/etc/user/ \ --volume /etc/system/:/etc/system/ \ --env LETSENCRYPT_MAIL=$LETSENCRYPT_MAIL registry.format.hu/proxy-deployment-tool + # test - alias doesn't work inside a function shopt -s expand_aliases source $HOME/.bash_aliases -service-debian core-dns start info +service-debian core-dns start +if [ "$SMARTHOST_PROXY" == "yes" ]; then + service-debian smarthost-proxy start + service-debian smarthost-proxy-scheduler start + + echo "Would you like to run local backend? (Y/n)"; + read -r ANSWER; + if [ "$ANSWER" == "y" ] || [ "$ANSWER" == "Y" ]; then + service-debian local-backend start + fi +fi