From 3c59325234f8a39625632a40ec48a0f4d884438e Mon Sep 17 00:00:00 2001 From: lutty Date: Tue, 1 Mar 2022 14:24:29 +0800 Subject: [PATCH] add rosetta RCLONE_DB_0_URL --- rosetta/infra/Dockerfile | 6 ++++-- rosetta/infra/rclone.conf | 8 ++++++++ rosetta/infra/run.sh | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 rosetta/infra/rclone.conf diff --git a/rosetta/infra/Dockerfile b/rosetta/infra/Dockerfile index da5932c87..e2895b112 100644 --- a/rosetta/infra/Dockerfile +++ b/rosetta/infra/Dockerfile @@ -24,7 +24,8 @@ RUN go mod tidy RUN make linux_static && \ cp ./bin/harmony /root/harmony && \ - cp ./rosetta/infra/run.sh /root/run.sh + cp ./rosetta/infra/run.sh /root/run.sh && \ + cp ./rosetta/infra/rclone.conf /root/rclone.conf RUN cp ./rosetta/infra/harmony-pstn.conf /root/harmony-pstn.conf && \ cp ./rosetta/infra/harmony-mainnet.conf /root/harmony-mainnet.conf && \ @@ -34,13 +35,14 @@ RUN cp ./rosetta/infra/harmony-pstn.conf /root/harmony-pstn.conf && \ FROM ubuntu:latest RUN apt update -y && \ - apt install libgmp-dev libssl-dev -y && \ + apt install libgmp-dev libssl-dev rclone -y && \ apt -y clean all WORKDIR /root COPY --from=build /root/harmony /root/harmony COPY --from=build /root/run.sh /root/run.sh +COPY --from=build /root/rclone.conf /root/.config/rclone/rclone.conf COPY --from=build /root/harmony-pstn.conf /root/harmony-pstn.conf COPY --from=build /root/harmony-mainnet.conf /root/harmony-mainnet.conf COPY --from=build /root/rosetta_local_fix.csv /root/rosetta_local_fix.csv diff --git a/rosetta/infra/rclone.conf b/rosetta/infra/rclone.conf new file mode 100644 index 000000000..62d336a71 --- /dev/null +++ b/rosetta/infra/rclone.conf @@ -0,0 +1,8 @@ +[release] +type = s3 +provider = AWS +env_auth = false +region = us-west-1 +acl = public-read +server_side_encryption = AES256 +storage_class = REDUCED_REDUNDANCY \ No newline at end of file diff --git a/rosetta/infra/run.sh b/rosetta/infra/run.sh index 5db227fe5..b7b81c4fc 100644 --- a/rosetta/infra/run.sh +++ b/rosetta/infra/run.sh @@ -6,6 +6,10 @@ DATA="$DIR/data" LOGS="$DATA/logs" BASE_ARGS=(--http.ip "0.0.0.0" --ws.ip "0.0.0.0" --http.rosetta --node_type "explorer" --datadir "$DATA" --log.dir "$LOGS") +if [ -n "$RCLONE_DB_0_URL" ]; then + rclone -P -L sync $RCLONE_DB_0_URL $DATA/harmony_db_0 --multi-thread-streams 4 --transfers=8 +fi + mkdir -p "$LOGS" echo -e NODE ARGS: \" "$@" "${BASE_ARGS[@]}" \" echo "NODE VERSION: $(./harmony --version)"