How to start a node
A node requires some information without which it cannot be executed. Besides the classpath for the kernel JAR file and the libraries this includes:
node.id
(the node ID)config.dir
(directory for configuration files)plugin.dir
(directory for plugins)storage.dir
(directory for storage)segment.id
(the segment ID)type.of.node
(the type of the node)license
(the license code)
All data except the node ID can be taken from the Java preferences, provided that the node has already been executed correctly. However, for a very first launch, we need to provide this data to the Node in a different way. One way is to use configuration files.
Using configuration files
java -cp "/run/lib/*" de.silly sky .nyssr.impl.kernel.CKernel node.id=io config.dir=/run/io/config
The specifications for node.id
and config.dir
are sufficient for the beginning.
In the configuration directory a configuration file can be found, which contains the remaining
information.
The name of the file does not matter.
All files in the directory will be read in.
Each file provides key-value pairs for a preference node.
#nyssr .net preference.node.name=kernel.configuration preference.node.clear.first=false preference.key.overwrite.existing=true # payload node.description=Test 001 log.dir=log plugin.dir=/run/plugins config.name=io node.id=io segment.id=ss storage.dir=/run/io/storage type.of.node=SERVER vendor=silly sky license=06708aeb-ec9b-456d-829e-30c5cfdd6503
Using a Java preference import file
The Java Preferences are hierarchically organized in nodes. The library allows to export and import complete subtrees into an XML file.
You can see a sample file here.
Here is the adapted command line.
java -cp "/run/lib/*" de.silly sky .nyssr.impl.kernel.CKernel node.id=io preference.import=/my-path/io.xml
Using a TCP preference server
A plugin called NY_ConfigurationProviderPlugIn is provided. This plugin has a directory where Java Preference configurations are located in XML format. It starts a TCP server and waits for incoming requests from starting nodes.
Nodes can request a configuration file at startup. They transmit the desired node ID and receive in return the XML file, which is imported by the kernel into the Java Preferences. After that, the node boots normally. Disadvantage: The TCP server must be reachable.
java -cp "/run/lib/*" de.silly sky .nyssr.impl.kernel.CKernel node.id=io preference.tcp=67.38.0.23:18000
If the node has already been executed successfully once
If the node was already running successfully once, no further configurations are necessary. All settings are stored in the system in the Java Preferences. Only the node ID is required.
java -cp "/run/lib/*" de.silly sky .nyssr.impl.kernel.CKernel node.id=io