Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 2.69 KB

a01-running-nis.md

File metadata and controls

88 lines (58 loc) · 2.69 KB

Running your NIS instance

The easiest way to run your own NIS instance might be to use the nem-docker scripts.

How to run

Of course you need docker installed. Depending on the way you have configured docker, you might need to run these commands as root (or equivalently prefixed by sudo).

Clone the repository, get in the repo's directory.

git clone https://github.com/rb2nem/nem-docker.git
cd nem-docker

Then simply run:

    ./boot.sh

The first time you run it you will be prompted for a node name (required) and a boot key (optional, one can be generated). This will generate the required config file and start NIS in the docker container named mynem_container.

To stop the container, issue:

    ./stop.sh

Controlling the processes in the container

Services (NIS, NCC) running in the container are controlled with supervisord. You can easily control them with the script service.sh provided.

To check which services are running, issue the command:

    ./service.sh status

To stop NIS, issue the command:

    ./service.sh stop nis

To start NIS again, issue the command:

    ./service.sh start nis

You can restart NIS in one command:

    ./service.sh restart nis

Tweaking the config

The boot.sh script checks if a file custom-configs/config-user.properties exists when running NIS, and if it doesn't, it prompts the user for information. It then generates the file with a bootName and a bootKey. If you want to tweak the config of your node, this is the file to edit.

After the config file generation, the script builds and runs the image with these commands, naming the container mynem_container:

    sudo docker build -t mynem_image  .
    sudo docker run --name mynem_container -v ${PWD}/nem:/root/nem $config_mounts -t -d  -p 7777:7777 -p 7880:7880 -p 7890:7890 -p 8989:8989 mynem_image "$@"

This will run the container and make the necessary ports available on your host. $config_mounts passes the necessary arguments to use the custom config file located in custom-configs. Currently handled files are supervisord.conf, 'nis.config-user.propertiesandservant.config.properties`. Here is an example to customize the supervisor config. First copy the sample config file to get started, then edit it, eg to set some services as automatically started at boot. After that stop and boot the container and the new config is applied.

cp custom-configs/supervisord.conf.sample custom-configs/supervisord.conf
vim custom-configs/supervisord.conf
./stop.sh
./boot.sh

The blockchain used by NIS is saved in the nem directory, so this data is persisted across restarts of the container.