Skip to content

Commit 43dda63

Browse files
committed
Rework the systemd page to propose separate unit files for NBC and Eth2Stats
1 parent dbcc068 commit 43dda63

File tree

1 file changed

+39
-46
lines changed

1 file changed

+39
-46
lines changed

docs/the_nimbus_book/src/beacon-node-systemd.md

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,67 +35,61 @@ make build
3535

3636
The resulting binaries should appear in `nimbus-eth2/build/nimbus_beacon_node` and `eth2stats-client/eth2stats-client`, respectively.
3737

38-
### 3. Create an executable script
38+
### 3. Create a systemd service unit file for the Nimbus beacon node service
3939

40-
Create an executable script, `run_nimbus_node.sh`, and place it adjacent to the repositories you cloned in step 1 (same directory level).
40+
Create a `systemd` service unit file, `nbc.service`, and save it in `/etc/systemd/system/`.
4141

42-
```bash
43-
#!/bin/bash
42+
```txt
43+
[Unit]
44+
Description=Nimbus beacon node
4445
45-
set +e
46+
[Service]
47+
WorkingDirectory=<BASE-DIRECTORY>
48+
ExecStart==<BASE-DIRECTORY>/build/nimbus_beacon_node \
49+
--non-interactive \
50+
--network=pyrmont \
51+
--data-dir=build/data/shared_pyrmont_0 \
52+
--web3-url=<WEB3-URL> \
53+
--rpc:on \
54+
--metrics:on
55+
User=<USERNAME>
56+
Group=<USERNAME>
57+
Restart=always
4658
47-
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
59+
[Install]
60+
WantedBy=default.target
61+
```
4862

49-
cd $(dirname "$0")
50-
cd nimbus-eth2
63+
Replace:
5164

52-
NETWORK=$1
53-
NODE_NAME=${NODE_NAME:-$(whoami)}
54-
55-
if [[ "$2" == "" ]]; then
56-
NODE_ID=0
57-
else
58-
NODE_ID=$2
59-
NODE_NAME=$NODE_NAME-$2
60-
fi
61-
62-
let METRICS_PORT=8008+${NODE_ID}
63-
let RPC_PORT=9190+${NODE_ID}
64-
65-
# add your node to eth2stats and run a data collector app that connects to your beacon chain client
66-
mkdir -p /tmp/${NODE_NAME}
67-
../eth2stats-client/eth2stats-client run \
68-
--data.folder=/tmp/${NODE_NAME} \
69-
--eth2stats.node-name="${NODE_NAME}" \
70-
--eth2stats.addr="grpc.${NETWORK}.eth2stats.io:443" --eth2stats.tls=true \
71-
--beacon.type="nimbus" \
72-
--beacon.addr="http://localhost:$RPC_PORT" \
73-
--beacon.metrics-addr="http://localhost:$METRICS_PORT/metrics" > /tmp/ethstats.$NODE_NAME.log 2>&1 &
65+
`<BASE-DIRECTORY>` with the location of the repository in which you performed the `git clone` command in step 1.
7466

75-
# build and run the beacon node
76-
make NIMFLAGS="-d:insecure" NODE_ID=$NODE_ID ${NETWORK}
77-
```
67+
`<USERNAME>` with the username of the system user responsible for running the launched processes.
7868

79-
> Tip: don't forget to mark the script as executable by running `chmod +x` on it.
69+
`<WEB3-URL>` with a WebSocket JSON-RPC URL that you are planning to use.
8070

81-
### 4. Create a systemd service unit file
71+
### 4. Create a systemd service unit file for the Eth2Stats client
8272

83-
Create a `systemd` service unit file, `nbc.service`, and save it in `/etc/systemd/system/`.
73+
Create a `systemd` service unit file, `eth2stata.service`, and save it in `/etc/systemd/system/`.
8474

8575
```txt
8676
[Unit]
87-
Description=Nimbus beacon node
77+
Description=Eth2Stats Client
8878
8979
[Service]
90-
ExecStart=<BASE-DIRECTORY>/run_nimbus_node.sh pyrmont
80+
ExecStart=<BASE-DIRECTORY>/eth2stats-client run \
81+
--data.folder=<BASE-DIRECTORY>/data \
82+
--eth2stats.node-name="<NODE-NAME>" \
83+
--eth2stats.addr="grpc.pyrmont.eth2.wtf:8080" --eth2stats.tls=false \
84+
--beacon.type="nimbus" \
85+
--beacon.addr="http://localhost:9190" \
86+
--beacon.metrics-addr="http://localhost:8008/metrics"
9187
User=<USERNAME>
9288
Group=<USERNAME>
9389
Restart=always
94-
RuntimeMaxSec=10800
9590
9691
[Install]
9792
WantedBy=default.target
98-
9993
```
10094

10195
Replace:
@@ -104,14 +98,13 @@ Replace:
10498

10599
`<USERNAME>` with the username of the system user responsible for running the launched processes.
106100

107-
### 5. Notify systemd of the newly added service
101+
`<NODE-NAME>` with the name of your node that will appear on the `https://pyrmont.eth2.wtf/`` web-site.
108102

109-
```console
110-
sudo systemctl daemon-reload
111-
```
112-
113-
### 6. Start the nim beacon chain service
103+
### 5. Notify systemd of the newly added services and start them
114104

115105
```console
106+
sudo systemctl daemon-reload
116107
sudo systemctl enable nbc --now
108+
sudo systemctl enable eth2stats --now
117109
```
110+

0 commit comments

Comments
 (0)