Bug fixes and improvements
+ Add a function to the Tools package to provide the local IP address and port + Add a function to the Tools package to provide a time as formated string as yyyyMMdd hhmmss.fff + Improved the ICCC startup message: Now, the message contains the IP address and port of the stared server + Add a new configuration to specific the necessary Ocean servers' port (internally, not the public port) + The template package reports now which version out of the grid FS is used. + The Ocean server is now bound to the correct IP address and port (rule: the local IP address!) + The order of the system shutdown handlers were wrong! + The early ICCC messages problem is now fixed! + Fixed an ICCC bug for the case, that a message does not have any payload! + Also the configuration database uses now the correct mgo MongoDB rules (SetSafe & SetMode)
This commit is contained in:
1 parent
7120a729bd
commit
a007db1b79
16 files changed
+145
-26
No files matched your search
+4
-1
@@ -1,8 +1,11 @@
|
||||
package System
|
||||
|
||||
import "github.com/SommerEngineering/Ocean/ICCC"
|
||||
import "github.com/SommerEngineering/Ocean/Log"
|
||||
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
|
||||
func icccSystemStart(data map[string][]string) {
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `The system is now up and ready.`)
|
||||
_, _, obj := ICCC.Data2Message(&ICCCStartUpMessage{}, data)
|
||||
messageData := obj.(*ICCCStartUpMessage)
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `ICCC message: The server is now up and ready.`, messageData.IPAddressAndPort)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package System
|
||||
|
||||
type ICCCStartUpMessage struct {
|
||||
IPAddressAndPort string
|
||||
}
|
||||
+6
-2
@@ -84,13 +84,17 @@ func initSystem() {
|
||||
// * then, these system handlers are called (order: last comed, first served)
|
||||
// * and finally, the logging device / system gets closed
|
||||
Shutdown.InitShutdown()
|
||||
Shutdown.AddShutdownHandler(ICCC.ShutdownFunction{})
|
||||
Shutdown.AddShutdownHandler(NumGen.ShutdownFunction{})
|
||||
Shutdown.AddShutdownHandler(ConfigurationDB.ShutdownFunction{})
|
||||
Shutdown.AddShutdownHandler(CustomerDB.ShutdownFunction{})
|
||||
Shutdown.AddShutdownHandler(ICCC.ShutdownFunction{})
|
||||
Shutdown.AddShutdownHandler(NumGen.ShutdownFunction{})
|
||||
|
||||
// The logging subsystem is not registered here, because it will be automated called at the end
|
||||
|
||||
// Register all system ICCC commands:
|
||||
ICCC.Registrar(ICCC.ChannelSYSTEM, `System::Start`, icccSystemStart)
|
||||
|
||||
// Start the ICCC Listener Cache:
|
||||
ICCC.InitCacheNow() // Blocking, until the job is done
|
||||
ICCC.StartCacheTimer()
|
||||
}
|
||||
+8
-6
@@ -1,18 +1,20 @@
|
||||
package System
|
||||
|
||||
import "net/http"
|
||||
import "github.com/SommerEngineering/Ocean/ConfigurationDB"
|
||||
import "github.com/SommerEngineering/Ocean/Tools"
|
||||
import "github.com/SommerEngineering/Ocean/ICCC"
|
||||
import "github.com/SommerEngineering/Ocean/Log"
|
||||
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
|
||||
func StartAndBlockForever() {
|
||||
oceanHostnameAndPort := ConfigurationDB.Read(`OceanHostnameAndPort`)
|
||||
ipAddressPort := Tools.LocalIPAddressAndPort()
|
||||
|
||||
// Init ICCC:
|
||||
ICCC.WriteMessage2All(ICCC.ChannelSYSTEM, `System::Start`, nil)
|
||||
// Tell the whole cluster, that we are up and ready:
|
||||
data := ICCCStartUpMessage{}
|
||||
data.IPAddressAndPort = ipAddressPort
|
||||
ICCC.WriteMessage2All(ICCC.ChannelSYSTEM, `System::Start`, data)
|
||||
|
||||
// Start and block:
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Web server is now listening.`, `Configuration for hostname and port.`, oceanHostnameAndPort)
|
||||
http.ListenAndServe(oceanHostnameAndPort, nil)
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Web server is now listening.`, `Configuration for hostname and port.`, ipAddressPort)
|
||||
http.ListenAndServe(ipAddressPort, nil)
|
||||
}
|
||||
Reference in new issue
Block a user