Skip to main content

11. Gateway System Services

In this step you will configure, enable and start the xxnetwork-chain and xxnetwork-gateway systemd services.

About xxnetwork-chain.service

The service file for the xxnetwork-chain systemd service is the xxnetwork-chain.service file. It is located in /opt/xxnetwork/. In most cases, you will only need to modify the User and optionally add the --name flag.

Default xxnetwork-chain.service file
[Unit]
Description=Job that starts the xx network chain binary
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target

[Service]
User=ubuntu
Type=simple

ExecStart=/bin/bash -c "/opt/xxnetwork/bin/xxnetwork-chain --telemetry-url 'wss://telemetry.polkadot.io/submit/ 0' --base-path /opt/xxnetwork/db --port 15974 --ws-port 63007 >> /opt/xxnetwork/log/chain.log 2>&1"

LimitNOFILE=infinity
Restart=always
RestartSec=120

[Install]
WantedBy=multi-user.target

About xxnetwork-gateway.service

The service file for the xxnetwork-gateway systemd service is the xxnetwork-gateway.service file. It is located in /opt/xxnetwork/. In most cases, you will only need to modify the User.

Default xxnetwork-gateway.service file
[Unit]
Description=Job that starts the gateway Wrapper service
StartLimitIntervalSec=5
StartLimitBurst=10
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target

[Service]
User=ubuntu
Type=simple

ExecStart=/opt/xxnetwork/gateway-wrapper.py \
--wrapper-log /opt/xxnetwork/log/gateway-wrapper.log \
--cmd-dir /opt/xxnetwork/log/gateway-cmd \
--gateway \
--binary-path /opt/xxnetwork/bin/xxnetwork-gateway \
--config-path /opt/xxnetwork/config/gateway.yaml \
--id-path /opt/xxnetwork/cred/gateway-IDF.json \
--log-path /opt/xxnetwork/log/gateway.log \
--management-cert /opt/xxnetwork/cred/network-management.crt \
--s3-access-key KEY \
--s3-secret SECRET \
--s3-region us-west-1 \
--s3-management-bucket elixxir-management-mainnet \
--s3-bin-bucket elixxir-bins \
--cloudwatch-log-group xxnetwork-logs-mainnet \
--tmp-dir /tmp/xxnetwork/gateway/

LimitNOFILE=infinity
Restart=always

[Install]
WantedBy=multi-user.target

Confirm Username

The output of whoami is the username that must accompany the User setting.

whoami

Open xxnetwork-chain.service

nano /opt/xxnetwork/xxnetwork-chain.service

Set User

The default user in the service file is ubuntu. Change this to your username.

Set Name (Optional)

You can set a name for the blockchain node. To do so, after /opt/xxnetwork/bin/xxnetwork-chain, add --name [name]. If you choose supergateway as the name, you would add --name supergateway. It is recommended names should be simple and not contain spaces or special characters.

Save xxnetwork-chain.service and Exit nano

Press Ctrl + s then Ctrl + x

Open xxnetwork-gateway.service

nano /opt/xxnetwork/xxnetwork-gateway.service

Set User

The default user in the service file is ubuntu. Change this to your username.

Save xxnetwork-gateway.service and Exit nano

Press Ctrl + s then Ctrl + x

sudo ln -s /opt/xxnetwork/xxnetwork-chain.service /etc/systemd/system
sudo systemctl daemon-reexec
sudo systemctl enable xxnetwork-chain.service
sudo systemctl start xxnetwork-chain.service
systemctl status xxnetwork-chain

The xxnetwork-chain.service should be Active: active (running) since [some day date and time]; [duration] ago.

sudo ln -s /opt/xxnetwork/xxnetwork-gateway.service /etc/systemd/system
sudo systemctl daemon-reexec
sudo systemctl enable xxnetwork-gateway.service
sudo systemctl start xxnetwork-gateway.service
systemctl status xxnetwork-gateway

The xxnetwork-gateway.service should be Active: active (running) since [some day date and time]; [duration] ago.