toxcore/other/bootstrap_daemon
2016-01-01 21:10:20 -05:00
..
docker Add Dockerfile for the daemon 2016-01-01 20:29:24 -05:00
src Keep it in alphabetical order 2016-01-01 21:10:20 -05:00
README.md Add Dockerfile for the daemon 2016-01-01 20:29:24 -05:00
tox-bootstrapd.conf Link changes. 2015-07-07 22:57:11 -04:00
tox-bootstrapd.service Add ability to specify multiple command line arguments 2015-12-31 19:58:34 -05:00
tox-bootstrapd.sh Add ability to specify multiple command line arguments 2015-12-31 19:58:34 -05:00

#Instructions

These instructions are primarily tested on Debian Linux, Wheezy for init.d and Jessie for systemd, but they should work on other POSIX-compliant systems too.

##For `systemd` users:

For security reasons we run the daemon under its own user.

Create a new user by executing the following:

sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd

Restrict access to home directory:

sudo chmod 700 /var/lib/tox-bootstrapd

Copy tox-bootstrapd.conf file to where ExecStart= from tox-bootstrapd.service points to. By default it's /etc/tox-bootstrapd.conf.

sudo cp tox-bootstrapd.conf /etc/tox-bootstrapd.conf

Go over everything in the copied tox-bootstrapd.conf file. Set options you want and add actual working nodes to the bootstrap_nodes list, instead of the example ones, if you want your node to connect to the Tox network. Make sure pid_file_path matches PIDFile= from tox-bootstrapd.service.

Copy tox-bootstrapd.service to /etc/systemd/system/:

sudo cp tox-bootstrapd.service /etc/systemd/system/

You must uncomment the next line in tox-bootstrapd.service, if you want to use port number < 1024

#CapabilityBoundingSet=CAP_NET_BIND_SERVICE

and, possibly, install libcap2-bin or libcap2 package, depending of your distribution.

Reload systemd units definitions, enable service for automatic start (if needed), start it and verify it's running:

sudo systemctl daemon-reload
sudo systemctl enable tox-bootstrapd.service
sudo systemctl start tox-bootstrapd.service
sudo systemctl status tox-bootstrapd.service

Get your public key and check that the daemon initialized correctly:

sudo grep "tox-bootstrapd" /var/log/syslog
###Troubleshooting:
  • Check daemon's status:
sudo systemctl status tox-bootstrapd.service
  • Check the log for errors:
sudo grep "tox-bootstrapd" /var/log/syslog
# or
sudo journalctl --pager-end
# or
sudo journalctl -f _SYSTEMD_UNIT=tox-bootstrapd.service
  • Make sure tox-bootstrapd user has write permission for keys and pid files.

  • Make sure tox-bootstrapd has read permission for the config file.

  • Make sure tox-bootstrapd location matches its path in tox-bootstrapd.service file.

##For `init.d` users

For security reasons we run the daemon under its own user.

Create a new user by executing the following:

sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd

Restrict access to home directory:

sudo chmod 700 /var/lib/tox-bootstrapd

Copy tox-bootstrapd.conf file to where CFGFILE variable from tox-bootstrapd.sh points to. By default it's /etc/tox-bootstrapd.conf.

sudo cp tox-bootstrapd.conf /etc/tox-bootstrapd.conf

Go over everything in the copied tox-bootstrapd.conf file. Set options you want and add actual working nodes to the bootstrap_nodes list, instead of the example ones, if you want your node to connect to the Tox network. Make sure pid_file_path matches PIDFILE from tox-bootstrapd.sh.

Look at the variable declarations in the beginning of tox-bootstrapd.sh init script to see if you need to change anything for it to work on your system. The default values must be fine for most users and we assume that you use those next.

Copy tox-bootstrapd.sh init script to /etc/init.d/tox-bootstrapd (note the disappearance of ".sh" ending):

sudo cp tox-bootstrapd.sh /etc/init.d/tox-bootstrapd

Set permissions for the init system to run the script:

sudo chmod 755 /etc/init.d/tox-bootstrapd

Make the init system aware of the script, start the daemon and verify it's running:

sudo update-rc.d tox-bootstrapd defaults
sudo service tox-bootstrapd start
sudo service tox-bootstrapd status

Get your public key and check that the daemon initialized correctly:

sudo grep "tox-bootstrapd" /var/log/syslog
###Troubleshooting:
  • Check daemon's status:
sudo service tox-bootstrapd status
  • Check the log for errors:
sudo grep "tox-bootstrapd" /var/log/syslog
  • Check that variables in the beginning of /etc/init.d/tox-bootstrapd are valid.

  • Make sure tox-bootstrapd user has write permission for keys and pid files.

  • Make sure tox-bootstrapd has read permission for the config file.

  • Make sure tox-bootstrapd location matches its path in the /etc/init.d/tox-bootstrapd init script.

##For `Docker` users:

If you are familiar with Docker and would rather run the daemon in a Docker container, run the following from this directory:

sudo docker build -t tox-bootstrapd docker/

sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
sudo chmod 700 /var/lib/tox-bootstrapd

sudo docker run -d --name tox-bootstrapd --restart always -v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ -p 443:443 -p 3389:3389 -p 33445:33445 -p 33445:33445/udp tox-bootstrapd

We create a new user and protect its home directory in order to mount it in the Docker image, so that the kyepair the daemon uses would be shared with the host system, which makes it less likely that you would loose the keypair while playing with the Docker container.

You can check logs for your public key or any errors:

sudo docker logs tox-bootstrapd

If you are an experienced Docker user and have a version of Docker that supports docker cp both host->container and container->host directions, you might want to skip the directory mounting part and just do:

sudo docker build -t tox-bootstrapd docker/
sudo docker run -d --name tox-bootstrapd --restart always -p 443:443 -p 3389:3389 -p 33445:33445 -p 33445:33445/udp tox-bootstrapd
sudo docker logs tox-bootstrapd

The keypair is stored in /var/lib/tox-bootstrapd/keys file, so if you skipped the directory mounting part and want a new Docker container to retain the same public key that from an old one, just copy/overwrite it from the old container.

Note that the Docker container runs a script which pulls a list of bootstrap nodes off https://nodes.tox.chat/ and adds them in the config file.

###Troubleshooting:
  • Check if the container is running:
sudo docker ps -a
  • Check the log for errors:
sudo docker logs tox-bootstrapd