2022-07-30 21:55:18 +08:00
#!/bin/bash
2023-05-04 23:36:08 +08:00
CONFIG_FILE = netmaker.env
2023-05-05 23:17:39 +08:00
# location of nm-quick.sh (usually `/root`)
SCRIPT_DIR = $( dirname " $( realpath " $0 " ) " )
2023-05-08 20:57:19 +08:00
CONFIG_PATH = " $SCRIPT_DIR / $CONFIG_FILE "
2023-06-23 05:03:04 +08:00
NM_QUICK_VERSION = "0.1.1"
2023-04-21 00:57:40 +08:00
LATEST = $( curl -s https://api.github.com/repos/gravitl/netmaker/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d [ :space:] ,\" )
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ $( id -u) -ne 0 ] ; then
2023-05-04 22:22:02 +08:00
echo "This script must be run as root"
exit 1
2023-02-23 02:30:15 +08:00
fi
unset INSTALL_TYPE
unset BUILD_TYPE
unset BUILD_TAG
unset IMAGE_TAG
unset AUTO_BUILD
2023-06-23 05:03:04 +08:00
unset NETMAKER_BASE_DOMAIN
2023-02-23 02:30:15 +08:00
2023-02-24 07:49:30 +08:00
# usage - displays usage instructions
2023-05-04 22:22:02 +08:00
usage( ) {
2023-05-25 21:26:26 +08:00
echo " nm-quick.sh v $NM_QUICK_VERSION "
2023-06-23 05:03:04 +08:00
echo "usage: ./nm-quick.sh [-e] [-b buildtype] [-t tag] [-a auto] [-d domain]"
2023-05-04 22:22:02 +08:00
echo " -e if specified, will install netmaker EE"
echo " -b type of build; options:"
2023-02-24 07:49:30 +08:00
echo " \"version\" - will install a specific version of Netmaker using remote git and dockerhub"
2023-05-08 19:01:41 +08:00
echo " \"local\": - will install by cloning repo and building images from git"
2023-02-24 07:49:30 +08:00
echo " \"branch\": - will install a specific branch using remote git and dockerhub"
2023-05-04 22:22:02 +08:00
echo " -t tag of build; if buildtype=version, tag=version. If builtype=branch or builtype=local, tag=branch"
echo " -a auto-build; skip prompts and use defaults, if none provided"
2023-06-23 05:03:04 +08:00
echo " -d domain; if specified, will use this domain instead of auto-generating one"
2023-05-04 22:22:02 +08:00
echo "examples:"
2023-03-31 00:47:30 +08:00
echo " nm-quick.sh -e -b version -t $LATEST "
2023-05-04 22:22:02 +08:00
echo " nm-quick.sh -e -b local -t feature_v0.17.2_newfeature"
2023-02-24 07:49:30 +08:00
echo " nm-quick.sh -e -b branch -t develop"
2023-06-23 05:03:04 +08:00
echo " nm-quick.sh -e -b version -t $LATEST -a -d example.com "
2023-05-04 22:22:02 +08:00
exit 1
2023-02-23 02:30:15 +08:00
}
2023-06-23 05:03:04 +08:00
while getopts evab:d:t: flag; do
2023-02-24 07:49:30 +08:00
case " ${ flag } " in
2023-05-04 22:22:02 +08:00
e)
INSTALL_TYPE = "ee"
2023-07-13 10:54:25 +08:00
UPGRADE_FLAG = "yes"
2023-05-04 22:22:02 +08:00
; ;
v)
usage
exit 0
; ;
a)
AUTO_BUILD = "on"
; ;
b)
BUILD_TYPE = ${ OPTARG }
if [ [ ! " $BUILD_TYPE " = ~ ^( version| local| branch) $ ] ] ; then
echo " error: $BUILD_TYPE is invalid "
echo "valid options: version, local, branch"
2023-02-24 07:49:30 +08:00
usage
2023-05-04 22:22:02 +08:00
exit 1
fi
; ;
t)
BUILD_TAG = ${ OPTARG }
; ;
2023-06-23 05:03:04 +08:00
d)
NETMAKER_BASE_DOMAIN = ${ OPTARG }
; ;
2023-02-24 07:49:30 +08:00
esac
done
2023-02-23 02:30:15 +08:00
2023-02-24 07:49:30 +08:00
# print_logo - prints the netmaker logo
2023-02-23 02:30:15 +08:00
print_logo( ) {
2023-05-04 22:22:02 +08:00
cat <<"EOF"
2022-07-30 21:55:18 +08:00
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__ __ ______ ______ __ __ ______ __ __ ______ ______
/\ "-.\ \ /\ ___\ /\__ _\ /\ " -./ \ /\ __ \ /\ \/ / /\ ___\ /\ = = \
\ \ \- . \ \ \ __\ \/ _/\ \/ \ \ \- ./\ \ \ \ __ \ \ \ _" -. \ \ __\ \ \ __<
\ \_ \\ " \_\ \ \_____\ \ \_\ \ \_\ \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_____\ \ \_\ \_\
\/ _/ \/ _/ \/ _____/ \/ _/ \/ _/ \/ _/ \/ _/\/ _/ \/ _/\/ _/ \/ _____/ \/ _/ /_/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EOF
2023-02-23 02:30:15 +08:00
}
2023-02-17 04:17:59 +08:00
2023-02-24 07:49:30 +08:00
# set_buildinfo - sets the information based on script input for how the installation should be run
2023-02-23 02:30:15 +08:00
set_buildinfo( ) {
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ -z " $BUILD_TYPE " ] ; then
BUILD_TYPE = "version"
BUILD_TAG = $LATEST
fi
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ -z " $BUILD_TAG " ] && [ " $BUILD_TYPE " = "version" ] ; then
BUILD_TAG = $LATEST
fi
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ -z " $BUILD_TAG " ] && [ ! -z " $BUILD_TYPE " ] ; then
echo " error: must specify build tag when build type \" $BUILD_TYPE \" is specified "
2023-05-04 22:22:02 +08:00
usage
2023-02-23 02:30:15 +08:00
exit 1
fi
2023-02-17 12:21:24 +08:00
2023-05-04 22:22:02 +08:00
IMAGE_TAG = $( sed 's/\//-/g' <<< " $BUILD_TAG " )
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ " $1 " = "ce" ] ; then
2022-11-05 05:10:00 +08:00
INSTALL_TYPE = "ce"
2023-02-23 02:30:15 +08:00
elif [ " $1 " = "ee" ] ; then
2022-11-05 05:10:00 +08:00
INSTALL_TYPE = "ee"
2023-02-23 02:30:15 +08:00
fi
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ " $AUTO_BUILD " = "on" ] && [ -z " $INSTALL_TYPE " ] ; then
INSTALL_TYPE = "ce"
elif [ -z " $INSTALL_TYPE " ] ; then
echo "-----------------------------------------------------"
echo "Would you like to install Netmaker Community Edition (CE), or Netmaker Enterprise Edition (EE)?"
2023-07-13 10:53:34 +08:00
echo "EE will require you to create an account at https://app.netmaker.io"
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
select install_option in "Community Edition" "Enterprise Edition" ; do
2023-05-04 22:22:02 +08:00
case $REPLY in
2023-02-23 02:30:15 +08:00
1)
2023-05-04 22:22:02 +08:00
echo "installing Netmaker CE"
INSTALL_TYPE = "ce"
break
; ;
2023-02-23 02:30:15 +08:00
2)
2023-05-04 22:22:02 +08:00
echo "installing Netmaker EE"
INSTALL_TYPE = "ee"
break
; ;
*) echo " invalid option $REPLY " ; ;
esac
2023-02-23 02:30:15 +08:00
done
fi
echo "-----------Build Options-----------------------------"
2023-05-04 22:22:02 +08:00
echo " EE or CE: $INSTALL_TYPE "
echo " Build Type: $BUILD_TYPE "
echo " Build Tag: $BUILD_TAG "
echo " Image Tag: $IMAGE_TAG "
2023-05-25 21:26:26 +08:00
echo " Installer: v $NM_QUICK_VERSION "
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
}
2023-02-17 04:17:59 +08:00
2023-02-24 07:49:30 +08:00
# install_yq - install yq if not present
install_yq( ) {
2023-05-04 22:22:02 +08:00
if ! command -v yq & >/dev/null; then
2023-05-16 19:00:16 +08:00
wget -qO /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.31.1/yq_linux_$( dpkg --print-architecture)
2023-02-24 07:49:30 +08:00
chmod +x /usr/bin/yq
fi
set +e
2023-05-04 22:22:02 +08:00
if ! command -v yq & >/dev/null; then
2023-02-24 07:49:30 +08:00
set -e
2023-05-16 19:00:16 +08:00
wget -qO /usr/bin/yq https://github.com/mikefarah/yq/releases/download/v4.31.1/yq_linux_amd64
2023-02-24 07:49:30 +08:00
chmod +x /usr/bin/yq
fi
set -e
2023-05-04 22:22:02 +08:00
if ! command -v yq & >/dev/null; then
2023-02-24 07:49:30 +08:00
echo "failed to install yq. Please install yq and try again."
echo "https://github.com/mikefarah/yq/#install"
exit 1
2023-05-04 22:22:02 +08:00
fi
2023-02-24 07:49:30 +08:00
}
# setup_netclient - adds netclient to docker-compose
setup_netclient( ) {
2023-03-01 21:00:02 +08:00
set +e
netclient uninstall
set -e
2023-05-16 19:00:16 +08:00
# TODO arm support
wget -qO netclient https://github.com/gravitl/netclient/releases/download/$LATEST /netclient-linux-amd64
2023-03-01 21:00:02 +08:00
chmod +x netclient
./netclient install
2023-05-16 19:00:16 +08:00
echo " Register token: $TOKEN "
2023-03-22 22:57:52 +08:00
netclient register -t $TOKEN
2023-02-24 07:49:30 +08:00
2023-05-16 19:00:16 +08:00
echo "waiting for netclient to become available"
local found = false
local file = /etc/netclient/nodes.yml
for ( ( a = 1; a <= 90; a++) ) ; do
if [ -f " $file " ] ; then
found = true
break
fi
sleep 1
done
if [ " $found " = false ] ; then
echo " Error - $file not present "
exit 1
fi
2023-02-24 07:49:30 +08:00
}
# configure_netclient - configures server's netclient as a default host and an ingress gateway
configure_netclient( ) {
NODE_ID = $( sudo cat /etc/netclient/nodes.yml | yq -r .netmaker.commonnode.id)
2023-05-16 19:00:16 +08:00
if [ " $NODE_ID " = "" ] || [ " $NODE_ID " = "null" ] ; then
echo "Error obtaining NODE_ID for the new network"
exit 1
fi
2023-03-22 22:57:52 +08:00
echo " register complete. New node ID: $NODE_ID "
2023-02-24 07:49:30 +08:00
HOST_ID = $( sudo cat /etc/netclient/netclient.yml | yq -r .host.id)
2023-05-16 19:00:16 +08:00
if [ " $HOST_ID " = "" ] || [ " $HOST_ID " = "null" ] ; then
echo "Error obtaining HOST_ID for the new network"
exit 1
fi
2023-03-22 22:57:52 +08:00
echo "making host a default"
2023-02-24 07:49:30 +08:00
echo " Host ID: $HOST_ID "
# set as a default host
set +e
nmctl host update $HOST_ID --default
sleep 5
nmctl node create_ingress netmaker $NODE_ID
set -e
}
# setup_nmctl - pulls nmctl and makes it executable
setup_nmctl( ) {
2023-05-16 19:00:16 +08:00
# TODO arm support
local URL = " https://github.com/gravitl/netmaker/releases/download/ $LATEST /nmctl-linux-amd64 "
echo "Downloading nmctl..."
wget -qO /usr/bin/nmctl " $URL "
if [ ! -f /usr/bin/nmctl ] ; then
echo " Error downloading nmctl from ' $URL ' "
exit 1
fi
2023-02-24 07:49:30 +08:00
2023-05-04 22:22:02 +08:00
chmod +x /usr/bin/nmctl
echo " using server api. $NETMAKER_BASE_DOMAIN "
echo " using master key $MASTER_KEY "
nmctl context set default --endpoint= " https://api. $NETMAKER_BASE_DOMAIN " --master_key= " $MASTER_KEY "
nmctl context use default
RESP = $( nmctl network list)
if [ [ $RESP = = *"unauthorized" * ] ] ; then
echo "Unable to properly configure NMCTL, exiting..."
exit 1
fi
2023-02-24 07:49:30 +08:00
}
# wait_seconds - wait for the specified period of time
2023-05-04 22:22:02 +08:00
wait_seconds( ) { (
for ( ( a = 1; a <= $1 ; a++) ) ; do
echo ". . ."
sleep 1
done
) ; }
2022-11-05 02:25:01 +08:00
2023-02-24 07:49:30 +08:00
# confirm - get user input to confirm that they want to perform the next step
2023-05-04 22:22:02 +08:00
confirm( ) { (
if [ " $AUTO_BUILD " = "on" ] ; then
return 0
fi
while true; do
read -p 'Does everything look right? [y/n]: ' yn
case $yn in
[ Yy] *)
override = "true"
break
; ;
[ Nn] *)
echo "exiting..."
exit 1
2023-05-09 00:18:09 +08:00
# TODO start from the beginning instead
2023-05-04 22:22:02 +08:00
; ;
*) echo "Please answer yes or no." ; ;
esac
done
) }
2022-11-05 02:25:01 +08:00
2023-05-08 20:57:19 +08:00
save_config( ) { (
echo " Saving the config to $CONFIG_PATH "
touch " $CONFIG_PATH "
2023-05-16 19:00:16 +08:00
save_config_item NM_EMAIL " $EMAIL "
save_config_item NM_DOMAIN " $NETMAKER_BASE_DOMAIN "
save_config_item UI_IMAGE_TAG " $IMAGE_TAG "
if [ " $BUILD_TYPE " = "local" ] ; then
save_config_item UI_IMAGE_TAG " $LATEST "
else
save_config_item UI_IMAGE_TAG " $IMAGE_TAG "
fi
# version-specific entries
if [ " $INSTALL_TYPE " = "ee" ] ; then
2023-07-13 10:53:34 +08:00
save_config_item NETMAKER_TENANT_ID " $TENANT_ID "
2023-05-16 19:00:16 +08:00
save_config_item LICENSE_KEY " $LICENSE_KEY "
save_config_item METRICS_EXPORTER "on"
save_config_item PROMETHEUS "on"
if [ " $BUILD_TYPE " = "version" ] ; then
save_config_item SERVER_IMAGE_TAG " $IMAGE_TAG -ee "
else
save_config_item SERVER_IMAGE_TAG " $IMAGE_TAG "
fi
2023-05-08 20:57:19 +08:00
else
2023-05-16 19:00:16 +08:00
save_config_item METRICS_EXPORTER "off"
save_config_item PROMETHEUS "off"
save_config_item SERVER_IMAGE_TAG " $IMAGE_TAG "
fi
# copy entries from the previous config
2023-05-25 21:26:26 +08:00
local toCopy = ( "SERVER_HOST" "MASTER_KEY" "TURN_USERNAME" "TURN_PASSWORD" "MQ_USERNAME" "MQ_PASSWORD"
2023-07-13 10:53:34 +08:00
"INSTALL_TYPE" "NODE_ID" "DNS_MODE" "NETCLIENT_AUTO_UPDATE" "API_PORT"
2023-05-16 19:00:16 +08:00
"CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "STUN_PORT" "VERBOSITY"
2023-07-26 13:52:49 +08:00
"TURN_PORT" "USE_TURN" "DEBUG_MODE" "TURN_API_PORT" "REST_BACKEND"
2023-06-14 04:33:53 +08:00
"DISABLE_REMOTE_IP_CHECK" "NETCLIENT_ENDPOINT_DETECTION" "TELEMETRY" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET"
"FRONTEND_URL" "AZURE_TENANT" "OIDC_ISSUER" "EXPORTER_API_PORT" )
2023-05-16 19:00:16 +08:00
for name in " ${ toCopy [@] } " ; do
save_config_item $name " ${ !name } "
done
# preserve debug entries
if test -n " $NM_SKIP_BUILD " ; then
save_config_item NM_SKIP_BUILD " $NM_SKIP_BUILD "
fi
if test -n " $NM_SKIP_CLONE " ; then
save_config_item NM_SKIP_CLONE " $NM_SKIP_CLONE "
2023-05-08 20:57:19 +08:00
fi
2023-05-16 19:00:16 +08:00
if test -n " $NM_SKIP_DEPS " ; then
save_config_item NM_SKIP_DEPS " $NM_SKIP_DEPS "
fi
) ; }
save_config_item( ) { (
local NAME = " $1 "
local VALUE = " $2 "
2023-05-25 21:26:26 +08:00
#echo "$NAME=$VALUE"
if test -z " $VALUE " ; then
# load the default for empty values
VALUE = $( awk -F'=' " /^ $NAME / { print \$2} " " $SCRIPT_DIR /netmaker.default.env " )
# trim quotes for docker
VALUE = $( echo " $VALUE " | sed -E " s|^(['\"])(.*)\1 $|\2|g " )
#echo "Default for $NAME=$VALUE"
fi
# TODO single quote passwords
2023-05-16 19:00:16 +08:00
if grep -q " ^ $NAME = " " $CONFIG_PATH " ; then
# TODO escape | in the value
2023-05-19 04:51:26 +08:00
sed -i " s| $NAME =.*| $NAME = $VALUE | " " $CONFIG_PATH "
2023-05-08 20:57:19 +08:00
else
2023-05-25 21:26:26 +08:00
echo " $NAME = $VALUE " >>" $CONFIG_PATH "
2023-05-08 20:57:19 +08:00
fi
2023-05-11 01:46:59 +08:00
) ; }
2023-05-08 20:57:19 +08:00
2023-02-24 07:49:30 +08:00
# local_install_setup - builds artifacts based on specified branch locally to use in install
2023-05-04 22:22:02 +08:00
local_install_setup( ) { (
2023-05-16 19:00:16 +08:00
if test -z " $NM_SKIP_CLONE " ; then
rm -rf netmaker-tmp
mkdir netmaker-tmp
cd netmaker-tmp
git clone --single-branch --depth= 1 --branch= $BUILD_TAG https://www.github.com/gravitl/netmaker
else
cd netmaker-tmp
echo "Skipping git clone on NM_SKIP_CLONE"
fi
2023-02-15 05:45:48 +08:00
cd netmaker
2023-05-11 02:02:39 +08:00
if test -z " $NM_SKIP_BUILD " ; then
2023-05-11 01:46:59 +08:00
docker build --no-cache --build-arg version = $IMAGE_TAG -t gravitl/netmaker:$IMAGE_TAG .
else
echo "Skipping build on NM_SKIP_BUILD"
fi
2023-05-16 19:00:16 +08:00
cp compose/docker-compose.yml " $SCRIPT_DIR /docker-compose.yml "
2023-02-17 04:17:59 +08:00
if [ " $INSTALL_TYPE " = "ee" ] ; then
2023-05-16 19:00:16 +08:00
cp compose/docker-compose.ee.yml " $SCRIPT_DIR /docker-compose.override.yml "
cp docker/Caddyfile-EE " $SCRIPT_DIR /Caddyfile "
2023-02-17 04:17:59 +08:00
else
2023-05-16 19:00:16 +08:00
cp docker/Caddyfile " $SCRIPT_DIR /Caddyfile "
2023-02-17 04:17:59 +08:00
fi
2023-05-16 19:00:16 +08:00
cp scripts/nm-certs.sh " $SCRIPT_DIR /nm-certs.sh "
2023-05-25 21:26:26 +08:00
cp scripts/netmaker.default.env " $SCRIPT_DIR /netmaker.default.env "
2023-05-16 19:00:16 +08:00
cp docker/mosquitto.conf " $SCRIPT_DIR /mosquitto.conf "
cp docker/wait.sh " $SCRIPT_DIR /wait.sh "
2023-02-15 05:45:48 +08:00
cd ../../
2023-05-16 19:00:16 +08:00
if test -z " $NM_SKIP_CLONE " ; then
rm -rf netmaker-tmp
fi
2023-05-04 22:22:02 +08:00
) ; }
2023-02-15 05:45:48 +08:00
2023-05-04 22:22:02 +08:00
# install_dependencies - install necessary packages to run netmaker
2023-02-23 02:30:15 +08:00
install_dependencies( ) {
2023-05-16 19:00:16 +08:00
if test -n " $NM_SKIP_DEPS " ; then
return
fi
2023-02-23 02:30:15 +08:00
echo "checking dependencies..."
OS = $( uname)
if [ -f /etc/debian_version ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard wireguard-tools dnsutils jq docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'apt update'
install_cmd = 'apt-get install -y'
elif [ -f /etc/alpine-release ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard jq docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'apk update'
install_cmd = 'apk --update add'
elif [ -f /etc/centos-release ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard jq bind-utils docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'yum update'
install_cmd = 'yum install -y'
elif [ -f /etc/fedora-release ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard bind-utils jq docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'dnf update'
install_cmd = 'dnf install -y'
elif [ -f /etc/redhat-release ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard jq docker.io bind-utils docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'yum update'
install_cmd = 'yum install -y'
elif [ -f /etc/arch-release ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard-tools dnsutils jq docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'pacman -Sy'
install_cmd = 'pacman -S --noconfirm'
elif [ " ${ OS } " = "FreeBSD" ] ; then
2023-05-25 21:26:26 +08:00
dependencies = "git wireguard wget jq docker.io docker-compose grep gawk"
2023-02-23 02:30:15 +08:00
update_cmd = 'pkg update'
install_cmd = 'pkg install -y'
else
install_cmd = ''
fi
2022-11-05 02:25:01 +08:00
2023-02-23 02:30:15 +08:00
if [ -z " ${ install_cmd } " ] ; then
2023-05-04 22:22:02 +08:00
echo "OS unsupported for automatic dependency install"
# TODO shouldnt exit, check if deps available, if not
# ask the user to install manually and continue when ready
2023-02-23 02:30:15 +08:00
exit 1
fi
2022-11-29 01:16:50 +08:00
2023-02-23 02:30:15 +08:00
set -- $dependencies
2022-11-29 01:16:50 +08:00
2023-02-23 02:30:15 +08:00
${ update_cmd }
while [ -n " $1 " ] ; do
if [ " ${ OS } " = "FreeBSD" ] ; then
2022-11-05 02:25:01 +08:00
is_installed = $( pkg check -d $1 | grep "Checking" | grep "done" )
if [ " $is_installed " != "" ] ; then
echo " " $1 is installed
else
2023-02-23 02:30:15 +08:00
echo " " $1 is not installed. Attempting install.
${ install_cmd } $1
sleep 5
is_installed = $( pkg check -d $1 | grep "Checking" | grep "done" )
if [ " $is_installed " != "" ] ; then
echo " " $1 is installed
elif [ -x " $( command -v $1 ) " ] ; then
echo " " $1 is installed
else
echo " " FAILED TO INSTALL $1
echo " " This may break functionality.
fi
2023-05-04 22:22:02 +08:00
fi
2022-11-05 02:25:01 +08:00
else
if [ " ${ OS } " = "OpenWRT" ] || [ " ${ OS } " = "TurrisOS" ] ; then
is_installed = $( opkg list-installed $1 | grep $1 )
else
is_installed = $( dpkg-query -W --showformat= '${Status}\n' $1 | grep "install ok installed" )
fi
if [ " ${ is_installed } " != "" ] ; then
echo " " $1 is installed
else
2023-02-23 02:30:15 +08:00
echo " " $1 is not installed. Attempting install.
${ install_cmd } $1
sleep 5
if [ " ${ OS } " = "OpenWRT" ] || [ " ${ OS } " = "TurrisOS" ] ; then
is_installed = $( opkg list-installed $1 | grep $1 )
else
is_installed = $( dpkg-query -W --showformat= '${Status}\n' $1 | grep "install ok installed" )
fi
if [ " ${ is_installed } " != "" ] ; then
echo " " $1 is installed
elif [ -x " $( command -v $1 ) " ] ; then
echo " " $1 is installed
else
echo " " FAILED TO INSTALL $1
echo " " This may break functionality.
fi
2022-11-05 02:25:01 +08:00
fi
fi
2023-02-23 02:30:15 +08:00
shift
done
2022-11-05 02:25:01 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
echo "dependency check complete"
echo "-----------------------------------------------------"
2023-05-04 22:22:02 +08:00
}
2023-02-23 02:30:15 +08:00
set -e
2022-11-05 02:25:01 +08:00
2023-02-24 07:49:30 +08:00
# set_install_vars - sets the variables that will be used throughout installation
2023-02-23 02:30:15 +08:00
set_install_vars( ) {
2022-11-05 02:25:01 +08:00
2023-02-23 02:30:15 +08:00
IP_ADDR = $( dig -4 myip.opendns.com @resolver1.opendns.com +short)
if [ " $IP_ADDR " = "" ] ; then
IP_ADDR = $( curl -s ifconfig.me)
fi
2023-06-23 05:03:04 +08:00
if [ " $NETMAKER_BASE_DOMAIN " = "" ] ; then
NETMAKER_BASE_DOMAIN = nm.$( echo $IP_ADDR | tr . -) .nip.io
fi
2023-05-16 19:00:16 +08:00
SERVER_HOST = $IP_ADDR
2023-05-25 21:26:26 +08:00
if test -z " $MASTER_KEY " ; then
MASTER_KEY = $(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
fi
2023-02-23 02:30:15 +08:00
DOMAIN_TYPE = ""
echo "-----------------------------------------------------"
echo "Would you like to use your own domain for netmaker, or an auto-generated domain?"
2023-05-16 19:00:16 +08:00
echo " To use your own domain, add a Wildcard DNS record (e.x: *.netmaker.example.com) pointing to $SERVER_HOST "
2023-04-26 02:19:14 +08:00
echo "IMPORTANT: Due to the high volume of requests, the auto-generated domain has been rate-limited by the certificate provider."
echo "For this reason, we STRONGLY RECOMMEND using your own domain. Using the auto-generated domain may lead to a failed installation due to rate limiting."
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
if [ " $AUTO_BUILD " = "on" ] ; then
2023-05-04 22:22:02 +08:00
DOMAIN_TYPE = "auto"
2023-02-23 02:30:15 +08:00
else
select domain_option in " Auto Generated ( $NETMAKER_BASE_DOMAIN ) " "Custom Domain (e.x: netmaker.example.com)" ; do
2023-05-04 22:22:02 +08:00
case $REPLY in
2023-02-23 02:30:15 +08:00
1)
2023-05-04 22:22:02 +08:00
echo " using $NETMAKER_BASE_DOMAIN for base domain "
DOMAIN_TYPE = "auto"
break
; ;
2023-02-23 02:30:15 +08:00
2)
2023-05-16 19:00:16 +08:00
read -p " Enter Custom Domain (make sure *.domain points to $SERVER_HOST first): " domain
2023-05-04 22:22:02 +08:00
NETMAKER_BASE_DOMAIN = $domain
echo " using $NETMAKER_BASE_DOMAIN "
DOMAIN_TYPE = "custom"
break
; ;
*) echo " invalid option $REPLY " ; ;
esac
2023-02-23 02:30:15 +08:00
done
fi
2022-11-05 02:25:01 +08:00
2023-02-23 02:30:15 +08:00
wait_seconds 2
2023-02-18 00:04:44 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
echo "The following subdomains will be used:"
echo " dashboard. $NETMAKER_BASE_DOMAIN "
echo " api. $NETMAKER_BASE_DOMAIN "
echo " broker. $NETMAKER_BASE_DOMAIN "
2023-05-04 05:15:21 +08:00
echo " turn. $NETMAKER_BASE_DOMAIN "
2023-05-08 20:57:19 +08:00
echo " turnapi. $NETMAKER_BASE_DOMAIN "
2022-11-05 05:10:00 +08:00
2023-02-23 02:30:15 +08:00
if [ " $INSTALL_TYPE " = "ee" ] ; then
echo " prometheus. $NETMAKER_BASE_DOMAIN "
echo " netmaker-exporter. $NETMAKER_BASE_DOMAIN "
echo " grafana. $NETMAKER_BASE_DOMAIN "
fi
2022-11-05 02:25:01 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
2022-07-30 21:55:18 +08:00
2023-02-23 02:30:15 +08:00
if [ [ " $DOMAIN_TYPE " = = "custom" ] ] ; then
2023-05-16 19:00:16 +08:00
echo " before continuing, confirm DNS is configured correctly, with records pointing to $SERVER_HOST "
2023-02-23 02:30:15 +08:00
confirm
fi
2022-07-30 21:55:18 +08:00
2023-02-23 02:30:15 +08:00
wait_seconds 1
2022-11-05 05:10:00 +08:00
2023-02-23 02:30:15 +08:00
if [ " $INSTALL_TYPE " = "ee" ] ; then
2022-11-05 05:10:00 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------"
echo "Provide Details for EE installation:"
2023-07-13 10:53:34 +08:00
echo " 1. Log into https://app.netmaker.io"
echo " 2. follow instructions to get a license at: https://docs.netmaker.io/ee/ee-setup.html"
echo " 3. Retrieve License and Tenant ID"
2023-02-23 02:30:15 +08:00
echo " 4. note email address"
echo "-----------------------------------------------------"
unset LICENSE_KEY
while [ -z " $LICENSE_KEY " ] ; do
read -p "License Key: " LICENSE_KEY
done
2023-07-13 10:53:34 +08:00
unset TENANT_ID
while [ -z ${ TENANT_ID } ] ; do
read -p "Tenant ID: " TENANT_ID
2023-02-23 02:30:15 +08:00
done
fi
2022-11-05 05:10:00 +08:00
2023-02-23 02:30:15 +08:00
unset GET_EMAIL
unset RAND_EMAIL
2023-05-04 22:22:02 +08:00
RAND_EMAIL = " $( echo $RANDOM | md5sum | head -c 16) @email.com "
2023-05-04 23:36:08 +08:00
# suggest the prev email or a random one
2023-05-08 20:57:19 +08:00
EMAIL_SUGGESTED = ${ NM_EMAIL :- $RAND_EMAIL }
2023-02-23 02:30:15 +08:00
if [ -z $AUTO_BUILD ] ; then
2023-05-04 23:36:08 +08:00
read -p " Email Address for Domain Registration (click 'enter' to use $EMAIL_SUGGESTED ): " GET_EMAIL
2023-02-23 02:30:15 +08:00
fi
if [ -z " $GET_EMAIL " ] ; then
2023-05-09 00:18:09 +08:00
EMAIL = " $EMAIL_SUGGESTED "
2023-05-08 20:57:19 +08:00
if [ " $EMAIL " = " $NM_EMAIL " ] ; then
echo "using config email"
else
echo "using rand email"
fi
2023-02-23 02:30:15 +08:00
else
2023-05-04 22:22:02 +08:00
EMAIL = " $GET_EMAIL "
2023-02-23 02:30:15 +08:00
fi
2022-07-30 21:55:18 +08:00
2023-02-23 02:30:15 +08:00
wait_seconds 1
unset GET_MQ_USERNAME
unset GET_MQ_PASSWORD
unset CONFIRM_MQ_PASSWORD
echo "Enter Credentials For MQ..."
if [ -z $AUTO_BUILD ] ; then
read -p "MQ Username (click 'enter' to use 'netmaker'): " GET_MQ_USERNAME
fi
if [ -z " $GET_MQ_USERNAME " ] ; then
2023-05-04 22:22:02 +08:00
echo "using default username for mq"
MQ_USERNAME = "netmaker"
2023-02-23 02:30:15 +08:00
else
2023-05-04 22:22:02 +08:00
MQ_USERNAME = " $GET_MQ_USERNAME "
2023-02-23 02:30:15 +08:00
fi
2023-02-07 23:34:30 +08:00
2023-05-25 21:26:26 +08:00
if test -z " $MQ_PASSWORD " ; then
MQ_PASSWORD = $(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
fi
2022-07-30 21:55:18 +08:00
2023-05-04 22:22:02 +08:00
if [ -z $AUTO_BUILD ] ; then
2023-05-25 21:26:26 +08:00
select domain_option in "Auto Generated / Config Password" "Input Your Own Password" ; do
2023-02-23 02:30:15 +08:00
case $REPLY in
1)
2023-05-04 22:22:02 +08:00
echo "using random password for mq"
break
; ;
2023-02-23 02:30:15 +08:00
2)
2023-05-04 22:22:02 +08:00
while true; do
echo "Enter your Password For MQ: "
read -s GET_MQ_PASSWORD
echo "Enter your password again to confirm: "
read -s CONFIRM_MQ_PASSWORD
if [ ${ GET_MQ_PASSWORD } != ${ CONFIRM_MQ_PASSWORD } ] ; then
echo "wrong password entered, try again..."
continue
fi
MQ_PASSWORD = " $GET_MQ_PASSWORD "
echo "MQ Password Saved Successfully!!"
break
done
2023-02-23 02:30:15 +08:00
break
2023-05-04 22:22:02 +08:00
; ;
*) echo " invalid option $REPLY " ; ;
esac
2023-02-23 02:30:15 +08:00
done
fi
2022-07-30 21:55:18 +08:00
2023-05-04 05:15:21 +08:00
unset GET_TURN_USERNAME
unset GET_TURN_PASSWORD
unset CONFIRM_TURN_PASSWORD
echo "Enter Credentials For TURN..."
if [ -z $AUTO_BUILD ] ; then
read -p "TURN Username (click 'enter' to use 'netmaker'): " GET_TURN_USERNAME
fi
if [ -z " $GET_TURN_USERNAME " ] ; then
2023-05-08 20:57:19 +08:00
echo "using default username for TURN"
2023-05-08 16:52:36 +08:00
TURN_USERNAME = "netmaker"
2023-05-04 05:15:21 +08:00
else
2023-05-08 16:52:36 +08:00
TURN_USERNAME = " $GET_TURN_USERNAME "
2023-05-04 05:15:21 +08:00
fi
2023-05-25 21:26:26 +08:00
if test -z " $TURN_PASSWORD " ; then
TURN_PASSWORD = $(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
echo ''
)
fi
2023-05-04 05:15:21 +08:00
2023-05-08 15:29:39 +08:00
if [ -z $AUTO_BUILD ] ; then
2023-05-25 21:26:26 +08:00
select domain_option in "Auto Generated / Config Password" "Input Your Own Password" ; do
2023-05-04 05:15:21 +08:00
case $REPLY in
1)
2023-05-08 20:57:19 +08:00
echo "using random password for turn"
break
; ;
2023-05-04 05:15:21 +08:00
2)
2023-05-08 16:52:36 +08:00
while true; do
2023-05-08 20:57:19 +08:00
echo "Enter your Password For TURN: "
read -s GET_TURN_PASSWORD
echo "Enter your password again to confirm: "
read -s CONFIRM_TURN_PASSWORD
if [ ${ GET_TURN_PASSWORD } != ${ CONFIRM_TURN_PASSWORD } ] ; then
echo "wrong password entered, try again..."
continue
fi
TURN_PASSWORD = " $GET_TURN_PASSWORD "
echo "TURN Password Saved Successfully!!"
break
done
2023-05-04 05:15:21 +08:00
break
2023-05-08 20:57:19 +08:00
; ;
*) echo " invalid option $REPLY " ; ;
esac
2023-05-04 05:15:21 +08:00
done
fi
2023-02-23 02:30:15 +08:00
wait_seconds 2
2022-08-04 23:31:20 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------------------"
echo " SETUP ARGUMENTS"
echo "-----------------------------------------------------------------"
echo " domain: $NETMAKER_BASE_DOMAIN "
echo " email: $EMAIL "
2023-05-16 19:00:16 +08:00
echo " public ip: $SERVER_HOST "
2023-02-23 02:30:15 +08:00
if [ " $INSTALL_TYPE " = "ee" ] ; then
echo " license: $LICENSE_KEY "
2023-07-13 10:53:34 +08:00
echo " account id: $TENANT_ID "
2023-02-23 02:30:15 +08:00
fi
echo "-----------------------------------------------------------------"
echo "Confirm Settings for Installation"
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
2022-08-04 23:31:20 +08:00
2023-05-16 19:00:16 +08:00
if [ ! " $BUILD_TYPE " = "local" ] ; then
IMAGE_TAG = " $LATEST "
fi
2022-08-04 23:31:20 +08:00
2023-05-16 19:00:16 +08:00
confirm
2023-02-23 02:30:15 +08:00
}
2022-11-05 05:10:00 +08:00
2023-02-24 07:49:30 +08:00
# install_netmaker - sets the config files and starts docker-compose
2023-02-23 02:30:15 +08:00
install_netmaker( ) {
2023-02-17 04:17:59 +08:00
2023-02-23 02:30:15 +08:00
echo "-----------------------------------------------------------------"
echo "Beginning installation..."
echo "-----------------------------------------------------------------"
2022-11-05 05:10:00 +08:00
2023-02-23 02:30:15 +08:00
wait_seconds 3
2023-02-17 12:21:24 +08:00
2023-02-23 02:30:15 +08:00
echo "Pulling config files..."
2023-02-17 12:21:24 +08:00
2023-05-16 19:00:16 +08:00
if [ " $BUILD_TYPE " = "local" ] ; then
local_install_setup
else
local BASE_URL = " https://raw.githubusercontent.com/gravitl/netmaker/ $BUILD_TAG "
2023-05-09 00:18:09 +08:00
2023-05-16 19:00:16 +08:00
local COMPOSE_URL = " $BASE_URL /compose/docker-compose.yml "
local CADDY_URL = " $BASE_URL /docker/Caddyfile "
if [ " $INSTALL_TYPE " = "ee" ] ; then
local COMPOSE_OVERRIDE_URL = " $BASE_URL /compose/docker-compose.ee.yml "
local CADDY_URL = " $BASE_URL /docker/Caddyfile-EE "
fi
wget -qO " $SCRIPT_DIR " /docker-compose.yml $COMPOSE_URL
if test -n " $COMPOSE_OVERRIDE_URL " ; then
wget -qO " $SCRIPT_DIR " /docker-compose.override.yml $COMPOSE_OVERRIDE_URL
fi
wget -qO " $SCRIPT_DIR " /Caddyfile " $CADDY_URL "
2023-05-25 21:26:26 +08:00
wget -qO " $SCRIPT_DIR " /netmaker.default.env " $BASE_URL /scripts/netmaker.default.env "
2023-05-16 19:00:16 +08:00
wget -qO " $SCRIPT_DIR " /mosquitto.conf " $BASE_URL /docker/mosquitto.conf "
wget -qO " $SCRIPT_DIR " /nm-certs.sh " $BASE_URL /scripts/nm-certs.sh "
wget -qO " $SCRIPT_DIR " /wait.sh " $BASE_URL /docker/wait.sh "
2023-02-23 02:30:15 +08:00
fi
2022-07-30 21:55:18 +08:00
2023-05-16 19:00:16 +08:00
chmod +x " $SCRIPT_DIR " /wait.sh
2023-02-23 02:30:15 +08:00
mkdir -p /etc/netmaker
2022-07-30 21:55:18 +08:00
2023-05-25 21:26:26 +08:00
# link .env to the user config
ln -fs " $SCRIPT_DIR /netmaker.env " " $SCRIPT_DIR /.env "
2023-05-16 19:00:16 +08:00
save_config
2023-02-23 02:30:15 +08:00
2023-05-16 19:00:16 +08:00
# Fetch / update certs using certbot
2023-05-19 04:51:26 +08:00
chmod +x " $SCRIPT_DIR " /nm-certs.sh
2023-05-16 19:00:16 +08:00
" $SCRIPT_DIR " /nm-certs.sh
2023-02-23 02:30:15 +08:00
echo "Starting containers..."
2023-05-05 23:17:39 +08:00
# increase the timeouts
export DOCKER_CLIENT_TIMEOUT = 120
export COMPOSE_HTTP_TIMEOUT = 120
# start docker and rebuild containers / networks
2023-05-16 19:00:16 +08:00
docker-compose -f " $SCRIPT_DIR " /docker-compose.yml up -d --force-recreate
2023-02-23 02:30:15 +08:00
wait_seconds 2
}
2022-07-30 21:55:18 +08:00
2023-02-24 07:49:30 +08:00
# test_connection - tests to make sure Caddy has proper SSL certs
2022-07-30 21:55:18 +08:00
test_connection( ) {
2023-02-23 02:30:15 +08:00
echo "Testing Caddy setup (please be patient, this may take 1-2 minutes)"
2023-05-04 22:22:02 +08:00
for i in 1 2 3 4 5 6 7 8; do
curlresponse = $( curl -vIs https://api.${ NETMAKER_BASE_DOMAIN } 2>& 1)
if [ [ " $i " = = 8 ] ] ; then
echo " Caddy is having an issue setting up certificates, please investigate (docker logs caddy)"
echo " Exiting..."
exit 1
elif [ [ " $curlresponse " = = *"failed to verify the legitimacy of the server" * ] ] ; then
echo " Certificates not yet configured, retrying..."
elif [ [ " $curlresponse " = = *"left intact" * ] ] ; then
echo " Certificates ok"
break
else
secs = $(( $i * 5 + 10 ))
echo " Issue establishing connection...retrying in $secs seconds... "
fi
sleep $secs
2023-02-23 02:30:15 +08:00
done
2022-07-30 21:55:18 +08:00
}
2023-02-24 07:49:30 +08:00
# setup_mesh - sets up a default mesh network on the server
2023-02-23 02:30:15 +08:00
setup_mesh( ) {
wait_seconds 5
2022-07-30 21:55:18 +08:00
2023-05-16 19:00:16 +08:00
local networkCount = $( nmctl network list -o json | jq '. | length' )
2022-11-05 02:25:01 +08:00
2023-05-16 19:00:16 +08:00
# add a network if none present
if [ " $networkCount " -lt 1 ] ; then
echo "Creating netmaker network (10.101.0.0/16)"
2022-11-05 02:25:01 +08:00
2023-05-16 19:00:16 +08:00
# TODO causes "Error Status: 400 Response: {"Code":400,"Message":"could not find any records"}"
nmctl network create --name netmaker --ipv4_addr 10.101.0.0/16
wait_seconds 5
fi
2022-07-30 21:55:18 +08:00
2023-05-16 19:00:16 +08:00
echo "Obtaining a netmaker enrollment key..."
2022-07-30 21:55:18 +08:00
2023-05-16 19:00:16 +08:00
local tokenJson = $( nmctl enrollment_key create --unlimited --networks netmaker)
2023-05-04 22:22:02 +08:00
TOKEN = $( jq -r '.token' <<< ${ tokenJson } )
2023-05-16 19:00:16 +08:00
if test -z " $TOKEN " ; then
echo "Error creating an enrollment key"
exit 1
else
echo "Enrollment key ready"
fi
2022-07-30 21:55:18 +08:00
2023-02-23 02:30:15 +08:00
wait_seconds 3
2022-07-30 21:55:18 +08:00
2023-02-23 02:30:15 +08:00
}
2022-07-30 21:55:18 +08:00
2023-02-24 07:49:30 +08:00
# print_success - prints a success message upon completion
2023-02-23 02:30:15 +08:00
print_success( ) {
echo "-----------------------------------------------------------------"
echo "-----------------------------------------------------------------"
echo "Netmaker setup is now complete. You are ready to begin using Netmaker."
echo " Visit dashboard. $NETMAKER_BASE_DOMAIN to log in "
echo "-----------------------------------------------------------------"
echo "-----------------------------------------------------------------"
}
2022-07-30 21:55:18 +08:00
2023-05-16 19:00:16 +08:00
cleanup( ) {
# remove the existing netclient's instance from the existing network
if command -v nmctl >/dev/null 2>& 1; then
local node_id = $( netclient list | jq '.[0].node_id' 2>/dev/null)
# trim doublequotes
node_id = " ${ node_id // \" / } "
if test -n " $node_id " ; then
echo "De-registering the existing netclient..."
nmctl node delete netmaker $node_id >/dev/null 2>& 1
fi
fi
echo "Stopping all containers..."
local containers = ( "mq" "netmaker-ui" "coredns" "turn" "caddy" "netmaker" "netmaker-exporter" "prometheus" "grafana" )
for name in " ${ containers [@] } " ; do
local running = $( docker ps | grep -w " $name " )
local exists = $( docker ps -a | grep -w " $name " )
if test -n " $running " ; then
docker stop " $name " 1>/dev/null
fi
if test -n " $exists " ; then
docker rm " $name " 1>/dev/null
fi
done
}
2023-02-24 07:49:30 +08:00
# 1. print netmaker logo
print_logo
2023-02-23 02:30:15 +08:00
2023-05-25 21:26:26 +08:00
# read the config
if [ -f " $CONFIG_PATH " ] ; then
echo " Using config: $CONFIG_PATH "
source " $CONFIG_PATH "
2023-07-13 10:54:25 +08:00
if [ " $UPGRADE_FLAG " = "yes" ] ; then
INSTALL_TYPE = "ee"
fi
2023-05-25 21:26:26 +08:00
fi
2023-02-24 07:49:30 +08:00
# 2. setup the build instructions
2023-02-23 02:30:15 +08:00
set_buildinfo
2023-02-24 07:49:30 +08:00
set +e
2023-02-23 02:30:15 +08:00
2023-02-24 07:49:30 +08:00
# 3. install necessary packages
2023-02-23 02:30:15 +08:00
install_dependencies
2023-02-24 07:49:30 +08:00
# 4. install yq if necessary
install_yq
2023-02-23 02:30:15 +08:00
set -e
2023-02-24 07:49:30 +08:00
# 6. get user input for variables
2023-02-23 02:30:15 +08:00
set_install_vars
2023-05-16 19:00:16 +08:00
set +e
cleanup
set -e
2023-05-09 00:18:09 +08:00
2023-05-10 23:27:53 +08:00
# 7. get and set config files, startup docker-compose
install_netmaker
2022-07-30 21:55:18 +08:00
set +e
2023-02-24 07:49:30 +08:00
# 8. make sure Caddy certs are working
2022-07-30 21:55:18 +08:00
test_connection
2023-02-24 07:49:30 +08:00
# 9. install the netmaker CLI
2023-02-23 02:30:15 +08:00
setup_nmctl
2022-07-30 21:55:18 +08:00
2023-02-24 07:49:30 +08:00
# 10. create a default mesh network for netmaker
2022-11-05 02:25:01 +08:00
setup_mesh
2022-07-30 21:55:18 +08:00
2023-02-24 07:49:30 +08:00
set -e
# 11. add netclient to docker-compose and start it up
2023-02-23 02:30:15 +08:00
setup_netclient
2023-02-24 07:49:30 +08:00
# 12. make the netclient a default host and ingress gw
2023-02-23 02:30:15 +08:00
configure_netclient
2023-02-24 07:49:30 +08:00
# 13. print success message
2023-02-23 02:30:15 +08:00
print_success
2022-07-30 21:55:18 +08:00
# cp -f /etc/skel/.bashrc /root/.bashrc