From 45d0dd4ca329efb560906dbe274476fa8143395b Mon Sep 17 00:00:00 2001 From: afeiszli Date: Tue, 14 Feb 2023 16:45:48 -0500 Subject: [PATCH] saving work --- compose/docker-compose.ee.yml | 2 +- scripts/nm-quick-interactive.sh | 37 ++++++++++++++++++++---- scripts/updateNetmaker.sh | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 7 deletions(-) mode change 100644 => 100755 scripts/nm-quick-interactive.sh create mode 100644 scripts/updateNetmaker.sh diff --git a/compose/docker-compose.ee.yml b/compose/docker-compose.ee.yml index 3264bb1f..6aa7226f 100644 --- a/compose/docker-compose.ee.yml +++ b/compose/docker-compose.ee.yml @@ -26,8 +26,8 @@ services: MQ_HOST: "mq" MQ_PORT: "443" MQ_SERVER_PORT: "1883" - MQ_PASSWORD: "REPLACE_MQ_PASSWORD" MQ_USERNAME: "REPLACE_MQ_USERNAME" + MQ_PASSWORD: "REPLACE_MQ_PASSWORD" STUN_PORT: "3478" VERBOSITY: "1" METRICS_EXPORTER: "on" diff --git a/scripts/nm-quick-interactive.sh b/scripts/nm-quick-interactive.sh old mode 100644 new mode 100755 index baa9e875..387a5f2e --- a/scripts/nm-quick-interactive.sh +++ b/scripts/nm-quick-interactive.sh @@ -72,6 +72,31 @@ confirm() {( done )} +if [[ ! -z "$2" ]]; then + INSTALL_BRANCH=$2 +else + INSTALL_BRANCH="master" +fi +echo "-----------------------------------------------------" +echo "Install Branch: $INSTALL_BRANCH" +echo "-----------------------------------------------------" +confirm + +branch_install_setup() {( + rm -rf netmaker-tmp + mkdir netmaker-tmp + cd netmaker-tmp + git clone https://www.github.com/gravitl/netmaker + cd netmaker + git checkout $INSTALL_BRANCH + git pull origin $INSTALL_BRANCH + docker build --no-cache --build-arg version=$INSTALL_BRANCH -t gravitl/netmaker:$INSTALL_BRANCH . + cd ../../ + rm -rf netmaker-tmp +)} + +branch_install_setup + echo "checking dependencies..." OS=$(uname) @@ -335,15 +360,15 @@ wait_seconds 3 echo "Pulling config files..." -COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/master/compose/docker-compose.yml" -CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/master/docker/Caddyfile" +COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/compose/docker-compose.yml" +CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/docker/Caddyfile" if [ "$INSTALL_TYPE" = "ee" ]; then - COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/master/compose/docker-compose.ee.yml" - CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/master/docker/Caddyfile-EE" + COMPOSE_URL="https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/compose/docker-compose.ee.yml" + CADDY_URL="https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/docker/Caddyfile-EE" fi -wget -O /root/docker-compose.yml $COMPOSE_URL && wget -O /root/mosquitto.conf https://raw.githubusercontent.com/gravitl/netmaker/master/docker/mosquitto.conf && wget -O /root/Caddyfile $CADDY_URL -wget -O /root/wait.sh https://raw.githubusercontent.com/gravitl/netmaker/master/docker/wait.sh +wget -O /root/docker-compose.yml $COMPOSE_URL && wget -O /root/mosquitto.conf https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/docker/mosquitto.conf && wget -O /root/Caddyfile $CADDY_URL +wget -O /root/wait.sh https://raw.githubusercontent.com/gravitl/netmaker/$INSTALL_BRANCH/docker/wait.sh chmod +x /root/wait.sh mkdir -p /etc/netmaker diff --git a/scripts/updateNetmaker.sh b/scripts/updateNetmaker.sh new file mode 100644 index 00000000..1e7842cb --- /dev/null +++ b/scripts/updateNetmaker.sh @@ -0,0 +1,51 @@ +#! /bin/sh +if (($# < 3)) +then + echo "you should have three arguments. netmaker branch, netmaker-ui branch, and version" + exit +elif (($# > 3)) +then + echo "you should have three arguments. netmaker branch, netmaker-ui branch, and version" + exit +else + echo "pulling netmaker branch $1, netmaker-ui branch $2, and version will be $3." +fi +docker images +#docker images -a | grep theguy | awk '{ print $3; }' | xargs docker rmi --force +docker images -a | grep none | awk '{ print $3; }' | xargs docker rmi --force +docker images -a | grep alpine | awk '{ print $3; }' | xargs docker rmi --force +docker images -a | grep gravitl | awk '{ print $3; }' | xargs docker rmi --force +docker images -a | grep nginx | awk '{ print $3; }' | xargs docker rmi --force +docker images -a | grep node | awk '{ print $3; }' | xargs docker rmi --force +docker images +git clone https://www.github.com/gravitl/netmaker +git clone https://www.github.com/gravitl/netmaker-ui +cd netmaker +git checkout $1 +git pull origin $1 +go mod tidy +wait +docker build --no-cache --build-arg version=$3 -t gravitl/netmaker:testing . +wait +docker push gravitl/netmaker:testing +wait +docker build --no-cache --build-arg version=$3 -t gravitl/netmaker:testing-ee --build-arg tags="ee" . +wait +docker push gravitl/netmaker:testing-ee +wait +echo "netmaker and netmaker enterprise updated with version $3, built and pushed" +cd +cd netmaker-ui +git checkout $2 +git pull origin $2 +go mod tidy +wait +docker build --no-cache -t gravitl/netmaker-ui:testing . +wait +docker push gravitl/netmaker-ui:testing +wait +echo "netmaker-ui updated, built, and pushed." +cd +rm -rf netmaker +rm -rf netmaker-ui +