2016-04-21 13:13:59 +02:00
|
|
|
# Running a seed node as a daemon
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
This document presents some steps to be able to run a bisq seed node as
|
2016-04-21 13:13:59 +02:00
|
|
|
an unattended daemon in a GNU/Linux server with a traditional System V init.
|
|
|
|
|
|
|
|
## Before you start
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
We assume that you have already configured a bisq seed node to run in a
|
2016-04-21 13:13:59 +02:00
|
|
|
computer. You will need to upload the seed node code and configuration to the
|
|
|
|
server:
|
|
|
|
|
|
|
|
- The code is contained in the ``SeedNode.jar`` file which is usually left
|
2017-06-27 01:29:51 +02:00
|
|
|
under ``seednode/target`` after building bisq.
|
|
|
|
- The seed node configuration is the ``bisq_seed_node_HOST_PORT``
|
2016-04-21 13:13:59 +02:00
|
|
|
directory under ``~/.local/share`` (Unix), ``%APPDATA%`` (Windows) or
|
|
|
|
``~/Library/Application Support`` (Mac OS X).
|
|
|
|
|
|
|
|
## Dedicated user
|
|
|
|
|
|
|
|
In order to avoid security risks, it is highly recommended that you create a
|
|
|
|
dedicated user in the server to run the seed node daemon, and that you forbid
|
|
|
|
other users to access its files, for instance:
|
|
|
|
|
|
|
|
# adduser bsqsn
|
|
|
|
# chmod go-rwx ~bsqsn
|
|
|
|
|
|
|
|
Place the jar file where the ``bsqsn`` user can read it and tag it with
|
2017-06-27 01:29:51 +02:00
|
|
|
bisq's version number (to allow running several instances of mutually
|
2016-04-21 13:13:59 +02:00
|
|
|
incompatible versions), e.g. ``~bsqsn/SeedNode-VERSION.jar``. Copy the
|
|
|
|
configuration directory to the ``~bsqsb/.local/share`` directory.
|
|
|
|
|
|
|
|
## Testing the seed node
|
|
|
|
|
|
|
|
You need to check that the seed node can actually run in your system. For
|
2016-04-27 11:15:44 +02:00
|
|
|
instance, if you are using version 0.4.4 and your seed node's Tor address is
|
2016-04-21 13:13:59 +02:00
|
|
|
``1a2b3c4d5e6f7g8h.onion:8000``, try to run this as the ``bsqsn`` user:
|
|
|
|
|
2016-04-27 11:15:44 +02:00
|
|
|
$ java -jar ~bsqsn/SeedNode-0.4.4.jar 1a2b3c4d5e6f7g8h.onion:8000 0 50
|
2016-04-21 13:13:59 +02:00
|
|
|
|
|
|
|
Please check error messages if it fails to run. Do note that you will need
|
|
|
|
OpenJDK and OpenJFX in the server. In Debian-like systems you may install the
|
|
|
|
needed dependencies with:
|
|
|
|
|
|
|
|
# apt-get --no-install-recommends install openjfx
|
|
|
|
|
|
|
|
After the node runs successfully, interrupt it with Control-C.
|
|
|
|
|
|
|
|
## Init script
|
|
|
|
|
|
|
|
To allow the daemon to start automatically on system boot, use the attached
|
2017-06-27 01:29:51 +02:00
|
|
|
[init script](bisq-sn.init.sh). First edit it and change its
|
2016-04-21 13:13:59 +02:00
|
|
|
configuration variables to your needs, especially ``SN_ADDRESS``, ``SN_JAR``
|
|
|
|
and ``SN_USER``. In the previous example, the values would be:
|
|
|
|
|
|
|
|
SN_ADDRESS=1a2b3c4d5e6f7g8h.onion:8000
|
2016-04-27 11:15:44 +02:00
|
|
|
SN_JAR=~bsqsn/SeedNode-0.4.4.jar
|
2016-04-21 13:13:59 +02:00
|
|
|
SN_USER=bsqsn
|
|
|
|
|
|
|
|
Put the customized script under ``/etc/init.d`` using a name without
|
2017-06-27 01:29:51 +02:00
|
|
|
extensions (e.g. ``bisq-sn``), make it executable, add it to the boot
|
2016-04-21 13:13:59 +02:00
|
|
|
sequence and finally start it:
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
# cp /path/to/bisq-sn.init.sh /etc/init.d/bisq-sn
|
|
|
|
# chmod a+rx /etc/init.d/bisq-sn
|
|
|
|
# update-rc.d bisq-sn defaults
|
|
|
|
# service bisq-sn start
|
2016-04-21 13:13:59 +02:00
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
Executing ``service bisq-sn status`` should report that the process is
|
2016-04-21 13:13:59 +02:00
|
|
|
running.
|
|
|
|
|
|
|
|
## Cron script
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
The attached [Cron script](bisq-sn.cron.sh) can be used to check the seed
|
2016-04-21 13:13:59 +02:00
|
|
|
node daemon periodically and restart it if it is using too much memory (RSS at
|
|
|
|
the time, may change to VSS later).
|
|
|
|
|
|
|
|
To enable this check, edit the script and change the ``MAX_RSS_MiB`` to
|
|
|
|
whatever limit (in MiB), copy it to ``/etc/cron.hourly`` and make it
|
|
|
|
executable:
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
# cp /path/to/bisq-sn.cron.sh /etc/cron.hourly/bisq-sn
|
|
|
|
# chmod a+rx /etc/cron.hourly/bisq-sn
|
2016-04-21 13:13:59 +02:00
|
|
|
|
|
|
|
The check will be run every hour. For more sophisticated checks, use a proper
|
|
|
|
monitor like [Monit](https://mmonit.com/monit/).
|
2016-04-27 11:14:12 +02:00
|
|
|
|
|
|
|
## Monitor script
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
The attached [monitor script](monitor-bisq-sn.cron.sh) can be used to
|
2016-04-27 11:14:12 +02:00
|
|
|
watch several seed nodes by connecting to them over Tor, and report by email
|
|
|
|
if there were any failed connection attempts. The script uses the ``torify``
|
|
|
|
and ``nc`` tools, so make sure that you have the ``tor`` and some ``netcat``
|
|
|
|
package installed in your system. Also make sure that it is able to send
|
|
|
|
messages using the ``mail`` utility.
|
|
|
|
|
|
|
|
To enable the monitor, first edit the script and set the email addresses you
|
|
|
|
want to report to in ``REPORT_TO_EMAILS``; if you want to specify the set of
|
|
|
|
seed nodes to check, change the value of ``SEED_NODES``. Then copy the script
|
|
|
|
to ``/etc/cron.hourly`` and make it executable:
|
|
|
|
|
2017-06-27 01:29:51 +02:00
|
|
|
# cp /path/to/monitor-bisq-sn.cron.sh /etc/cron.hourly/monitor-bisq-sn
|
|
|
|
# chmod a+rx /etc/cron.hourly/monitor-bisq-sn
|
2016-04-27 11:14:12 +02:00
|
|
|
|
|
|
|
Since this script requires no special permissions, you may instead want to run
|
|
|
|
it from a normal user's crontab (e.g. the ``bsqsn`` user above).
|