Skip to content

Commit

Permalink
fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank committed Jun 5, 2024
1 parent 86544ae commit e3df4ea
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions ansible/archival-snapshots/resources/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ while ((LATEST_EPOCH - CURRENT_EPOCH > 30000)); do
NEW_SNAPSHOT="forest_snapshot_mainnet_${DATE}_height_${NEW_EPOCH}.forest.car.zst"

if [ ! -f "$FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT" ]; then
echo "Exporting snapshot: $NEW_SNAPSHOT"
$FOREST_CLI snapshot export --tipset "$NEW_EPOCH" --depth 30000 > export.txt
echo "Exporting snapshot: $FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT"
$FOREST_CLI snapshot export --tipset "$NEW_EPOCH" --depth 30000 -o "$FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT" > export.txt
echo "Snapshot exported: $FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT"
else
echo "$NEW_SNAPSHOT already exists."
echo "$FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT already exists."
fi

# Generate and upload lite snapshot
if [ ! -f "$LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT" ]; then
echo "Generating Lite snapshot: $NEW_SNAPSHOT"
$FOREST_TOOL archive export --epoch "$NEW_EPOCH" --output-path "$LITE_SNAPSHOT_DIR" "$NEW_SNAPSHOT"
echo "Lite snapshot generated: $NEW_SNAPSHOT"
echo "Generating Lite snapshot: $LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT"
$FOREST_TOOL archive export --epoch "$NEW_EPOCH" --output-path "$LITE_SNAPSHOT_DIR" "$FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT"
echo "Lite snapshot generated: $LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT"
else
echo "$NEW_SNAPSHOT lite snapshot already exists."
fi
echo "Uploading Lite snapshot: $NEW_SNAPSHOT"
echo "Uploading Lite snapshot: $LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT"
aws --profile prod --endpoint "$ENDPOINT" s3 cp "$LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT" "s3://forest-archive/mainnet/lite/"
echo "Lite snapshot uploaded: $NEW_SNAPSHOT"
echo "Lite snapshot uploaded: $LITE_SNAPSHOT_DIR/$NEW_SNAPSHOT"

# Generate and upload diff snapshots
if [ ! -f "$CURRENT_FULL_SNAPSHOT_PATH" ]; then
Expand All @@ -85,14 +85,13 @@ while ((LATEST_EPOCH - CURRENT_EPOCH > 30000)); do
echo "$CURRENT_FULL_SNAPSHOT_PATH file exists."
fi
echo "Generating Diff snapshots: $CURRENT_EPOCH - $NEW_EPOCH"
./diff_script.sh "$CURRENT_EPOCH" "$CURRENT_FULL_SNAPSHOT_PATH" "$NEW_SNAPSHOT"
./diff_script.sh "$CURRENT_EPOCH" "$CURRENT_FULL_SNAPSHOT_PATH" "$FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT"
echo "Diff snapshots generated successfully"
echo "Uploading Diff snapshots"
./upload_diff.sh "$ENDPOINT"
echo "Diff snapshots uploaded successfully"

CURRENT_EPOCH=$NEW_EPOCH
mv "$NEW_SNAPSHOT" "$FULL_SNAPSHOTS_DIR"
done

kill -KILL $FOREST_NODE_PID

0 comments on commit e3df4ea

Please sign in to comment.