Browse Source

Merge branch 'develop' into story/GRA-1252

Alex Feiszli 2 years ago
parent
commit
ac6a5d912f

+ 15 - 0
.github/pull_request_template.md

@@ -0,0 +1,15 @@
+## Describe your changes
+
+## Provide Issue ticket number if applicable/not in title
+
+## Provide testing steps
+
+## Checklist before requesting a review
+- [ ] My changes affect only 10 files or less.
+- [ ] I have performed a self-review of my code and tested it.
+- [ ] If it is a new feature, I have added thorough tests, my code is <= 1450 lines.
+- [ ] If it is a bugfix, my code is <= 200 lines.
+- [ ] My functions are <= 80 lines.
+- [ ] I have had my code reviewed by a peer.
+- [ ] My unit tests pass locally.
+- [ ] Netmaker is awesome.

+ 0 - 3
config/config.go

@@ -42,7 +42,6 @@ type ServerConfig struct {
 	AllowedOrigin         string `yaml:"allowedorigin"`
 	NodeID                string `yaml:"nodeid"`
 	RestBackend           string `yaml:"restbackend"`
-	AgentBackend          string `yaml:"agentbackend"`
 	MessageQueueBackend   string `yaml:"messagequeuebackend"`
 	DNSMode               string `yaml:"dnsmode"`
 	DisableRemoteIPCheck  string `yaml:"disableremoteipcheck"`
@@ -50,9 +49,7 @@ type ServerConfig struct {
 	SQLConn               string `yaml:"sqlconn"`
 	Platform              string `yaml:"platform"`
 	Database              string `yaml:"database"`
-	DefaultNodeLimit      int32  `yaml:"defaultnodelimit"`
 	Verbosity             int32  `yaml:"verbosity"`
-	ServerCheckinInterval int64  `yaml:"servercheckininterval"`
 	AuthProvider          string `yaml:"authprovider"`
 	OIDCIssuer            string `yaml:"oidcissuer"`
 	ClientID              string `yaml:"clientid"`

+ 0 - 1
config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: "" # defaults to 'secretkey' or MASTER_KEY (if set)
   allowedorigin: "" # defaults to '*' or CORS_ALLOWED_ORIGIN (if set)
   restbackend: "" # defaults to "on" or REST_BACKEND (if set)
-  agentbackend: "" # defaults to "on" or AGENT_BACKEND (if set)
   dnsmode: "" # defaults to "on" or DNS_MODE (if set)
   sqlconn: "" # defaults to "http://" or SQL_CONN (if set)
   disableremoteipcheck: "" # defaults to "false" or DISABLE_REMOTE_IP_CHECK (if set)

+ 1 - 2
controllers/config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: ""
   allowedorigin: "*"
   restbackend: true            
-  agentbackend: true
   defaultnetname: "default"
   defaultnetrange: "10.10.10.0/24"
-  createdefault: true
+  createdefault: true

+ 0 - 7
dev.yaml

@@ -3,17 +3,12 @@ server:
   apiconn: "api.ping.clustercat.com:443"
   apihost: ""
   apiport: "8081"
-  grpcconn: "grpc.ping.clustercat.com:443"
-  grpchost: ""
-  grpcport: "50051"
-  grpcsecure: "on"
   mqhost: "localhost"
   masterkey: "secretkey"
   dnskey: ""
   allowedorigin: "*"
   nodeid: "netmaker"
   restbackend: "on"
-  agentbackend: "on"
   messagequeuebackend: "on"
   dnsmode: "on"
   disableremoteipcheck: ""
@@ -22,9 +17,7 @@ server:
   sqlconn: ""
   platform: ""
   database: "sqlite"
-  defaultnodelimit: ""
   verbosity: 3
-  servercheckininterval: ""
   authprovider: ""
   clientid: ""
   clientsecret: ""

+ 2 - 1
docker/Caddyfile-EE

@@ -1,5 +1,6 @@
 {
-        # LetsEncrypt account
+        # ZeroSSL account
+        acme_ca https://acme.zerossl.com/v2/DV90
         email YOUR_EMAIL
 }
 

+ 2 - 2
main.go

@@ -136,8 +136,8 @@ func startControllers() {
 		go runMessageQueue(&waitnetwork)
 	}
 
-	if !servercfg.IsAgentBackend() && !servercfg.IsRestBackend() && !servercfg.IsMessageQueueBackend() {
-		logger.Log(0, "No Server Mode selected, so nothing is being served! Set Agent mode (AGENT_BACKEND) or Rest mode (REST_BACKEND) or MessageQueue (MESSAGEQUEUE_BACKEND) to 'true'.")
+	if !servercfg.IsRestBackend() && !servercfg.IsMessageQueueBackend() {
+		logger.Log(0, "No Server Mode selected, so nothing is being served! Set Rest mode (REST_BACKEND) or MessageQueue (MESSAGEQUEUE_BACKEND) to 'true'.")
 	}
 
 	// starts the stun server

+ 1 - 1
scripts/nm-quick.sh

@@ -24,7 +24,7 @@ usage () {
     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 "examples:"
-	echo "          nm-quick.sh -e -b version -t v0.18.0"
+	echo "          nm-quick.sh -e -b version -t v0.18.1"
 	echo "          nm-quick.sh -e -b local -t feature_v0.17.2_newfeature"	
 	echo "          nm-quick.sh -e -b branch -t develop"
     exit 1

+ 3 - 3
scripts/nm-upgrade.sh

@@ -202,7 +202,7 @@ collect_server_settings() {
 
   STUN_NAME="stun.$SERVER_NAME"
   echo "-----------------------------------------------------"
-  echo "Netmaker v0.18.0 requires a new DNS entry for $STUN_NAME."
+  echo "Netmaker v0.18.1 requires a new DNS entry for $STUN_NAME."
   echo "Please confirm this is added to your DNS provider before continuing"
   echo "(note: this is not required if using an nip.io address)"
   echo "-----------------------------------------------------"
@@ -260,7 +260,7 @@ set_compose() {
   sed -i "s/v0.17.1/testing/g" /root/docker-compose.yml
 
   # RELEASE_REPLACE - Use this once release is ready
-  #sed -i "s/v0.17.1/v0.18.0/g" /root/docker-compose.yml
+  #sed -i "s/v0.17.1/v0.18.1/g" /root/docker-compose.yml
   yq ".services.netmaker.environment.SERVER_NAME = \"$SERVER_NAME\"" -i /root/docker-compose.yml
   yq ".services.netmaker.environment += {\"BROKER_NAME\": \"$BROKER_NAME\"}" -i /root/docker-compose.yml  
   yq ".services.netmaker.environment += {\"STUN_NAME\": \"$STUN_NAME\"}" -i /root/docker-compose.yml  
@@ -462,7 +462,7 @@ join_networks() {
 cat << "EOF"
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
-The Netmaker Upgrade Script: Upgrading to v0.18.0 so you don't have to!
+The Netmaker Upgrade Script: Upgrading to v0.18.1 so you don't have to!
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 EOF

+ 2 - 55
servercfg/serverconf.go

@@ -46,10 +46,6 @@ func GetServerConfig() config.ServerConfig {
 	if IsRestBackend() {
 		cfg.RestBackend = "on"
 	}
-	cfg.AgentBackend = "off"
-	if IsAgentBackend() {
-		cfg.AgentBackend = "on"
-	}
 	cfg.DNSMode = "off"
 	if IsDNSMode() {
 		cfg.DNSMode = "on"
@@ -167,15 +163,6 @@ func GetAPIHost() string {
 	return serverhost
 }
 
-// GetPodIP - get the pod's ip
-func GetPodIP() string {
-	podip := "127.0.0.1"
-	if os.Getenv("POD_IP") != "" {
-		podip = os.Getenv("POD_IP")
-	}
-	return podip
-}
-
 // GetAPIPort - gets the api port
 func GetAPIPort() string {
 	apiport := "8081"
@@ -198,19 +185,6 @@ func GetStunAddr() string {
 	return stunAddr
 }
 
-// GetDefaultNodeLimit - get node limit if one is set
-func GetDefaultNodeLimit() int32 {
-	var limit int32
-	limit = 999999999
-	envlimit, err := strconv.Atoi(os.Getenv("DEFAULT_NODE_LIMIT"))
-	if err == nil && envlimit != 0 {
-		limit = int32(envlimit)
-	} else if config.Config.Server.DefaultNodeLimit != 0 {
-		limit = config.Config.Server.DefaultNodeLimit
-	}
-	return limit
-}
-
 // GetCoreDNSAddr - gets the core dns address
 func GetCoreDNSAddr() string {
 	addr, _ := GetPublicIP()
@@ -313,21 +287,6 @@ func IsMetricsExporter() bool {
 	return export
 }
 
-// IsAgentBackend - checks if agent backed is on or off
-func IsAgentBackend() bool {
-	isagent := true
-	if os.Getenv("AGENT_BACKEND") != "" {
-		if os.Getenv("AGENT_BACKEND") == "off" {
-			isagent = false
-		}
-	} else if config.Config.Server.AgentBackend != "" {
-		if config.Config.Server.AgentBackend == "off" {
-			isagent = false
-		}
-	}
-	return isagent
-}
-
 // IsMessageQueueBackend - checks if message queue is on or off
 func IsMessageQueueBackend() bool {
 	ismessagequeue := true
@@ -487,7 +446,7 @@ func GetPlatform() string {
 	if os.Getenv("PLATFORM") != "" {
 		platform = os.Getenv("PLATFORM")
 	} else if config.Config.Server.Platform != "" {
-		platform = config.Config.Server.SQLConn
+		platform = config.Config.Server.Platform
 	}
 	return platform
 }
@@ -525,18 +484,6 @@ func SetNodeID(id string) {
 	config.Config.Server.NodeID = id
 }
 
-// GetServerCheckinInterval - gets the server check-in time
-func GetServerCheckinInterval() int64 {
-	var t = int64(5)
-	var envt, _ = strconv.Atoi(os.Getenv("SERVER_CHECKIN_INTERVAL"))
-	if envt > 0 {
-		t = int64(envt)
-	} else if config.Config.Server.ServerCheckinInterval > 0 {
-		t = config.Config.Server.ServerCheckinInterval
-	}
-	return t
-}
-
 // GetAuthProviderInfo = gets the oauth provider info
 func GetAuthProviderInfo() (pi []string) {
 	var authProvider = ""
@@ -637,7 +584,7 @@ func GetLicenseKey() string {
 func GetNetmakerAccountID() string {
 	netmakerAccountID := os.Getenv("NETMAKER_ACCOUNT_ID")
 	if netmakerAccountID == "" {
-		netmakerAccountID = config.Config.Server.LicenseValue
+		netmakerAccountID = config.Config.Server.NetmakerAccountID
 	}
 	return netmakerAccountID
 }

+ 1 - 9
swagger.yaml

@@ -565,8 +565,6 @@ definitions:
                 type: string
             APIPort:
                 type: string
-            AgentBackend:
-                type: string
             AllowedOrigin:
                 type: string
             AuthProvider:
@@ -585,9 +583,6 @@ definitions:
                 type: string
             Database:
                 type: string
-            DefaultNodeLimit:
-                format: int32
-                type: integer
             DisableRemoteIPCheck:
                 type: string
             DisplayKeys:
@@ -624,9 +619,6 @@ definitions:
                 type: string
             Server:
                 type: string
-            ServerCheckinInterval:
-                format: int64
-                type: integer
             Telemetry:
                 type: string
             Verbosity:
@@ -718,7 +710,7 @@ info:
 
         API calls must be authenticated via a header of the format -H “Authorization: Bearer <YOUR_SECRET_KEY>” There are two methods to obtain YOUR_SECRET_KEY: 1. Using the masterkey. By default, this value is “secret key,” but you should change this on your instance and keep it secure. This value can be set via env var at startup or in a config file (config/environments/< env >.yaml). See the [Netmaker](https://docs.netmaker.org/index.html) documentation for more details. 2. Using a JWT received for a node. This can be retrieved by calling the /api/nodes/<network>/authenticate endpoint, as documented below.
     title: Netmaker
-    version: 0.18.0
+    version: 0.18.1
 paths:
     /api/dns:
         get:

+ 0 - 1
test/config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: "secretkey"
   allowedorigin: "*"
   restbackend: true            
-  agentbackend: true
 mongoconn:
   user: "mongoadmin"
   pass: "mongopass"