Run Lux Node in Background

This page demonstrates how to set up a luxgo.service file to enable a manually deployed validator node to run in the background of a server instead of in the terminal directly.

Make sure that LuxGo is already installed on your machine.

Steps

Testnet Testnet Config

Run this command in your terminal to create the luxgo.service file

sudo nano /etc/systemd/system/luxgo.service

Paste the following configuration into the luxgo.service file

Remember to modify the values of:

  • user=
  • group=
  • WorkingDirectory=
  • ExecStart=

For those that you have configured on your Server:

[Unit]
Description=Lux Node service
After=network.target

[Service]
User='YourUserHere'
Group='YourUserHere'
Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=10s
StartLimitInterval=120s
StartLimitBurst=5
WorkingDirectory=/Your/Path/To/luxgo
ExecStart=/Your/Path/To/luxgo/./luxgo \  
   --network-id=testnet \
   --api-metrics-enabled=true 

[Install]
WantedBy=multi-user.target

Press Ctrl + X then Y then Enter to save and exit.

Now, run:

sudo systemctl daemon-reload

Mainnet Config

Run this command in your terminal to create the luxgo.service file

sudo nano /etc/systemd/system/luxgo.service

Paste the following configuration into the luxgo.service file

[Unit]
Description=Lux Node service
After=network.target

[Service]
User='YourUserHere'
Group='YourUserHere'
Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=10s
StartLimitInterval=120s
StartLimitBurst=5
WorkingDirectory=/Your/Path/To/luxgo
ExecStart=/Your/Path/To/luxgo/./luxgo \
   --api-metrics-enabled=true

[Install]
WantedBy=multi-user.target

Press Ctrl + X then Y then Enter to save and exit.

Now, run:

sudo systemctl daemon-reload

Start the Node

This command makes your node start automatically in case of a reboot, run it:

sudo systemctl enable luxgo

To start the node, run:

sudo systemctl start luxgo
sudo systemctl status luxgo

Output:

socopower@lux-node-01:~$ sudo systemctl status luxgo
 luxgo.service - Lux Node service
     Loaded: loaded (/etc/systemd/system/luxgo.service; enabled; vendor p>
     Active: active (running) since Tue 2023-08-29 23:14:45 UTC; 5h 46min ago
   Main PID: 2226 (luxgo)
      Tasks: 27 (limit: 38489)
     Memory: 8.7G
        CPU: 5h 50min 31.165s
     CGroup: /system.slice/luxgo.service
             └─2226 /usr/local/bin/luxgo/./luxgo --network-id=testnet

Aug 30 03:02:50 lux-node-01 luxgo[2226]: INFO [08-30|03:02:50.685] >
Aug 30 03:02:51 lux-node-01 luxgo[2226]: INFO [08-30|03:02:51.185] >
Aug 30 03:03:09 lux-node-01 luxgo[2226]: [08-30|03:03:09.380] INFO >
Aug 30 03:03:23 lux-node-01 luxgo[2226]: [08-30|03:03:23.983] INFO >
Aug 30 03:05:15 lux-node-01 luxgo[2226]: [08-30|03:05:15.192] INFO >
Aug 30 03:05:15 lux-node-01 luxgo[2226]: [08-30|03:05:15.237] INFO >
Aug 30 03:05:15 lux-node-01 luxgo[2226]: [08-30|03:05:15.238] INFO >
Aug 30 03:05:19 lux-node-01 luxgo[2226]: [08-30|03:05:19.809] INFO >
Aug 30 03:05:19 lux-node-01 luxgo[2226]: [08-30|03:05:19.809] INFO >
Aug 30 05:00:47 lux-node-01 luxgo[2226]: [08-30|05:00:47.001] INFO

To see the synchronization process, you can run the following command:

sudo journalctl -fu luxgo

Is this guide helpful?