diff --git a/native/README.md b/native/README.md index 3e54eb4..689d89c 100644 --- a/native/README.md +++ b/native/README.md @@ -54,6 +54,7 @@ fill the environment file (in case of testnet it's `testnet.env`). > [!NOTE] > You can use your custom connect installation script (example for that is `install_skip.sh`). This one is customized to set a connect version to be installed (default installation script always installs binary with `latest` tag on it). +- `MEZOD_USER` - the user the node processes will run as (the v-kit.sh script should still be run with root or sudo for installation as indicated in Prerequisites) ### 2. Prepare installation script to run diff --git a/native/testnet.env.example b/native/testnet.env.example index 13feff1..19ffa75 100755 --- a/native/testnet.env.example +++ b/native/testnet.env.example @@ -4,6 +4,7 @@ export MEZOD_CHAIN_ID="mezo_31611-1" export MEZOD_HOME="/var/mezod" export MEZOD_MONIKER="" +export MEZOD_USER="root" ### Keyring ### export MEZOD_KEYRING_MNEMONIC="" diff --git a/native/v-kit.sh b/native/v-kit.sh index 31bf0bf..c56787d 100755 --- a/native/v-kit.sh +++ b/native/v-kit.sh @@ -73,7 +73,7 @@ install_mezo() { download_binary ${MEZOD_DOWNLOAD_LINK} "verbose" unpack_binary ${MEZOD_DESTINATION} - chown root:root ${MEZO_EXEC} + chown "${MEZOD_USER}":"${MEZOD_USER}" ${MEZO_EXEC} chmod +x ${MEZO_EXEC} echo "Mezo binary installed with path: ${MEZO_EXEC}" @@ -229,7 +229,7 @@ ExecStartPre=/bin/echo "Starting connect-sidecar systemd initialization..." ExecStart=${CONNECT_EXEC} --log-disable-file-rotation --port=${CONNECT_SIDECAR_PORT} --market-map-endpoint=\"127.0.0.1:9090\" StandardOutput=journal StandardError=journal -User=root +User=${MEZOD_USER} [Install] WantedBy=multi-user.target" | tee /etc/systemd/system/connect-sidecar.service @@ -248,7 +248,7 @@ ExecStartPre=/bin/echo "Starting ethereum-sidecar systemd initialization..." ExecStart=${MEZO_EXEC} ethereum-sidecar --log_format=${MEZOD_LOG_FORMAT} --ethereum-sidecar.server.ethereum-node-address=${MEZOD_ETHEREUM_SIDECAR_SERVER_ETHEREUM_NODE_ADDRESS} StandardOutput=journal StandardError=journal -User=root +User=${MEZOD_USER} [Install] WantedBy=multi-user.target" | tee /etc/systemd/system/ethereum-sidecar.service @@ -267,13 +267,17 @@ ExecStartPre=/bin/echo "Starting mezod systemd initialization..." ExecStart=${MEZO_EXEC} start --home=${MEZOD_HOME} --metrics StandardOutput=journal StandardError=journal -User=root +User=${MEZOD_USER} [Install] WantedBy=multi-user.target" | tee /etc/systemd/system/mezo.service } +set_file_permissions(){ + chown -R "${MEZOD_USER}":"${MEZOD_USER}" "${MEZOD_HOME}" +} + systemd_restart() { echo "Reloading systemd daemon" systemctl daemon-reload @@ -432,6 +436,7 @@ main() { setup_systemd_skip setup_systemd_sidecar setup_systemd_mezo + set_file_permissions systemd_restart show_validator_info }