From acc9682483e21e82f34ae35c9ed1830bcc3ba1e7 Mon Sep 17 00:00:00 2001 From: hael Date: Thu, 27 Apr 2023 09:24:21 +0000 Subject: [PATCH] add install_additionals - vpn, local proxy, cron --- README.md | 3 +++ deploy.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- entrypoint.sh | 3 +++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc25583..3fbcaa9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ docker run \ --volume /root/.ssh/installer:/root/.ssh/id_rsa \ --env PUBLIC_PROXY=yes \ --env SMARTHOST_PROXY=yes \ + --env LOCAL_PROXY=yes \ + --env VPN_PROXY=yes \ + --env CRON=yes \ --volume /etc/user/:/etc/user/ \ --volume /etc/system/:/etc/system/ \ --env LETSENCRYPT_MAIL=noreply@galaxis.xyz diff --git a/deploy.sh b/deploy.sh index 449e6c4..2e849e6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -16,6 +16,9 @@ fi PUBLIC_PROXY=$(toUpperCase $PUBLIC_PROXY) SMARTHOST_PROXY=$(toUpperCase $SMARTHOST_PROXY) +LOCAL_PROXY=$(toUpperCase $LOCAL_PROXY) +VPN_PROXY=$(toUpperCase $VPN_PROXY) +CRON=$(toUpperCase $CRON) WIREGUARD=$(toUpperCase $WIREGUARD) OPENVPN=$(toUpperCase $OPENVPN) LETSENCRYPT_MAIL=$LETSENCRYPT_MAIL @@ -46,6 +49,15 @@ fi if [ "$CORE_DNS" == "" ]; then CORE_DNS=core-dns fi +if [ "$LOCAL_PROXY_REPO" == "" ]; then + LOCAL_PROXY_REPO="local-proxy"; +fi +if [ "$VPN_PROXY_REPO" == "" ]; then + VPN_PROXY_REPO="wireguard-proxy-client"; +fi +if [ "$CRON_REPO" == "" ]; then + CRON_REPO="cron"; +fi install_core_dns() { @@ -83,8 +95,44 @@ install_core_dns() { } +install_additionals() { + + install_core_dns + + if [[ "$LOCAL_PROXY" == "YES" || "$LOCAL_PROXY" == "TRUE" ]]; then + cp -av /tmp/$LOCAL_PROXY_REPO/*.json $SERVICE_DIR/ + fi + + if [[ "$VPN_PROXY" == "YES" || "$VPN_PROXY" == "TRUE" ]]; then + cp -av /tmp/$VPN_PROXY_REPO/*.json $SERVICE_DIR/ + fi + + if [[ "$CRON" == "YES" || "$CRON" == "TRUE" ]]; then + cp -av /tmp/$CRON_REPO/*.json $SERVICE_DIR/ + + CRON_VOLUMES=$(jq -r .containers[].VOLUMES[].SOURCE $SERVICE_DIR/cron.json |grep -v '\.') + for VOLUME in $(echo $CRON_VOLUMES); do + mkdir -p $VOLUME; + cp -rv /tmp/$CRON_REPO/crontab_letsencrypt.txt $VOLUME/crontab.txt ; + done + fi + +} + git clone ssh://$GIT_REPO/$ORGANIZATION/$CORE_DNS.git /tmp/$CORE_DNS +if [[ "$LOCAL_PROXY" == "YES" || "$LOCAL_PROXY" == "TRUE" ]]; then + git clone ssh://$GIT_REPO/$ORGANIZATION/$LOCAL_PROXY_REPO.git /tmp/$LOCAL_PROXY_REPO +fi + +if [[ "$VPN_PROXY" == "YES" || "$VPN_PROXY" == "TRUE" ]]; then + git clone ssh://$GIT_REPO/$ORGANIZATION/$VPN_PROXY_REPO.git /tmp/$VPN_PROXY_REPO +fi + +if [[ "$CRON" == "YES" || "$CRON" == "TRUE" ]]; then + git clone ssh://$GIT_REPO/$ORGANIZATION/$CRON_REPO.git /tmp/$CRON_REPO +fi + # INSTALL PROXY SERVICES for i in $(echo $PROXY_TYPE); do @@ -126,7 +174,7 @@ for i in $(echo $PROXY_TYPE); do mkdir -p $SERVICE_DIR; cp -av /tmp/$i/*.json $SERVICE_DIR/ - install_core_dns + install_additionals # CREATE FILESYSTEM ACCESS FOR SERVICES diff --git a/entrypoint.sh b/entrypoint.sh index 0f89f66..2621873 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,6 +12,9 @@ fi PUBLIC_PROXY=$(toUpperCase $PUBLIC_PROXY) SMARTHOST_PROXY=$(toUpperCase $SMARTHOST_PROXY) +LOCAL_PROXY=$(toUpperCase $LOCAL_PROXY) +VPN_PROXY=$(toUpperCase $VPN_PROXY) +CRON=$(toUpperCase $CRON) GIT_REPOSITORY=$GIT_REPOSITORY HOST=$HOST PORT=$PORT