diff --git a/ansible/archival-snapshots/playbook.yml b/ansible/archival-snapshots/playbook.yml index e3cf3c23c..dd13a5fe8 100644 --- a/ansible/archival-snapshots/playbook.yml +++ b/ansible/archival-snapshots/playbook.yml @@ -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 &" diff --git a/ansible/archival-snapshots/resources/main.sh b/ansible/archival-snapshots/resources/main.sh index 638eb5adb..d6359f8c3 100755 --- a/ansible/archival-snapshots/resources/main.sh +++ b/ansible/archival-snapshots/resources/main.sh @@ -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 @@ -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 @@ -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"