Chainflow / solana-mission-control

MIT License
29 stars 19 forks source link

error while reading config.toml: Config File \"config\" Not Found #12

Open Throbac-Labs opened 2 years ago

Throbac-Labs commented 2 years ago

Having an issue with running the solana_mc.service

It looks like the service cannot locate my config.toml when the execution begins.

here's the error:

Apr 12 18:10:13 solana2 solana-mc[219813]: time="2022-04-12T18:10:13Z" level=fatal msg="error while reading config.toml: Config File \"config\" Not Found in \"[/ /home/$USER/.solana-mc/config]\""

here's the systemd file located in /lib/systemd/system/solana_mc.service:

[Unit]
Description=Solana-mc
After=network-online.target

[Service]
User=$USER 
Environment="SOLANA_BINARY_PATH=/home/sol/.local/share/solana/install/active_release/bin/solana"
ExecStart=/home/$USER/go/bin/solana-mc 
Restart=always
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target

Current solana-mc script was built using:

 $ go build -o /home/$USER/go/bin/solana-mc 

and my config.toml

[rpc_and_lcd_endpoints]
rpc_endpoint = "http://localhost:8899"
network_rpc = "http://localhost:8899"

[validator_details]
validator_name = "throbacLabs"
pub_key = "AcK8zw3FUvHLZUBXByWMzkESx319bPkVEEt7qvrNMoSY"
vote_key = "4LQL2azc6VDPxWtTPFvi9MCQs32BFyxeMuUyPktD38s8"

[enable_alerts]
enable_telegram_alerts = false
enable_email_alerts = false

[regular_status_alerts]
alert_timings = ["02:30AM","02:30PM"]

[alerter_preferences]
delegation_alerts = "yes"
block_diff_alerts = "yes"
node_health_alert = "yes"
epoch_diff_alrets = "yes"
account_balance_change_alerts = "yes"
skip_rate_alerts = "yes"

[alerting_threholds]
block_diff_threshold = 10
balance_change_threshold = 1000.123
epoch_diff_threshold = 0

The script works just fine when i type "solana-mc" into the command prompt, and I see metrics in grafana via prometheus.

I examined the config.go file within the repos config directory and see where the error is coming from, but I am still unsure where & exactly what i need to do to fix the config path error.

Things i tried:

Running Ubuntu 20.04 with a validator on Solana Devnet.

Any help is appreciated!

Throbac-Labs commented 2 years ago

UPDATE:

Was able to solve by adding a "Working Directory" variable to the /lib/systemd/system/solana_mc.service


[Unit]
Description=Solana-mc
After=network-online.target

[Service]
User=$USER 
Environment="SOLANA_BINARY_PATH=/home/sol/.local/share/solana/install/active_release/bin/solana"
WorkingDirectory=/home/$USER
ExecStart=/home/$USER/go/bin/solana-mc 
Restart=always
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target

Might be worth adding to the repo, def a little confusing trying to make sure the service can access the necessary config. I was not able to get 'export CONFIG_PATH="/home/$USER"' to work. I'm sure I'm missing something, but hopefully this helps others!