From c26f887e27c0d5113634450708fef54b2620346a Mon Sep 17 00:00:00 2001 From: afeiszli Date: Wed, 20 Oct 2021 11:06:54 -0400 Subject: [PATCH] updating install script and README --- README.md | 1 + logic/util.go | 8 ++++++-- netclient/functions/join.go | 16 ++++++++++++++- scripts/netclient-install.sh | 38 ++++++++++++++++++++++++++++++++---- 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 23ef1af8..fc09cff2 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ # Get Started in 5 Minutes **For production-grade installations, visit the [Install Docs](https://netmaker.readthedocs.io/en/develop/install.html).** +**For an HA install using helm on k8s, visit the [Helm Repo](https://github.com/gravitl/netmaker-helm/).** 1. Get a cloud VM with Ubuntu 20.04 and a public IP. 2. Open ports 443, 53, and 51821-51830/udp on the VM firewall and in cloud security settings. 3. Run the script: diff --git a/logic/util.go b/logic/util.go index fcd6e5d3..7d188320 100644 --- a/logic/util.go +++ b/logic/util.go @@ -92,8 +92,12 @@ func CreateNode(node models.Node, networkName string) (models.Node, error) { if node.Name == models.NODE_SERVER_NAME { node.IsServer = "yes" } - if servercfg.IsDNSMode() && node.DNSOn == "" { - node.DNSOn = "yes" + if node.DNSOn == "" { + if servercfg.IsDNSMode() { + node.DNSOn = "yes" + } else { + node.DNSOn = "no" + } } node.SetDefaults() node.Address, err = functions.UniqueAddress(networkName) diff --git a/netclient/functions/join.go b/netclient/functions/join.go index 3207d8b2..f483a74b 100644 --- a/netclient/functions/join.go +++ b/netclient/functions/join.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" "log" - + "os/exec" nodepb "github.com/gravitl/netmaker/grpc" "github.com/gravitl/netmaker/models" "github.com/gravitl/netmaker/netclient/auth" @@ -81,6 +81,20 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error { cfg.Node.MacAddress = macs[0] } } + if ncutils.IsLinux() { + log.Println("deleteme looking for resolvectl") + path, err := exec.LookPath("resolvectl") + if err != nil { + log.Println("deleteme whoops its not there") + ncutils.PrintLog("resolvectl not present",2) + ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management",2) + cfg.Node.DNSOn = "no" + } else { + log.Println("nice we gucci") + log.Println("path -->", path) + } + } + // differentiate between client/server here var node models.Node // fill this node with appropriate calls diff --git a/scripts/netclient-install.sh b/scripts/netclient-install.sh index c59bc6c7..3d307e35 100755 --- a/scripts/netclient-install.sh +++ b/scripts/netclient-install.sh @@ -1,14 +1,44 @@ -#!/bin/sh +#!/bin/bash set -e -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" +if [ "$EUID" -ne 0 ]; then + echo "This script must be run as root" exit 1 fi [ -z "$KEY" ] && KEY=nokey; +[ -z "$VERSION" ] && echo "no \$VERSION provided, fallback to latest" && VERSION=latest; -wget -O netclient https://github.com/gravitl/netmaker/releases/download/latest/netclient +dist=netclient + +echo "OS Version = $OSTYPE" +echo "Netclient Version = $VERSION" + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + arch=$(uname -i) + echo "CPU ARCH = $arch" + if [ "$arch" == 'x86_64' ]; + then + dist=netclient + fi + if [ "$arch" == 'x86_32' ]; + then + dist=netclient-32 + fi + if [ "$arch" == 'armv*' ]; + then + dist=netclient-arm64 + fi +elif [[ "$OSTYPE" == "darwin"* ]]; then + dist=netclient-darwin +else + echo "This OS is not currently supported via automated install" + exit 1 +fi + +echo "Binary = $dist" + +wget -O netclient https://github.com/gravitl/netmaker/releases/download/$VERSION/netclient chmod +x netclient sudo ./netclient join -t $KEY rm -f netclient