Skip to content
Snippets Groups Projects
Commit 8980b50e authored by Jono Wenger's avatar Jono Wenger Committed by Jake Taylor
Browse files

Update YAML Flags

parent adadcb18
No related branches found
No related tags found
1 merge request!9Release
......@@ -111,23 +111,23 @@ useGPU: true
# Level of debugging to print (0 = info, 1 = debug, >1 = trace). (Default info)
logLevel: 1
node:
cmix:
paths:
# Path where an error file will be placed in the event of a fatal error.
# This path is used by the Wrapper Script. (Required)
errOutput: "/opt/xxnetwork/node-logs/node-err.log"
errOutput: "/opt/xxnetwork/log/cmix-err.log"
# Path to where the identity file (IDF) is saved. The IDF stores the Node's
# network identity. This is used by the wrapper management script. (Required)
idf: "/opt/xxnetwork/node-logs/nodeIDF.json"
# Path to the self-signed TLS certificate for Node. Expects PEM format.
idf: "/opt/xxnetwork/cred/cmix-IDF.json"
# Path to the self-signed TLS certificate for cMix. Expects PEM format.
# (Required)
cert: "/opt/xxnetwork/creds/node_cert.crt"
cert: "/opt/xxnetwork/cred/cmix-cert.crt"
# Path to the private key associated with the self-signed TLS certificate.
# (Required)
key: "/opt/xxnetwork/creds/node_key.key"
# Path where log file will be saved. (Default "./node.log")
log: "/opt/xxnetwork/node-logs/node.log"
# Port that the Node will communicate on. (Required)
key: "/opt/xxnetwork/cred/cmix-key.key"
# Path where log file will be saved. (Default "log/cmix.log")
log: "/opt/xxnetwork/log/cmix.log"
# Port that cMix will communicate on. (Required)
port: 11420
# Local IP address of the Node, used for internal listening. Expects an IPv4
# address without a port. (default "0.0.0.0")
......@@ -148,24 +148,24 @@ database:
username: "cmix"
password: ""
# Information to communicate with this Node's Gateway.
# Information to communicate with the Gateway.
gateway:
paths:
# Path to the self-signed TLS certificate for Gateway. Expects PEM format.
# (Required)
cert: "/opt/xxnetwork/creds/gateway_cert.crt"
cert: "/opt/xxnetwork/cred/gateway-cert.crt"
permissioning:
scheduling:
paths:
# Path to the self-signed TLS certificate for the Permissioning server.
# Path to the self-signed TLS certificate for the Scheduling server.
# Expects PEM format. (Required)
cert: "/opt/xxnetwork/creds/permissioning_cert.crt"
# IP Address of the Permissioning server, provided by xx network. (Required)
cert: "/opt/xxnetwork/cred/scheduling-cert.crt"
# IP Address of the Scheduling server, provided by xx network. (Required)
address: ""
metrics:
# Path to store metrics logs.
log: "/opt/xxnetwork/node-logs/metrics.log"
log: "/opt/xxnetwork/log/metrics.log"
```
## Project Structure
......
......@@ -49,7 +49,7 @@ type Params struct {
Node Node
Database Database
Gateway Gateway
Permissioning Permissioning
Permissioning Permissioning `yaml:"scheduling"`
Metrics Metrics
GraphGen GraphGen
......@@ -77,13 +77,15 @@ func NewParams(vip *viper.Viper) (*Params, error) {
params.RegistrationCode = vip.GetString("registrationCode")
params.Node.Port = vip.GetInt("node.Port")
vip.RegisterAlias("node.port", "cmix.port")
params.Node.Port = vip.GetInt("cmix.port")
if params.Node.Port == 0 {
jww.FATAL.Panic("Must specify a port to run on")
}
// Get server's public IP address or use the override IP, if set
overridePublicIP := vip.GetString("node.overridePublicIP")
vip.RegisterAlias("node.overridePublicIP", "cmix.overridePublicIP")
overridePublicIP := vip.GetString("cmix.overridePublicIP")
params.Node.PublicAddress, err = publicAddress.GetIpOverride(overridePublicIP, params.Node.Port)
if err != nil {
jww.FATAL.Panicf("Failed to get public override IP \"%s\": %+v",
......@@ -91,40 +93,50 @@ func NewParams(vip *viper.Viper) (*Params, error) {
}
// Construct listening address; defaults to 0.0.0.0 if not set
listeningIP := vip.GetString("node.listeningAddress")
vip.RegisterAlias("node.listeningAddress", "cmix.listeningAddress")
listeningIP := vip.GetString("cmix.listeningAddress")
if listeningIP == "" {
listeningIP = "0.0.0.0"
}
params.Node.ListeningAddress = net.JoinHostPort(listeningIP, strconv.Itoa(params.Node.Port))
// Construct server's override internal IP address, if set
overrideInternalIP := vip.GetString("node.overrideInternalIP")
vip.RegisterAlias("node.overrideInternalIP", "cmix.overrideInternalIP")
overrideInternalIP := vip.GetString("cmix.overrideInternalIP")
params.OverrideInternalIP, err = publicAddress.JoinIpPort(overrideInternalIP, params.Node.Port)
if err != nil {
jww.FATAL.Panicf("Failed to get public override IP \"%s\": %+v",
overrideInternalIP, err)
}
params.Node.InterconnectPort = vip.GetInt("node.interconnectPort")
vip.RegisterAlias("node.interconnectPort", "cmix.interconnectPort")
params.Node.InterconnectPort = vip.GetInt("cmix.interconnectPort")
params.Node.Paths.Idf = vip.GetString("node.paths.idf")
require(params.Node.Paths.Idf, "node.paths.idf")
vip.RegisterAlias("node.paths.idf", "cmix.paths.idf")
params.Node.Paths.Idf = vip.GetString("cmix.paths.idf")
require(params.Node.Paths.Idf, "cmix.paths.idf")
params.Node.Paths.Cert = vip.GetString("node.paths.cert")
require(params.Node.Paths.Cert, "node.paths.cert")
vip.RegisterAlias("node.paths.cert", "cmix.paths.cert")
params.Node.Paths.Cert = vip.GetString("cmix.paths.cert")
require(params.Node.Paths.Cert, "cmix.paths.cert")
params.Node.Paths.Key = vip.GetString("node.paths.key")
require(params.Node.Paths.Key, "node.paths.key")
vip.RegisterAlias("node.paths.key", "cmix.paths.key")
params.Node.Paths.Key = vip.GetString("cmix.paths.key")
require(params.Node.Paths.Key, "cmix.paths.key")
params.Node.Paths.Log = vip.GetString("node.paths.log")
vip.RegisterAlias("node.paths.log", "cmix.paths.log")
params.Node.Paths.Log = vip.GetString("cmix.paths.log")
if params.Node.Paths.Log == "" {
params.Node.Paths.Log = "./node.log"
params.Node.Paths.Log = "log/cmix.log"
}
params.RecoveredErrPath = vip.GetString("node.paths.errOutput")
require(params.RecoveredErrPath, "node.paths.errOutput")
vip.RegisterAlias("node.paths.errOutput", "cmix.paths.errOutput")
params.RecoveredErrPath = vip.GetString("cmix.paths.errOutput")
require(params.RecoveredErrPath, "cmix.paths.errOutput")
// If no path was supplied, then use the default
params.Node.Paths.ipListOutput = vip.GetString("node.paths.ipListOutput")
vip.RegisterAlias("node.paths.ipListOutput", "cmix.paths.ipListOutput")
params.Node.Paths.ipListOutput = vip.GetString("cmix.paths.ipListOutput")
if params.Node.Paths.ipListOutput == "" {
params.Node.Paths.ipListOutput = defaultIpListPath
}
......@@ -147,11 +159,13 @@ func NewParams(vip *viper.Viper) (*Params, error) {
params.Gateway.Paths.Cert = vip.GetString("gateway.paths.cert")
require(params.Gateway.Paths.Cert, "gateway.paths.cert")
params.Permissioning.Paths.Cert = vip.GetString("permissioning.paths.cert")
require(params.Permissioning.Paths.Cert, "permissioning.paths.cert")
vip.RegisterAlias("permissioning.paths.cert", "scheduling.paths.cert")
params.Permissioning.Paths.Cert = vip.GetString("scheduling.paths.cert")
require(params.Permissioning.Paths.Cert, "scheduling.paths.cert")
params.Permissioning.Address = vip.GetString("permissioning.address")
require(params.Permissioning.Address, "permissioning.address")
vip.RegisterAlias("permissioning.address", "scheduling.address")
params.Permissioning.Address = vip.GetString("scheduling.address")
require(params.Permissioning.Address, "scheduling.address")
params.GraphGen.defaultNumTh = uint8(vip.GetUint("graphgen.defaultNumTh"))
if params.GraphGen.defaultNumTh == 0 {
......
......@@ -2,7 +2,7 @@
# Example yaml params file used for testing
# the params object and its dependencies
registrationCode: "123abc"
node:
cmix:
paths:
idf: "nodeID.json"
cert: "~/.elixxir/cert.crt"
......@@ -22,7 +22,7 @@ gateway:
paths:
cert: "~/.elixxir/gateway.crt"
address: "127.0.0.1:80"
permissioning:
scheduling:
paths:
cert: "~/.elixxir/permissioning.crt"
address: "127.0.0.1:80"
......
......@@ -37,7 +37,8 @@ func TestPermissioning_UnmarshallingFileEqualsExpected(t *testing.T) {
}
if !reflect.DeepEqual(ExpectedPermissioning, actual.Permissioning) {
t.Errorf("Permissioning object did not match expected value")
t.Errorf("Permissioning object did not match expected value."+
"\nexpected: %+v\nreceived: %+v", ExpectedPermissioning, actual.Permissioning)
}
}
......@@ -35,7 +35,7 @@ import (
func StartServer(vip *viper.Viper) (*internal.Instance, error) {
vip.Debug()
jww.INFO.Printf("Log Filename: %v\n", vip.GetString("node.paths.log"))
jww.INFO.Printf("Log Filename: %v\n", vip.GetString("cmix.paths.log"))
jww.INFO.Printf("Config Filename: %v\n", vip.ConfigFileUsed())
//Set the max number of processes
......
......@@ -257,9 +257,9 @@ func initLog() {
jww.SetStdoutThreshold(jww.LevelInfo)
}
if viper.Get("node.paths.log") != nil {
if viper.Get("cmix.paths.log") != nil {
// Create log file, overwrites if existing
logPath = viper.GetString("node.paths.log")
logPath = viper.GetString("cmix.paths.log")
} else {
fmt.Printf("Invalid or missing log path %s, "+
"default path used.\n", logPath)
......
##
# Node Configuration File
# cMix Configuration File
##
# Registration code used for first time registration. This is a unique code
# provided by xx network. (Required)
registrationCode: "[your registration code]"
# Toggles use of the GPU. (Default true)
useGPU: true
# Level of debugging to print (0 = info, 1 = debug, >1 = trace). (Default info)
logLevel: 0
node:
cmix:
paths:
# Path where an error file will be placed in the event of a fatal error.
# This path is used by the Wrapper Script. (Required)
errOutput: "/opt/xxnetwork/node-logs/node-err.log"
errOutput: "/opt/xxnetwork/log/cmix-err.log"
# Path to where the identity file (IDF) is saved. The IDF stores the Node's
# network identity. This is used by the wrapper management script. (Required)
idf: "/opt/xxnetwork/node-logs/nodeIDF.json"
# Path to the self-signed TLS certificate for Node. Expects PEM format.
idf: "/opt/xxnetwork/cred/cmix-IDF.json"
# Path to the self-signed TLS certificate for cMix. Expects PEM format.
# (Required)
cert: "/opt/xxnetwork/creds/node_cert.crt"
cert: "/opt/xxnetwork/cred/cmix-cert.crt"
# Path to the private key associated with the self-signed TLS certificate.
# (Required)
key: "/opt/xxnetwork/creds/node_key.key"
# Path where log file will be saved. (Default "./node.log")
log: "/opt/xxnetwork/node-logs/node.log"
# Port that the Node will communicate on. (Required)
key: "/opt/xxnetwork/cred/cmix-key.key"
# Path where log file will be saved. (Default "log/cmix.log")
log: "/opt/xxnetwork/log/cmix.log"
# Port that cMix will communicate on. (Required)
port: 11420
# Local IP address of the Node, used for internal listening. Expects an IPv4
# address without a port. (default "0.0.0.0")
......@@ -52,21 +48,21 @@ database:
username: "cmix"
password: "[password for database]"
# Information to communicate with this Node's Gateway.
# Information to communicate with the Gateway.
gateway:
paths:
# Path to the self-signed TLS certificate for Gateway. Expects PEM format.
# (Required)
cert: "/opt/xxnetwork/creds/gateway_cert.crt"
cert: "/opt/xxnetwork/cred/gateway-cert.crt"
permissioning:
scheduling:
paths:
# Path to the self-signed TLS certificate for the Permissioning server.
# Path to the self-signed TLS certificate for the Scheduling server.
# Expects PEM format. (Required)
cert: "/opt/xxnetwork/creds/permissioning_cert.crt"
# IP Address of the Permissioning server, provided by xx network. (Required)
cert: "/opt/xxnetwork/cred/scheduling-cert.crt"
# IP Address of the Scheduling server, provided by xx network. (Required)
address: "permissioning.prod.cmix.rip:11420"
metrics:
# Path to store metrics logs.
log: "/opt/xxnetwork/node-logs/metrics.log"
\ No newline at end of file
log: "/opt/xxnetwork/log/metrics.log"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment