Browse Source

saving work

afeiszli 2 years ago
parent
commit
45d0dd4ca3
3 changed files with 83 additions and 7 deletions
  1. 1 1
      compose/docker-compose.ee.yml
  2. 31 6
      scripts/nm-quick-interactive.sh
  3. 51 0
      scripts/updateNetmaker.sh

+ 1 - 1
compose/docker-compose.ee.yml

@@ -26,8 +26,8 @@ services:
       MQ_HOST: "mq"
       MQ_HOST: "mq"
       MQ_PORT: "443"
       MQ_PORT: "443"
       MQ_SERVER_PORT: "1883"
       MQ_SERVER_PORT: "1883"
-      MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
       MQ_USERNAME: "REPLACE_MQ_USERNAME"
       MQ_USERNAME: "REPLACE_MQ_USERNAME"
+      MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
       STUN_PORT: "3478"
       STUN_PORT: "3478"
       VERBOSITY: "1"
       VERBOSITY: "1"
       METRICS_EXPORTER: "on"
       METRICS_EXPORTER: "on"

+ 31 - 6
scripts/nm-quick-interactive.sh

@@ -72,6 +72,31 @@ confirm() {(
   done
   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..."
 echo "checking dependencies..."
 
 
 OS=$(uname)
 OS=$(uname)
@@ -335,15 +360,15 @@ wait_seconds 3
 
 
 echo "Pulling config files..."
 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
 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
 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
 chmod +x /root/wait.sh
 mkdir -p /etc/netmaker
 mkdir -p /etc/netmaker
 
 

+ 51 - 0
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
+