Skip to content

Commit

Permalink
Improve usability of snapshots saved by snapshotting node
Browse files Browse the repository at this point in the history
  • Loading branch information
roy-dydx committed Nov 3, 2023
1 parent cb8e3a1 commit c697ec1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/protocol-build-and-push-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR
on: # yamllint disable-line rule:truthy
push:
branches:
- roy/snap
- main
- 'release/[a-z]+/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/[a-z]+/v[0-9]+.x' # e.g. release/protocol/v1.x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/protocol-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR
on: # yamllint disable-line rule:truthy
push:
branches:
- roy/snap
- main
- 'release/[a-z]+/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x
- 'release/[a-z]+/v[0-9]+.x' # e.g. release/protocol/v1.x
Expand Down
1 change: 1 addition & 0 deletions protocol/old_clob_dump
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tree s/k:clob/ version: 43
5 changes: 4 additions & 1 deletion protocol/testing/snapshotting/snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ sleep 10
dydxprotocold init --chain-id=${CHAIN_ID} --home /dydxprotocol/chain/local_node local_node
curl -X GET ${genesis_file_rpc_address}/genesis | jq '.result.genesis' > /dydxprotocol/chain/local_node/config/genesis.json

# Set pruning to prune all but the last two states. Prevents snapshots from getting too big.
sed -i 's/pruning = "default"/pruning = "nothing"/' /dydxprotocol/chain/local_node/config/app.toml

setup_cosmovisor

# TODO: add metrics around snapshot upload latency/frequency/success rate
Expand All @@ -99,7 +102,7 @@ while true; do
kill -TERM $(pidof cosmovisor)

log_this "Creating new snapshot"
SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%M-%H').tar.gz")
SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M')_$(jq -r '.height' /dydxprotocol/chain/local_node/data/priv_validator_state.json).tar.gz")
tar cvzf ${SNAP_PATH}/${SNAP_NAME} ${DATA_PATH}
aws s3 cp ${SNAP_PATH}/${SNAP_NAME} s3://${s3_snapshot_bucket}/ --region ap-northeast-1 --debug || true
rm -rf ${SNAP_PATH}/${SNAP_NAME}
Expand Down

0 comments on commit c697ec1

Please sign in to comment.