ava-labs/avalanche-network-runner

Cannot run as Service

Opened this issue · 2 comments

I wrote a service file to use ANR to run a local devnet that doesn't get killed when I close my terminal but I cannot add a subnet to it when it's running in the service

Here is the error I get
Error: rpc error: code = Unknown desc = avalanche exec is not defined

Here is the service

[Unit]

Description=Avalanche Network Runner
After=network-online.target
Wants=network-online.target

[Service]

WorkingDirectory=/home/ubuntu
User=ubuntu
ExecStart=/home/ubuntu/code/avalanche-network-runner/bin/avalanche-network-runner server --log-level debug --port=":8080" --grpc-gateway-port=":8081"
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

Here is the command I am trying to run which gives the error above

avalanche-network-runner control start --log-level debug --endpoint="localhost:8080" --blockchain-specs '[{"vm_name": "tokenvm", "genesis": "/home/ubuntu/code/tests/tokenvm-genesis.json", "chain_config": "/home/ubuntu/code/tests/tokenvm-chain-config.json", "subnet_config": "/home/ubuntu/code/tests/tokenvm-subnet-config.json"}]'

It seems ANR is not finding a suitable executable. You can either use Environment= setting of the service configuration to set AVALANCHEGO_EXEC_PATH to the appropriate avago binary (I believe you may prefer this option).
Or you can add a flag --avalanchego-path to your avalanche-network-runner control start command.

Ok thanks that worked. I am also running it with a reverse proxy so I am going to try to make a modification that allows for requests from anywhere similar to the docker modification. https://github.com/ava-labs/avalanche-network-runner/pull/687/files