Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank committed Jun 3, 2024
1 parent 6fee191 commit 52f6df4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions ansible/archival-snapshots/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@
ansible.builtin.command:
cmd: "unzip -o {{ remote_resources_path }}/forest.zip -d {{ remote_resources_path }}"

- name: Execute the Forest command
ansible.builtin.shell:
cmd: "./forest --no-gc --encrypt-keystore --config ../config.toml --target-peer-count 500"
chdir: "{{ remote_resources_path }}"
when: forest_running.rc != 0

- name: Execute the init.sh script
ansible.builtin.shell:
cmd: "nohup ./init.sh > init.log &"
Expand Down
12 changes: 6 additions & 6 deletions ansible/archival-snapshots/resources/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else
fi

echo "Starting forest daemon"
nohup $FOREST --config ./config.toml --save-token ./admin_token --rpc-address 127.0.0.1:3456 --metrics-address 127.0.0.1:5000 --import-snapshot "$CURRENT_FULL_SNAPSHOT_PATH" > forest.log &
nohup $FOREST --no-gc --config ./config.toml --save-token ./admin_token --rpc-address 127.0.0.1:3456 --metrics-address 127.0.0.1:5000 --import-snapshot "$CURRENT_FULL_SNAPSHOT_PATH" > forest.log &
FOREST_NODE_PID=$!

sleep 30
Expand All @@ -57,10 +57,10 @@ while ((LATEST_EPOCH - CURRENT_EPOCH > 30000)); do
DATE=$(date --date=@"$EPOCH_TIMESTAMP" -u -I)
NEW_SNAPSHOT="forest_snapshot_mainnet_${DATE}_height_${NEW_EPOCH}.forest.car.zst"

if [ ! -f "./$NEW_SNAPSHOT" ]; then
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 "Snapshot exported: $NEW_SNAPSHOT"
echo "Snapshot exported: $FULL_SNAPSHOTS_DIR/$NEW_SNAPSHOT"
else
echo "$NEW_SNAPSHOT already exists."
fi
Expand All @@ -78,11 +78,11 @@ while ((LATEST_EPOCH - CURRENT_EPOCH > 30000)); do
echo "Lite snapshot uploaded: $NEW_SNAPSHOT"

# Generate and upload diff snapshots
if [ ! -f "$CURRENT_SNAPSHOT_FULL_PATH" ]; then
if [ ! -f "$CURRENT_FULL_SNAPSHOT_PATH" ]; then
echo "File does not exist. Exporting..."
$FOREST_CLI snapshot export --tipset "$CURRENT_EPOCH" --depth 30000 -o "$CURRENT_SNAPSHOT_FULL_PATH"
$FOREST_CLI snapshot export --tipset "$CURRENT_EPOCH" --depth 30000 -o "$CURRENT_FULL_SNAPSHOT_PATH"
else
echo "$CURRENT_SNAPSHOT_FULL_PATH file exists."
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"
Expand Down

0 comments on commit 52f6df4

Please sign in to comment.