mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-07 05:38:07 -05:00
Systemd service files and readme
This commit is contained in:
parent
61a8282be1
commit
0ebc9a79c7
25
docs/setup/asb/README.md
Normal file
25
docs/setup/asb/README.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Setting up the ASB
|
||||||
|
|
||||||
|
Setup guidelines for the automated swap backend.
|
||||||
|
|
||||||
|
## systemd services
|
||||||
|
|
||||||
|
We configure two pathes for starting the asb through systemd.
|
||||||
|
|
||||||
|
Upon system startup we first start the monero wallet RPC and then start the asb using two services:
|
||||||
|
|
||||||
|
```
|
||||||
|
start-monero-wallet-rpc.service
|
||||||
|
|-> start-asb.service
|
||||||
|
```
|
||||||
|
|
||||||
|
We trigger re-building the asb from source every 24 hours through the `pull-and-build-asb` timer and service.
|
||||||
|
The watcher-service `watch-asb-binary-change.path ` monitors the asb binary changing, and if changed triggers `restart-asb.service` that will restart `start-asb.service`:
|
||||||
|
|
||||||
|
```
|
||||||
|
pull-and-build-asb.timer
|
||||||
|
|-> pull-and-build-asb.service
|
||||||
|
|-> watch-asb-binary-change.path
|
||||||
|
|-> restart-asb.service
|
||||||
|
|-> start-asb.service
|
||||||
|
```
|
18
docs/setup/asb/systemd/pull-and-build-asb.service
Normal file
18
docs/setup/asb/systemd/pull-and-build-asb.service
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Pull and build ASB from source
|
||||||
|
After=start-asb.service
|
||||||
|
Wants=pull-and-build-asb.timer
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
WorkingDirectory=/var/external/asb/xmr-btc-swap
|
||||||
|
ExecStartPre=git pull
|
||||||
|
ExecStart=/home/asb/.cargo/bin/cargo build --release --bin asb
|
||||||
|
ExecStopPost=ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi'
|
||||||
|
StandardOutput=append:/var/external/asb/run/logs/log_pull-build_stdout.log
|
||||||
|
StandardError=append:/var/external/asb/run/logs/log_pull-build_stderr.log
|
||||||
|
User=asb
|
||||||
|
Group=asb
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
10
docs/setup/asb/systemd/pull-and-build-asb.timer
Normal file
10
docs/setup/asb/systemd/pull-and-build-asb.timer
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=triggers the service that pulls and builds asb
|
||||||
|
Requires=pull-and-build-asb.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* 16:00:00
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
11
docs/setup/asb/systemd/restart-asb.service
Normal file
11
docs/setup/asb/systemd/restart-asb.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Restart ASB service
|
||||||
|
After=watch-asb-binary-change.path
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/systemctl restart start-asb.service
|
||||||
|
ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi'
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
16
docs/setup/asb/systemd/start-asb.service
Normal file
16
docs/setup/asb/systemd/start-asb.service
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run the automated swap backend
|
||||||
|
After=start-monero-wallet-rpc.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/var/external/asb/xmr-btc-swap
|
||||||
|
ExecStart=/home/asb/.cargo/bin/cargo run --release --bin asb -- --config /var/external/asb/run/asb-config/config.toml start
|
||||||
|
ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi'
|
||||||
|
StandardOutput=append:/var/external/asb/run/logs/log_stdout.log
|
||||||
|
StandardError=append:/var/external/asb/run/logs/log_stderr.log
|
||||||
|
Restart=on-failure
|
||||||
|
User=asb
|
||||||
|
Group=asb
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
14
docs/setup/asb/systemd/start-monero-wallet-rpc.service
Normal file
14
docs/setup/asb/systemd/start-monero-wallet-rpc.service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=monero-wallet-rpc for the automated swap backend (asb)
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/var/external/asb/monero/bin/monero-wallet-rpc --stagenet --daemon-host stagenet.community.xmr.to --rpc-bind-port 38083 --disable-rpc-login --wallet-dir /var/external/asb/monero/data/stagenet/asb-wallets
|
||||||
|
ExecStartPost=/bin/bash -c "i=1; while [ $i -ne 0 ]; do tail -n1 /var/external/asb/monero/bin/monero-wallet-rpc.log | grep 'Starting wallet RPC server'; i=$?; sleep 5; done"
|
||||||
|
ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi'
|
||||||
|
Restart=always
|
||||||
|
User=asb
|
||||||
|
Group=asb
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
6
docs/setup/asb/systemd/watch-asb-binary-change.path
Normal file
6
docs/setup/asb/systemd/watch-asb-binary-change.path
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Path]
|
||||||
|
Unit=restart-asb.service
|
||||||
|
PathChanged=/var/external/asb/xmr-btc-swap/target/release/asb
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user