Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add domain flag to nm-quick #2416

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions scripts/nm-quick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_FILE=netmaker.env
# location of nm-quick.sh (usually `/root`)
SCRIPT_DIR=$(dirname "$(realpath "$0")")
CONFIG_PATH="$SCRIPT_DIR/$CONFIG_FILE"
NM_QUICK_VERSION="0.1.0"
NM_QUICK_VERSION="0.1.1"
LATEST=$(curl -s https://api.github.com/repos/gravitl/netmaker/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d [:space:],\")

if [ $(id -u) -ne 0 ]; then
Expand All @@ -17,26 +17,29 @@ unset BUILD_TYPE
unset BUILD_TAG
unset IMAGE_TAG
unset AUTO_BUILD
unset NETMAKER_BASE_DOMAIN

# usage - displays usage instructions
usage() {
echo "nm-quick.sh v$NM_QUICK_VERSION"
echo "usage: ./nm-quick.sh [-e] [-b buildtype] [-t tag] [-a auto]"
echo "usage: ./nm-quick.sh [-e] [-b buildtype] [-t tag] [-a auto] [-d domain]"
echo " -e if specified, will install netmaker EE"
echo " -b type of build; options:"
echo " \"version\" - will install a specific version of Netmaker using remote git and dockerhub"
echo " \"local\": - will install by cloning repo and building images from git"
echo " \"branch\": - will install a specific branch using remote git and dockerhub"
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"
echo " -d domain; if specified, will use this domain instead of auto-generating one"
echo "examples:"
echo " nm-quick.sh -e -b version -t $LATEST"
echo " nm-quick.sh -e -b local -t feature_v0.17.2_newfeature"
echo " nm-quick.sh -e -b branch -t develop"
echo " nm-quick.sh -e -b version -t $LATEST -a -d example.com"
exit 1
}

while getopts evab:t: flag; do
while getopts evab:d:t: flag; do
case "${flag}" in
e)
INSTALL_TYPE="ee"
Expand All @@ -60,6 +63,9 @@ while getopts evab:t: flag; do
t)
BUILD_TAG=${OPTARG}
;;
d)
NETMAKER_BASE_DOMAIN=${OPTARG}
;;
esac
done

Expand Down Expand Up @@ -490,8 +496,9 @@ set_install_vars() {
if [ "$IP_ADDR" = "" ]; then
IP_ADDR=$(curl -s ifconfig.me)
fi

NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io
if [ "$NETMAKER_BASE_DOMAIN" = "" ]; then
NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io
fi
SERVER_HOST=$IP_ADDR
if test -z "$MASTER_KEY"; then
MASTER_KEY=$(
Expand Down