Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upload corresponding latest snapshot sha256sum #441

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions images/snapshot-service/src/upload_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ if [[ $generation_result != 0 ]]; then
exit 1
fi

# Mount the snapshot volume and copy the snapshot to the S3 bucket.
docker run -v "${DB_VOLUME}":/opt/snapshots --rm --entrypoint /bin/bash --env AWS_ACCESS_KEY_ID="$R2_ACCESS_KEY" --env AWS_SECRET_ACCESS_KEY="$R2_SECRET_KEY" \
# Mount the snapshot volume and copy the snapshot and corresponding shasum to the S3 bucket.
docker run -v "${DB_VOLUME}:/opt/snapshots" --entrypoint /bin/bash \
--env AWS_ACCESS_KEY_ID="$R2_ACCESS_KEY" \
--env AWS_SECRET_ACCESS_KEY="$R2_SECRET_KEY" \
public.ecr.aws/aws-cli/aws-cli:2.15.18 \
-c "aws configure set default.s3.multipart_chunksize 4GB && aws --endpoint ${R2_ENDPOINT} s3 cp --no-progress /opt/snapshots/forest_snapshot_${CHAIN_NAME}*.forest.car.zst s3://${SNAPSHOT_BUCKET}/${CHAIN_NAME}/latest/" || exit 1
-c 'aws configure set default.s3.multipart_chunksize 4GB && \
ls /opt/snapshots/forest_snapshot_'"${CHAIN_NAME}"'*.forest.car* | while read file; do \
echo "Uploading $file to S3..." && \
aws --endpoint '"${R2_ENDPOINT}"' s3 cp --no-progress $file "s3://'"${SNAPSHOT_BUCKET}"'/'"${CHAIN_NAME}"'/latest/" || exit 1; \
done'


docker volume rm "${DB_VOLUME}" || true