How to use Specter as a service - launch on boot, start and stop in the background. This guide is for Linux-Users only.
- Create a file
/lib/systemd/system/specter.service
with the following content (replaceUser=myusername
to your username):
[Unit]
Description=Specter Desktop Service
After=multi-user.target
[email protected]
[Service]
User=myusername
Type=simple
ExecStart=/usr/bin/python3 -m cryptoadvance.specter server
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
- Reload systemd with
sudo systemctl daemon-reload
- Enable service to run on boot with
sudo systemctl enable specter.service
(optional) - Start service with
sudo systemctl start specter.service
To stop run sudo systemctl stop specter.service
, to restart sudo systemctl restart specter.service
Users may want to run the linux tarball release as a system service. This has the added benefits over the python release of being easily verifiable using the release signing keys. Unfortunately, there are some legacy locale issues that make running the tarball service difficult, so we will need to set local variables in a startup script that will then be called by the systemd service file.
- Create a file where you normally add manually installed apps and scripts: e.g.
/usr/local/bin/start_specterd
- Add the following to the file:
#!/bin/bash
#script to set correct system local before starting specterd
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
/usr/bin/specterd server --host localhost --port 25441 \
# & ssh -nN -R 25441:localhost:25441 [email protected] \
# && fg
- Make the script executable
sudo chmod +x /ust/local/bin/start_specterd
- Incorporate the script into your
specter.service
file:
[Unit]
Description=Specter Desktop Service
After=multi-user.target
[email protected]
[Service]
User=myusername
Type=simple
ExecStart=/usr/local/bin/start_specterd
StandardInput=tty-force
[Install]
WantedBy=multi-user.target
- To start the specter service run
sudo systemctl daemon-reload && sudo systemctl enable --now specter.service
You can check the status of specter.service by running systemctl status specter.service
or for debugging, you can get more information by running sudo journalctl -fu specter.service
The commented section of the service file above refers to an optional reverse proxy setup which is covered in the reverse_proxy.md document.
You can do the same for bitcoind
if you want to, then both Specter and bitcoind will start on system boot.
To make bitcoind service follow the same steps, just name the service bitcoind.service
and set ExecStart=bitcoind
there.
If you don't want to have Specter in your global python modules, you can use a virtual environment instead.
First create the virtual environment and install Specter there. Let's say the path is /home/myusername/.venv_specter
.
Then you need to change the specter.service
to the following:
[Unit]
Description=Specter Desktop Service
After=multi-user.target
[email protected]
[Service]
User=myusername
Type=simple
ExecStart=/home/myusername/.venv_specter/bin/python -m cryptoadvance.specter server
Environment="PATH=/home/myusername/.venv_specter/bin"
StandardInput=tty-force
[Install]
WantedBy=multi-user.target