Kernel Deployment Examples - aionnetwork/aion GitHub Wiki
Version 0.3.2 of the kernel allows deployment with different networks and at different locations.
This tutorial walks through a few examples of deployment.
Unpack the binary and go to the resulting directory:
tar vxf aion-v0.3.2.*.tar.bz2
cd aion
The contents of the aion directory should include:
aion_gui.sh
aion.sh
config
jars
native
rt
script
web-console
Start the kernel by running:
./aion.sh
The output will show among other information:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/mainnet/log
> Database path: /home/user/path/aion/mainnet/database
> Keystore path: /home/user/path/aion/mainnet/keystore
> Config write: /home/user/path/aion/mainnet/config/config.xml
> Genesis write: /home/user/path/aion/mainnet/config/genesis.json
> Fork write: /home/user/path/aion/mainnet/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/config/mainnet/config.xml
> Genesis read: /home/user/path/aion/config/mainnet/genesis.json
> Fork read: /home/user/path/aion/config/mainnet/fork.properties
----------------------------------------------------------------------------
18-11-29 16:54:46.346 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mainnet
18-11-29 16:54:46.505 INFO GEN [main]: DB is empty - adding Genesis
18-11-29 16:54:46.526 INFO GEN [main]: loaded genesis block <num=0, root=5da1a018279c49c80218deda5d33ff7be73a9c10008f9376d7867c07fd4da700>
18-11-29 16:54:46.777 INFO GEN [main]: <node-started endpoint=p2p://[NODE_ID]@[IP]:[PORT]>
18-11-29 16:54:48.918 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = 28375c, number = 1, txs = 0, result = IMPORTED_BEST, time elapsed = 14 ms>
Upon examining the new contents of the aion directory notice that a new directory called mainnet was created. This is where all the data for the node you are running is stored.
This directory contains the following:
config database keystore log
The mainnet/config directory is mentioned in the log above and contains the configuration used for execution.
Comparing the initial (read) configuration to the execution (written) configuration with the command:
diff config/mainnet/config.xml mainnet/config/config.xml
you should note the following difference in the <id>.
The initial default configuration has a [NODE-ID-PLACEHOLDER] for the id while the execution configuration has a specific id.
When shutting down the kernel, all the data for the execution persists in the mainnet directory created by the first execution. So, when running the kernel again, you will note that the used paths for the initial (read) configuration are the same as those for the execution (written) configuration. For example a second execution log would look like:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/mainnet/log
> Database path: /home/user/path/aion/mainnet/database
> Keystore path: /home/user/path/aion/mainnet/keystore
> Config write: /home/user/path/aion/mainnet/config/config.xml
> Genesis write: /home/user/path/aion/mainnet/config/genesis.json
> Fork write: /home/user/path/aion/mainnet/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/mainnet/config/config.xml
> Genesis read: /home/user/path/aion/mainnet/config/genesis.json
> Fork read: /home/user/path/aion/mainnet/config/fork.properties
----------------------------------------------------------------------------
18-11-29 17:10:29.415 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mainnet
18-11-29 17:10:29.585 INFO GEN [main]: loaded block <num=24, root=2c0448b8... l=32>
18-11-29 17:10:29.846 INFO GEN [main]: <node-started endpoint=p2p://[NODE_ID]@[IP]:[PORT]>
18-11-29 17:10:29.850 INFO CONS [main]: <sealing-disabled>
18-11-29 17:10:32.006 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = b65f9b, number = 21, txs = 0, result = EXIST, time elapsed = 1 ms>
18-11-29 17:10:32.006 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = c9ccdd, number = 22, txs = 0, result = EXIST, time elapsed = 0 ms>
18-11-29 17:10:32.007 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = ba5702, number = 23, txs = 0, result = EXIST, time elapsed = 1 ms>
18-11-29 17:10:32.007 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = 5f71e5, number = 24, txs = 0, result = EXIST, time elapsed = 0 ms>
18-11-29 17:10:32.035 INFO SYNC [sync-ib]: <import-status: node = c33d10, hash = ee3435, number = 25, txs = 0, result = IMPORTED_BEST, time elapsed = 28 ms>
Note that in your execution the NODE_ID will be the same as for your first run, again showing that the configuration is read from the mainnet directory.
Running a node on a different network can be done from the same aion directory as the one used above.
To run the kernel on the mastery network by execute:
./aion.sh -n mastery
The output will show among other information:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/mastery/log
> Database path: /home/user/path/aion/mastery/database
> Keystore path: /home/user/path/aion/mastery/keystore
> Config write: /home/user/path/aion/mastery/config/config.xml
> Genesis write: /home/user/path/aion/mastery/config/genesis.json
> Fork write: /home/user/path/aion/mastery/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/config/mastery/config.xml
> Genesis read: /home/user/path/aion/config/mastery/genesis.json
> Fork read: /home/user/path/aion/config/mastery/fork.properties
----------------------------------------------------------------------------
18-11-29 17:20:36.684 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mastery
18-11-29 17:20:36.846 INFO GEN [main]: DB is empty - adding Genesis
18-11-29 17:20:36.867 INFO GEN [main]: loaded genesis block <num=0, root=657ba48b3f07e36289ce0d55c328db399e675ef21c9113ecf6e700122247ab68>
Note that the execution paths differ from the run using ./aion.sh. Note also that the network used is listed in the log under the AION logo. Further, upon examining the contents of the aion directory after the first execution you will find that a new directory called mastery was created. This is where all the data for the node you are running is stored.
The path where to store the execution data for a node running on any valid network can also be specified from the command line at execution. For example to run the kernel on the mastery network and store the data in a new directory quick_test can be done by running:
./aion.sh -n mastery -d quick_test
The output will show among other information:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/quick_test/mastery/log
> Database path: /home/user/path/aion/quick_test/mastery/database
> Keystore path: /home/user/path/aion/quick_test/mastery/keystore
> Config write: /home/user/path/aion/quick_test/mastery/config/config.xml
> Genesis write: /home/user/path/aion/quick_test/mastery/config/genesis.json
> Fork write: /home/user/path/aion/quick_test/mastery/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/config/mastery/config.xml
> Genesis read: /home/user/path/aion/config/mastery/genesis.json
> Fork read: /home/user/path/aion/config/mastery/fork.properties
----------------------------------------------------------------------------
18-11-29 17:31:34.944 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mastery
18-11-29 17:31:35.340 INFO GEN [main]: DB is empty - adding Genesis
Note that the execution paths are now quick_test/mastery and that the quick_test directory has been created for you.
If we wish to run a node on the default mainnet network inside the same quick_test directory we can execute the command:
./aion.sh -d quick_test
which will print out:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/quick_test/mainnet/log
> Database path: /home/user/path/aion/quick_test/mainnet/database
> Keystore path: /home/user/path/aion/quick_test/mainnet/keystore
> Config write: /home/user/path/aion/quick_test/mainnet/config/config.xml
> Genesis write: /home/user/path/aion/quick_test/mainnet/config/genesis.json
> Fork write: /home/user/path/aion/quick_test/mainnet/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/config/mainnet/config.xml
> Genesis read: /home/user/path/aion/config/mainnet/genesis.json
> Fork read: /home/user/path/aion/config/mainnet/fork.properties
----------------------------------------------------------------------------
18-11-29 17:34:25.796 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mainnet
18-11-29 17:34:25.950 INFO GEN [main]: DB is empty - adding Genesis
and create the mainnet directory inside quick_test.
For kernel versions 0.3.1 and older, the location of the configuration file was inside aion/config/config.xml for all the release binaries, regardless of the network they were set up for.
As part of the new version 0.3.2 release, we have set up automatic migration of the old configurations as described below.
First unpack the new 0.3.2 release on top of the old kernel folder you used to run.
The aion/config directory should now contain the followig:
config.xml
conquest
custom
genesis.json
mainnet
mastery
When running ./aion.sh the kernel will search for the files aion/config/config.xml and aion/config/genesis.json. When finding these files it will trigger a migration of the configuration as follows:
- the file
aion/config/config.xmlis read and matched to a network using the network identifier; if the identifier is not a predefined network, i.e.mainnet,mastery,conquestit will assume it is acustomdefined network; - all the information in
aion/config/config.xmlis copied toaion/config/[network]/config.xmland the fileaion/config/config.xmlis deleted; forcustomnetworks the fileaion/config/genesis.jsonis moved toaion/config/custorm/genesis.json; - inside the updated
aion/config/[network]/config.xmlfile three changes are made:- the
keystoredirectory path is defined using an absolute path pointing to the location used by the old kernel configuration; - the
databasedirectory is set to an absolute path pointing the location used by the old kernel configuration; - the
logdirectory is set to an absolute path pointing the location used by the old kernel configuration;
- the
In this example we assume that the config that was already there was for the mastery network. The output of running ./aion.sh should look similar to:
Migrating to the new configuration style for Aion kernels.
<Protocol name: fork0.3.2 block#: 1132000 updated!
18-11-29 17:54:17.873 INFO GEN [main]:
-------------------------------- USED PATHS --------------------------------
> Logger path: /home/user/path/aion/log
> Database path: /home/user/path/aion/database
> Keystore path: /home/user/path/aion/keystore
> Config write: /home/user/path/aion/mastery/config/config.xml
> Genesis write: /home/user/path/aion/mastery/config/genesis.json
> Fork write: /home/user/path/aion/mastery/config/fork.properties
----------------------------------------------------------------------------
> Config read: /home/user/path/aion/mastery/config/config.xml
> Genesis read: /home/user/path/aion/mastery/config/genesis.json
> Fork read: /home/user/path/aion/mastery/config/fork.properties
----------------------------------------------------------------------------
18-11-29 17:54:17.874 INFO GEN [main]:
_____
.'. | .~ ~. |.. |
.' `. | | | | ``.. |
.''''''''`. | | | | ``.. |
.' `. | `._____.' | ``|
v0.3.2.4da7bb1
mastery
Note that the path to the database, log and keystore are the same as the ones at the old location.
After execution, if you look inside the aion/config directory, you will no longer find the config.xml and genesis.json files. Furthermore, the aion/config/mastery/config.xml and aion/mastery/config/config.xml will be identical and will contain all the settings from the old aion/config/config.xml file. You can note as well that the paths to the database, log and keystore directories are absolute, similar to:
<keystore>/home/user/path/aion/keystore</keystore>
...
<db>
<path>/home/user/path/aion/database</path>
...
</db>
<log-path>/home/user/path/aion/log</log-path>
You can always move these directories to a new location and update the absolute paths in the config.xml files, or make the paths relative to the defined execution path, in this case /home/user/path/aion/mastery/ as used as prefix for the config folder in the log above.
After this migration you can no longer run the kernel for mastery with ./aion.sh. To run the node on mastery you must execute ./aion.sh -n mastery.