mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
user BROKER_ENDPOINT and SERVER_BROKER_ENDPOINT
This commit is contained in:
parent
6f8f9ec5ef
commit
2700acc1d7
|
@ -9,7 +9,7 @@ services:
|
|||
- dnsconfig:/root/config/dnsconfig
|
||||
- sqldata:/root/data
|
||||
environment:
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN"
|
||||
BROKER_ENDPOINT: "wss://broker.NETMAKER_BASE_DOMAIN/mqtt"
|
||||
BROKER_TYPE: "emqx"
|
||||
EMQX_REST_ENDPOINT: "http://mq:18083"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
|
@ -25,8 +25,7 @@ services:
|
|||
DISPLAY_KEYS: "on"
|
||||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
BROKER_ENDPOINT: "ws://mq:8083/mqtt"
|
||||
MQ_PORT: "443"
|
||||
SERVER_BROKER_ENDPOINT: "ws://mq:8083/mqtt"
|
||||
STUN_PORT: "3478"
|
||||
VERBOSITY: "1"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
|
|
|
@ -9,7 +9,7 @@ services:
|
|||
- dnsconfig:/root/config/dnsconfig
|
||||
- sqldata:/root/data
|
||||
environment:
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN"
|
||||
BROKER_ENDPOINT: "wss://broker.NETMAKER_BASE_DOMAIN/mqtt"
|
||||
BROKER_TYPE: "emqx"
|
||||
EMQX_REST_ENDPOINT: "http://mq:18083"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
|
@ -25,8 +25,7 @@ services:
|
|||
DISPLAY_KEYS: "on"
|
||||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
BROKER_ENDPOINT: "ws://mq:8083/mqtt"
|
||||
MQ_PORT: "443"
|
||||
SERVER_BROKER_ENDPOINT: "ws://mq:8083/mqtt"
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
STUN_PORT: "3478"
|
||||
|
@ -112,8 +111,7 @@ services:
|
|||
depends_on:
|
||||
- netmaker
|
||||
environment:
|
||||
BROKER_ENDPOINT: "mq"
|
||||
MQ_PORT: "443"
|
||||
SERVER_BROKER_ENDPOINT: "mq"
|
||||
MQ_SERVER_PORT: "1883"
|
||||
PROMETHEUS: "on"
|
||||
VERBOSITY: "1"
|
||||
|
|
|
@ -10,7 +10,7 @@ services:
|
|||
- sqldata:/root/data
|
||||
- shared_certs:/etc/netmaker
|
||||
environment: # Necessary capabilities to set iptables when running in container
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN" # The domain/host IP indicating the mq broker address
|
||||
BROKER_ENDPOINT: "wss://broker.NETMAKER_BASE_DOMAIN" # The domain/host IP indicating the mq broker address
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN" # The base domain of netmaker
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP" # Set to public IP of machine.
|
||||
SERVER_HTTP_HOST: "api.NETMAKER_BASE_DOMAIN" # Overrides SERVER_HOST if set. Useful for making HTTP available via different interfaces/networks.
|
||||
|
@ -26,8 +26,7 @@ services:
|
|||
DISPLAY_KEYS: "on" # Show keys permanently in UI (until deleted) as opposed to 1-time display.
|
||||
DATABASE: "sqlite" # Database to use - sqlite, postgres, or rqlite
|
||||
NODE_ID: "netmaker-server-1" # used for HA - identifies this server vs other servers
|
||||
BROKER_ENDPOINT: ""ws://mq:1883"" # the address of the mq server. If running from docker compose it will be "mq". Otherwise, need to input address. If using "host networking", it will find and detect the IP of the mq container.
|
||||
MQ_PORT: "443" # the reachable port of MQ - change if external MQ port changes (port on proxy, not necessarily the one exposed in docker-compose)
|
||||
SERVER_BROKER_ENDPOINT: ""ws://mq:1883"" # the address of the mq server. If running from docker compose it will be "mq". Otherwise, need to input address. If using "host networking", it will find and detect the IP of the mq container.
|
||||
MQ_USERNAME: "REPLACE_MQ_USERNAME" # the username to set for MQ access
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD" # the password to set for MQ access
|
||||
STUN_PORT: "3478" # the reachable port of STUN on the server
|
||||
|
|
|
@ -9,7 +9,7 @@ services:
|
|||
- dnsconfig:/root/config/dnsconfig
|
||||
- sqldata:/root/data
|
||||
environment:
|
||||
BROKER_NAME: "broker.NETMAKER_BASE_DOMAIN"
|
||||
BROKER_ENDPOINT: "wss://broker.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_NAME: "NETMAKER_BASE_DOMAIN"
|
||||
STUN_DOMAIN: "stun.NETMAKER_BASE_DOMAIN"
|
||||
SERVER_HOST: "SERVER_PUBLIC_IP"
|
||||
|
@ -23,8 +23,7 @@ services:
|
|||
DISPLAY_KEYS: "on"
|
||||
DATABASE: "sqlite"
|
||||
NODE_ID: "netmaker-server-1"
|
||||
BROKER_ENDPOINT: "ws://mq:1883"
|
||||
MQ_PORT: "443"
|
||||
SERVER_BROKER_ENDPOINT: "ws://mq:1883"
|
||||
STUN_PORT: "3478"
|
||||
VERBOSITY: "1"
|
||||
MQ_PASSWORD: "REPLACE_MQ_PASSWORD"
|
||||
|
|
|
@ -36,7 +36,8 @@ type ServerConfig struct {
|
|||
APIConnString string `yaml:"apiconn"`
|
||||
APIHost string `yaml:"apihost"`
|
||||
APIPort string `yaml:"apiport"`
|
||||
MQHOST string `yaml:"mqhost"`
|
||||
BrokerEndpoint string `yaml:"brokerendpoint"`
|
||||
ServerBrokerEndpoint string `yaml:"serverbrokerendpoint"`
|
||||
BrokerType string `yaml:"brokertype"`
|
||||
EmqxRestEndpoint string `yaml:"emqxrestendpoint"`
|
||||
MasterKey string `yaml:"masterkey"`
|
||||
|
@ -64,8 +65,6 @@ type ServerConfig struct {
|
|||
AzureTenant string `yaml:"azuretenant"`
|
||||
Telemetry string `yaml:"telemetry"`
|
||||
HostNetwork string `yaml:"hostnetwork"`
|
||||
MQPort string `yaml:"mqport"`
|
||||
MQServerPort string `yaml:"mqserverport"`
|
||||
Server string `yaml:"server"`
|
||||
Broker string `yam:"broker"`
|
||||
PublicIPService string `yaml:"publicipservice"`
|
||||
|
|
|
@ -71,12 +71,8 @@ spec:
|
|||
value: REPLACE_MASTER_KEY
|
||||
- name: CORS_ALLOWED_ORIGIN
|
||||
value: '*'
|
||||
- name: MQ_HOST
|
||||
value: "mq"
|
||||
- name: MQ_PORT
|
||||
value: "443"
|
||||
- name: MQ_SERVER_PORT
|
||||
value: "1883"
|
||||
- name: SERVER_BROKER_ENDPOINT
|
||||
value: "ws://mq:1883"
|
||||
- name: PLATFORM
|
||||
value: "Kubernetes"
|
||||
- name: VERBOSITY
|
||||
|
|
|
@ -38,7 +38,6 @@ func GetServerConfig() config.ServerConfig {
|
|||
cfg.CoreDNSAddr = GetCoreDNSAddr()
|
||||
cfg.APIHost = GetAPIHost()
|
||||
cfg.APIPort = GetAPIPort()
|
||||
cfg.MQPort = GetMQPort()
|
||||
cfg.MasterKey = "(hidden)"
|
||||
cfg.DNSKey = "(hidden)"
|
||||
cfg.AllowedOrigin = GetAllowedOrigin()
|
||||
|
@ -92,13 +91,11 @@ func GetServerConfig() config.ServerConfig {
|
|||
func GetServerInfo() models.ServerConfig {
|
||||
var cfg models.ServerConfig
|
||||
cfg.Server = GetServer()
|
||||
cfg.Broker = GetBroker()
|
||||
cfg.MQUserName = GetMqUserName()
|
||||
cfg.MQPassword = GetMqPassword()
|
||||
cfg.API = GetAPIConnString()
|
||||
cfg.CoreDNSAddr = GetCoreDNSAddr()
|
||||
cfg.APIPort = GetAPIPort()
|
||||
cfg.MQPort = GetMQPort()
|
||||
cfg.DNSMode = "off"
|
||||
if IsDNSMode() {
|
||||
cfg.DNSMode = "on"
|
||||
|
@ -227,24 +224,17 @@ func GetCoreDNSAddr() string {
|
|||
return addr
|
||||
}
|
||||
|
||||
// GetMQPort - gets the mq port
|
||||
func GetMQPort() string {
|
||||
port := "8883" //default
|
||||
if os.Getenv("MQ_PORT") != "" {
|
||||
port = os.Getenv("MQ_PORT")
|
||||
} else if config.Config.Server.MQPort != "" {
|
||||
port = config.Config.Server.MQPort
|
||||
}
|
||||
return port
|
||||
}
|
||||
|
||||
// GetMessageQueueEndpoint - gets the message queue endpoint
|
||||
func GetMessageQueueEndpoint() (string, bool) {
|
||||
host, _ := GetPublicIP()
|
||||
if os.Getenv("BROKER_ENDPOINT") != "" {
|
||||
if os.Getenv("SERVER_BROKER_ENDPOINT") != "" {
|
||||
host = os.Getenv("SERVER_BROKER_ENDPOINT")
|
||||
} else if config.Config.Server.ServerBrokerEndpoint != "" {
|
||||
host = config.Config.Server.ServerBrokerEndpoint
|
||||
} else if os.Getenv("BROKER_ENDPOINT") != "" {
|
||||
host = os.Getenv("BROKER_ENDPOINT")
|
||||
} else if config.Config.Server.MQHOST != "" {
|
||||
host = config.Config.Server.MQHOST
|
||||
} else if config.Config.Server.BrokerEndpoint != "" {
|
||||
host = config.Config.Server.BrokerEndpoint
|
||||
} else {
|
||||
host += ":1883" // default
|
||||
}
|
||||
|
@ -376,17 +366,6 @@ func GetServer() string {
|
|||
return server
|
||||
}
|
||||
|
||||
// GetBroker - gets the broker name
|
||||
func GetBroker() string {
|
||||
server := ""
|
||||
if os.Getenv("BROKER_NAME") != "" {
|
||||
server = os.Getenv("BROKER_NAME")
|
||||
} else if config.Config.Server.Broker != "" {
|
||||
server = config.Config.Server.Broker
|
||||
}
|
||||
return server
|
||||
}
|
||||
|
||||
func GetVerbosity() int32 {
|
||||
var verbosity = 0
|
||||
var err error
|
||||
|
|
Loading…
Reference in a new issue