29 lines
987 B
Django/Jinja
29 lines
987 B
Django/Jinja
#!/usr/bin/env bash
|
|
# vim:ft=sh
|
|
set -Eeuo pipefail
|
|
|
|
SERVICE_NAME='{{ nimbus_db_purge_node_service_name | mandatory }}'
|
|
SERVICE_PATH='{{ nimbus_db_purge_node_service_path | mandatory }}'
|
|
NETWORK_NAME='{{ nimbus_db_purge_node_network_name | mandatory }}'
|
|
SERVICE_DATA_PATH="${SERVICE_PATH}/data/shared_${NETWORK_NAME}_0/"
|
|
|
|
echo " >>> Stopping node: ${SERVICE_NAME}"
|
|
sudo systemctl stop "${SERVICE_NAME}"
|
|
|
|
echo " >>> Purging DB: ${SERVICE_DATA_PATH}"
|
|
rm -fr "${SERVICE_DATA_PATH}/db"
|
|
|
|
{% if nimbus_db_purge_trusted_node_sync_enabled %}
|
|
TRUSTED_NODE_API_URL='{{ nimbus_db_purge_truster_node_api_url | mandatory }}'
|
|
echo " >>> Syncing from trusted node: ${TRUSTED_NODE_API_URL}"
|
|
"${SERVICE_PATH}/repo/build/nimbus_beacon_node" \
|
|
trustedNodeSync \
|
|
--data-dir="${SERVICE_DATA_PATH}" \
|
|
--trusted-node-url="${TRUSTED_NODE_API_URL}" \
|
|
--network="${NETWORK_NAME}" \
|
|
--backfill=false
|
|
|
|
{% endif %}
|
|
echo " >>> Starting node: ${SERVICE_NAME}"
|
|
sudo systemctl start "${SERVICE_NAME}"
|