mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 15:14:22 +08:00
- fixes
- user msgs
This commit is contained in:
parent
a8081b7fe3
commit
e202483179
2 changed files with 14 additions and 30 deletions
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONFIG_FILE=netmaker.env
|
CONFIG_FILE=netmaker.env
|
||||||
# TODO make sure this doesnt break, parse `certbot certificates` if yes
|
|
||||||
CERT_DIR=/etc/letsencrypt/live/stun.$NM_DOMAIN
|
|
||||||
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
SCRIPT_DIR=$(dirname "$(realpath "$0")")
|
||||||
|
|
||||||
# get and check the config
|
# get and check the config
|
||||||
|
@ -16,6 +14,9 @@ if [ -z "$NM_DOMAIN" ] || [ -z "$NM_EMAIL" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO make sure this doesnt break, parse `certbot certificates` if yes
|
||||||
|
CERT_DIR=/etc/letsencrypt/live/stun.$NM_DOMAIN
|
||||||
|
|
||||||
echo "Setting up SSL certificates..."
|
echo "Setting up SSL certificates..."
|
||||||
|
|
||||||
# get the zerossl wrapper for certbot
|
# get the zerossl wrapper for certbot
|
||||||
|
@ -45,6 +46,7 @@ fi
|
||||||
|
|
||||||
# check if successful
|
# check if successful
|
||||||
if [ ! -f "$CERT_DIR"/fullchain.pem ]; then
|
if [ ! -f "$CERT_DIR"/fullchain.pem ]; then
|
||||||
|
echo "Missing file: $CERT_DIR/fullchain.pem"
|
||||||
echo "SSL certificates failed"
|
echo "SSL certificates failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -75,26 +75,6 @@ print_logo() {
|
||||||
\/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/
|
\/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/
|
||||||
|
|
||||||
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# print_logo - prints the netmaker logo
|
|
||||||
print_logo() {
|
|
||||||
cat <<"EOF"
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
|
|
||||||
__ __ ______ ______ __ __ ______ __ __ ______ ______
|
|
||||||
/\ "-.\ \ /\ ___\ /\__ _\ /\ "-./ \ /\ __ \ /\ \/ / /\ ___\ /\ == \
|
|
||||||
\ \ \-. \ \ \ __\ \/_/\ \/ \ \ \-./\ \ \ \ __ \ \ \ _"-. \ \ __\ \ \ __<
|
|
||||||
\ \_\\"\_\ \ \_____\ \ \_\ \ \_\ \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_____\ \ \_\ \_\
|
|
||||||
\/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/
|
|
||||||
|
|
||||||
|
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -251,6 +231,7 @@ confirm() { (
|
||||||
[Nn]*)
|
[Nn]*)
|
||||||
echo "exiting..."
|
echo "exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
|
# TODO start from the beginning instead
|
||||||
;;
|
;;
|
||||||
*) echo "Please answer yes or no." ;;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
|
@ -498,6 +479,7 @@ set_install_vars() {
|
||||||
|
|
||||||
# read the config file
|
# read the config file
|
||||||
if [ -f "$CONFIG_PATH" ]; then
|
if [ -f "$CONFIG_PATH" ]; then
|
||||||
|
echo "Reading config from $CONFIG_PATH"
|
||||||
source "$CONFIG_PATH"
|
source "$CONFIG_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -510,12 +492,12 @@ set_install_vars() {
|
||||||
read -p "Email Address for Domain Registration (click 'enter' to use $EMAIL_SUGGESTED): " GET_EMAIL
|
read -p "Email Address for Domain Registration (click 'enter' to use $EMAIL_SUGGESTED): " GET_EMAIL
|
||||||
fi
|
fi
|
||||||
if [ -z "$GET_EMAIL" ]; then
|
if [ -z "$GET_EMAIL" ]; then
|
||||||
|
EMAIL="$EMAIL_SUGGESTED"
|
||||||
if [ "$EMAIL" = "$NM_EMAIL" ]; then
|
if [ "$EMAIL" = "$NM_EMAIL" ]; then
|
||||||
echo "using config email"
|
echo "using config email"
|
||||||
else
|
else
|
||||||
echo "using rand email"
|
echo "using rand email"
|
||||||
fi
|
fi
|
||||||
EMAIL="$EMAIL_SUGGESTED"
|
|
||||||
else
|
else
|
||||||
EMAIL="$GET_EMAIL"
|
EMAIL="$GET_EMAIL"
|
||||||
fi
|
fi
|
||||||
|
@ -650,17 +632,17 @@ install_netmaker() {
|
||||||
|
|
||||||
COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/compose/docker-compose.yml"
|
COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/compose/docker-compose.yml"
|
||||||
CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/Caddyfile"
|
CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/Caddyfile"
|
||||||
CERTS_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/scripts/nm-certs.sh"
|
|
||||||
if [ "$INSTALL_TYPE" = "ee" ]; then
|
if [ "$INSTALL_TYPE" = "ee" ]; then
|
||||||
COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/compose/docker-compose.ee.yml"
|
COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/compose/docker-compose.ee.yml"
|
||||||
CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/Caddyfile-EE"
|
CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/Caddyfile-EE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "$BUILD_TYPE" = "local" ]; then
|
if [ ! "$BUILD_TYPE" = "local" ]; then
|
||||||
wget -qO /root/docker-compose.yml $COMPOSE_URL
|
wget -qO /root/docker-compose.yml $COMPOSE_URL
|
||||||
wget -qO /root/mosquitto.conf https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/mosquitto.conf
|
|
||||||
wget -qO /root/Caddyfile $CADDY_URL
|
wget -qO /root/Caddyfile $CADDY_URL
|
||||||
wget -qO /root/nm-certs.sh $CERTS_URL
|
wget -qO /root/mosquitto.conf "https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/mosquitto.conf"
|
||||||
wget -qO /root/wait.sh https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/wait.sh
|
wget -qO /root/nm-certs.sh "https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/scripts/nm-certs.sh"
|
||||||
|
wget -qO /root/wait.sh "https://raw.githubusercontent.com/gravitl/netmaker/$BUILD_TAG/docker/wait.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x /root/wait.sh
|
chmod +x /root/wait.sh
|
||||||
|
@ -788,12 +770,12 @@ set -e
|
||||||
# 6. get user input for variables
|
# 6. get user input for variables
|
||||||
set_install_vars
|
set_install_vars
|
||||||
|
|
||||||
# Fetch / update certs using certbot
|
|
||||||
"$SCRIPT_DIR"/nm-certs.sh
|
|
||||||
|
|
||||||
# 7. get and set config files, startup docker-compose
|
# 7. get and set config files, startup docker-compose
|
||||||
install_netmaker
|
install_netmaker
|
||||||
|
|
||||||
|
# Fetch / update certs using certbot
|
||||||
|
"$SCRIPT_DIR"/nm-certs.sh
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
# 8. make sure Caddy certs are working
|
# 8. make sure Caddy certs are working
|
||||||
|
|
Loading…
Add table
Reference in a new issue