diff --git a/HOWTO.rst b/HOWTO.rst index 0350e9b..12d4a43 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -12,8 +12,8 @@ small - patches welcome. communication with the daemon. I am using aiohttp-0.21. While not requirements for running ElectrumX, it is intended to be run -with supervisor software such as Daniel Bernstein's daemontools, or -Gerald Pape's runit package. These make administration of secure +with supervisor software such as Daniel Bernstein's daemontools, +Gerald Pape's runit package or systemd. These make administration of secure unix servers very easy, and I strongly recommend you install one of these and familiarise yourself with them. The instructions below and sample run scripts assume daemontools; adapting to runit should be trivial @@ -55,6 +55,10 @@ on an SSD:: mkdir /path/to/db_directory chown electrumx /path/to/db_directory + +Using daemontools +----------------- + Next create a daemontools service directory; this only holds symlinks (see daemontools documentation). The 'svscan' program will ensure the servers in the directory are running by launching a 'supervise' @@ -107,6 +111,35 @@ You can see its logs with:: tail -F /path/to/log/dir/current | tai64nlocal +Using systemd +------------- + +This repository contains a sample systemd unit file that you can use to +setup ElectrumX with systemd. Simply copy it to :code:`/etc/systemd/system`:: + + cp samples/systemd-unit /etc/systemd/system/electrumx.service + +The sample unit file assumes that the repository is located at +:code:`/home/electrumx/electrumx`. If that differs on your system, you need to +change the unit file accordingly. + +You need to set a few configuration variables in :code:`/etc/electrumx.conf`, +see `samples/NOTES` for the list of required variables. + +Now you can start ElectrumX using :code:`systemctl`:: + + systemctl start electrumx + +You can use :code:`journalctl` to check the log output:: + + journalctl -u electrumx -f + +Once configured, you may want to start ElectrumX at boot:: + + systemctl enable electrumx + + + Sync Progress ============= diff --git a/samples/systemd-unit b/samples/systemd-unit new file mode 100644 index 0000000..94b7d47 --- /dev/null +++ b/samples/systemd-unit @@ -0,0 +1,11 @@ +[Unit] +Description=Electrumx +After=network.target + +[Service] +EnvironmentFile=/etc/electrumx.conf +ExecStart=/home/electrumx/electrumx/server_main.py +User=electrumx + +[Install] +WantedBy=multi-user.target \ No newline at end of file