forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker-compose] add data restore docker compose
Closes: aptos-labs#8529
- Loading branch information
1 parent
7917821
commit e90bbb0
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This compose file can be used to restore data for a fullnode. | ||
# You will need to provide the restore data source in the configuration. | ||
version: "3.8" | ||
services: | ||
restore: | ||
image: diem/tools:devnet | ||
volumes: | ||
- type: volume | ||
source: db | ||
target: /opt/diem/data | ||
- type: volume | ||
source: tmp | ||
target: /tmp | ||
- type: bind | ||
source: ./s3-public.toml | ||
target: /opt/diem/etc/s3-public.toml | ||
read_only: true | ||
# Provide the public S3 bucket and the sub directory you want to restore data from. | ||
# Diem Association provides public data backup you can use, check the offical website. | ||
environment: | ||
- BUCKET=<S3 bucket> | ||
- SUB_DIR=<sub directory of the S3 bucket> | ||
- HOME=/tmp | ||
- RUST_LOG=debug | ||
command: > | ||
sh -c " | ||
/usr/local/bin/db-restore --concurrent-downloads 2 \ | ||
--target-db-dir /opt/diem/data/db auto \ | ||
--metadata-cache-dir /tmp/diem-restore-metadata \ | ||
command-adapter --config /opt/diem/etc/s3-public.toml | ||
" | ||
# update the db volume name to the one you want to restore if needed | ||
# docker-compose usually add the project name (default is the directory name) as prefix of the volume name. | ||
# so make sure you start this docker compose using same project name as the db you want to restore. | ||
volumes: | ||
db: | ||
tmp: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
env_vars = [] | ||
|
||
[commands] | ||
create_backup = 'echo "$BACKUP_NAME"' | ||
create_for_write = ''' | ||
FILE_HANDLE="$BACKUP_HANDLE/$FILE_NAME" | ||
echo "$FILE_HANDLE" | ||
exec 1>&- | ||
gzip -c | aws s3 cp - "s3://$BUCKET/$SUB_DIR/$FILE_HANDLE" | ||
''' | ||
open_for_read = 'aws s3 cp "s3://$BUCKET/$SUB_DIR/$FILE_HANDLE" - --no-sign-request | gzip -cd' | ||
save_metadata_line= 'gzip -c | aws s3 cp - "s3://$BUCKET/$SUB_DIR/metadata/$FILE_NAME" --no-sign-request' | ||
list_metadata_files = '(aws s3 ls s3://$BUCKET/$SUB_DIR/metadata/ --no-sign-request ||:) | sed -ne "s#.* \(.*\)#metadata/\1#p"' |