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

+ 0 - 1
config/environments/dev.yaml

@@ -4,7 +4,6 @@ server:
   masterkey: "" # defaults to 'secretkey' or MASTER_KEY (if set)
   masterkey: "" # defaults to 'secretkey' or MASTER_KEY (if set)
   allowedorigin: "" # defaults to '*' or CORS_ALLOWED_ORIGIN (if set)
   allowedorigin: "" # defaults to '*' or CORS_ALLOWED_ORIGIN (if set)
   restbackend: "" # defaults to "on" or REST_BACKEND (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)
   dnsmode: "" # defaults to "on" or DNS_MODE (if set)
   sqlconn: "" # defaults to "http://" or SQL_CONN (if set)
   sqlconn: "" # defaults to "http://" or SQL_CONN (if set)
   disableremoteipcheck: "" # defaults to "false" or DISABLE_REMOTE_IP_CHECK (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: ""
   masterkey: ""
   allowedorigin: "*"
   allowedorigin: "*"
   restbackend: true            
   restbackend: true            
-  agentbackend: true
   defaultnetname: "default"
   defaultnetname: "default"
   defaultnetrange: "10.10.10.0/24"
   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"
   apiconn: "api.ping.clustercat.com:443"
   apihost: ""
   apihost: ""
   apiport: "8081"
   apiport: "8081"
-  grpcconn: "grpc.ping.clustercat.com:443"
-  grpchost: ""
-  grpcport: "50051"
-  grpcsecure: "on"
   mqhost: "localhost"
   mqhost: "localhost"
   masterkey: "secretkey"
   masterkey: "secretkey"
   dnskey: ""
   dnskey: ""
   allowedorigin: "*"
   allowedorigin: "*"
   nodeid: "netmaker"
   nodeid: "netmaker"
   restbackend: "on"
   restbackend: "on"
-  agentbackend: "on"
   messagequeuebackend: "on"
   messagequeuebackend: "on"
   dnsmode: "on"
   dnsmode: "on"
   disableremoteipcheck: ""
   disableremoteipcheck: ""
@@ -22,9 +17,7 @@ server:
   sqlconn: ""
   sqlconn: ""
   platform: ""
   platform: ""
   database: "sqlite"
   database: "sqlite"
-  defaultnodelimit: ""
   verbosity: 3
   verbosity: 3
-  servercheckininterval: ""
   authprovider: ""
   authprovider: ""
   clientid: ""
   clientid: ""
   clientsecret: ""
   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
         email YOUR_EMAIL
 }
 }
 
 

+ 2 - 2
main.go

@@ -136,8 +136,8 @@ func startControllers() {
 		go runMessageQueue(&waitnetwork)
 		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
 	// 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 "  -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 "  -a      auto-build; skip prompts and use defaults, if none provided"
     echo "examples:"
     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 local -t feature_v0.17.2_newfeature"	
 	echo "          nm-quick.sh -e -b branch -t develop"
 	echo "          nm-quick.sh -e -b branch -t develop"
     exit 1
     exit 1

+ 3 - 3
scripts/nm-upgrade.sh

@@ -202,7 +202,7 @@ collect_server_settings() {
 
 
   STUN_NAME="stun.$SERVER_NAME"
   STUN_NAME="stun.$SERVER_NAME"
   echo "-----------------------------------------------------"
   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 "Please confirm this is added to your DNS provider before continuing"
   echo "(note: this is not required if using an nip.io address)"
   echo "(note: this is not required if using an nip.io address)"
   echo "-----------------------------------------------------"
   echo "-----------------------------------------------------"
@@ -260,7 +260,7 @@ set_compose() {
   sed -i "s/v0.17.1/testing/g" /root/docker-compose.yml
   sed -i "s/v0.17.1/testing/g" /root/docker-compose.yml
 
 
   # RELEASE_REPLACE - Use this once release is ready
   # 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.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 += {\"BROKER_NAME\": \"$BROKER_NAME\"}" -i /root/docker-compose.yml  
   yq ".services.netmaker.environment += {\"STUN_NAME\": \"$STUN_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"
 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
 EOF

+ 2 - 55
servercfg/serverconf.go

@@ -46,10 +46,6 @@ func GetServerConfig() config.ServerConfig {
 	if IsRestBackend() {
 	if IsRestBackend() {
 		cfg.RestBackend = "on"
 		cfg.RestBackend = "on"
 	}
 	}
-	cfg.AgentBackend = "off"
-	if IsAgentBackend() {
-		cfg.AgentBackend = "on"
-	}
 	cfg.DNSMode = "off"
 	cfg.DNSMode = "off"
 	if IsDNSMode() {
 	if IsDNSMode() {
 		cfg.DNSMode = "on"
 		cfg.DNSMode = "on"
@@ -167,15 +163,6 @@ func GetAPIHost() string {
 	return serverhost
 	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
 // GetAPIPort - gets the api port
 func GetAPIPort() string {
 func GetAPIPort() string {
 	apiport := "8081"
 	apiport := "8081"
@@ -198,19 +185,6 @@ func GetStunAddr() string {
 	return stunAddr
 	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
 // GetCoreDNSAddr - gets the core dns address
 func GetCoreDNSAddr() string {
 func GetCoreDNSAddr() string {
 	addr, _ := GetPublicIP()
 	addr, _ := GetPublicIP()
@@ -313,21 +287,6 @@ func IsMetricsExporter() bool {
 	return export
 	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
 // IsMessageQueueBackend - checks if message queue is on or off
 func IsMessageQueueBackend() bool {
 func IsMessageQueueBackend() bool {
 	ismessagequeue := true
 	ismessagequeue := true
@@ -487,7 +446,7 @@ func GetPlatform() string {
 	if os.Getenv("PLATFORM") != "" {
 	if os.Getenv("PLATFORM") != "" {
 		platform = os.Getenv("PLATFORM")
 		platform = os.Getenv("PLATFORM")
 	} else if config.Config.Server.Platform != "" {
 	} else if config.Config.Server.Platform != "" {
-		platform = config.Config.Server.SQLConn
+		platform = config.Config.Server.Platform
 	}
 	}
 	return platform
 	return platform
 }
 }
@@ -525,18 +484,6 @@ func SetNodeID(id string) {
 	config.Config.Server.NodeID = id
 	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
 // GetAuthProviderInfo = gets the oauth provider info
 func GetAuthProviderInfo() (pi []string) {
 func GetAuthProviderInfo() (pi []string) {
 	var authProvider = ""
 	var authProvider = ""
@@ -637,7 +584,7 @@ func GetLicenseKey() string {
 func GetNetmakerAccountID() string {
 func GetNetmakerAccountID() string {
 	netmakerAccountID := os.Getenv("NETMAKER_ACCOUNT_ID")
 	netmakerAccountID := os.Getenv("NETMAKER_ACCOUNT_ID")
 	if netmakerAccountID == "" {
 	if netmakerAccountID == "" {
-		netmakerAccountID = config.Config.Server.LicenseValue
+		netmakerAccountID = config.Config.Server.NetmakerAccountID
 	}
 	}
 	return netmakerAccountID
 	return netmakerAccountID
 }
 }

+ 1 - 9
swagger.yaml

@@ -565,8 +565,6 @@ definitions:
                 type: string
                 type: string
             APIPort:
             APIPort:
                 type: string
                 type: string
-            AgentBackend:
-                type: string
             AllowedOrigin:
             AllowedOrigin:
                 type: string
                 type: string
             AuthProvider:
             AuthProvider:
@@ -585,9 +583,6 @@ definitions:
                 type: string
                 type: string
             Database:
             Database:
                 type: string
                 type: string
-            DefaultNodeLimit:
-                format: int32
-                type: integer
             DisableRemoteIPCheck:
             DisableRemoteIPCheck:
                 type: string
                 type: string
             DisplayKeys:
             DisplayKeys:
@@ -624,9 +619,6 @@ definitions:
                 type: string
                 type: string
             Server:
             Server:
                 type: string
                 type: string
-            ServerCheckinInterval:
-                format: int64
-                type: integer
             Telemetry:
             Telemetry:
                 type: string
                 type: string
             Verbosity:
             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.
         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
     title: Netmaker
-    version: 0.18.0
+    version: 0.18.1
 paths:
 paths:
     /api/dns:
     /api/dns:
         get:
         get:

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

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