diff --git a/rosetta/infra/Dockerfile b/rosetta/infra/Dockerfile index 1e0f817d9..da16be092 100644 --- a/rosetta/infra/Dockerfile +++ b/rosetta/infra/Dockerfile @@ -32,11 +32,11 @@ RUN cp ./rosetta/infra/harmony-pstn.conf /root/harmony-pstn.conf && \ cp ./.hmy/rosetta_local_fix.csv /root/rosetta_local_fix.csv # Execution -FROM ubuntu:latest +FROM ubuntu:20.04 RUN apt update -y && \ - apt install libgmp-dev libssl-dev rclone ca-certificates -y && \ - apt -y clean all + apt install libgmp-dev libssl-dev ca-certificates rclone -y && \ + apt -y clean all \ WORKDIR /root diff --git a/rosetta/infra/docker-compose-offline.yaml b/rosetta/infra/docker-compose-offline.yaml index 4d6f55794..d4d8fb6f0 100644 --- a/rosetta/infra/docker-compose-offline.yaml +++ b/rosetta/infra/docker-compose-offline.yaml @@ -9,10 +9,9 @@ services: ports: - "8080:9700" environment: - - "RCLONE_DB_0_URL=release:pub.harmony.one/mainnet.min.22816573/harmony_sharddb_0" - - "DATA_NAME=harmony_sharddb_0" + - "MODE=offline" + - "NETWORK=mainnet-22816573" volumes: - "./data:/root/data/" - command: [ "-c", "harmony-mainnet.conf", "--run.shard=0", "--sharddata.enable=true", "--run.offline", "--dns.server=false", "--dns.client=false", "--sync.legacy.server=false", "--sync.legacy.client=false" ] labels: service_group: rosetta \ No newline at end of file diff --git a/rosetta/infra/docker-compose.yaml b/rosetta/infra/docker-compose.yaml index 581bbec62..73ec9ee3e 100644 --- a/rosetta/infra/docker-compose.yaml +++ b/rosetta/infra/docker-compose.yaml @@ -9,10 +9,9 @@ services: ports: - "8080:9700" environment: - - "RCLONE_DB_0_URL=release:pub.harmony.one/mainnet.min.22816573/harmony_sharddb_0" - - "DATA_NAME=harmony_sharddb_0" + - "MODE=online" + - "NETWORK=mainnet-22816573" volumes: - "./data:/root/data/" - command: [ "-c", "harmony-mainnet.conf", "--run.shard=0", "--sharddata.enable=true" ] labels: service_group: rosetta \ No newline at end of file diff --git a/rosetta/infra/harmony-mainnet.conf b/rosetta/infra/harmony-mainnet.conf index 6d2936d93..13a593a6e 100644 --- a/rosetta/infra/harmony-mainnet.conf +++ b/rosetta/infra/harmony-mainnet.conf @@ -92,6 +92,13 @@ Version = "2.5.1" RosettaFixFile = "./rosetta_local_fix.csv" AccountSlots = 16 +[ShardData] + EnableShardData = true + DiskCount = 8 + ShardCount = 4 + CacheTime = 10 + CacheSize = 512 + [WS] AuthPort = 9801 Enabled = true diff --git a/rosetta/infra/harmony-pstn.conf b/rosetta/infra/harmony-pstn.conf index 7b2645e9f..70c706ba6 100644 --- a/rosetta/infra/harmony-pstn.conf +++ b/rosetta/infra/harmony-pstn.conf @@ -91,6 +91,13 @@ Version = "2.5.1" BlacklistFile = "./.hmy/blacklist.txt" AccountSlots = 16 +[ShardData] + EnableShardData = false + DiskCount = 8 + ShardCount = 4 + CacheTime = 10 + CacheSize = 512 + [WS] AuthPort = 9801 Enabled = true diff --git a/rosetta/infra/run.sh b/rosetta/infra/run.sh index c096fb5be..ccb668dcc 100644 --- a/rosetta/infra/run.sh +++ b/rosetta/infra/run.sh @@ -1,17 +1,38 @@ #!/usr/bin/env bash set -e -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" 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") -DATA_NAME="${DATA_NAME:=harmony_db_0}" +DATA_NAME="${DATA_NAME:=harmony_sharddb_0}" -if [ -n "$RCLONE_DB_0_URL" ]; then - rclone -P -L sync $RCLONE_DB_0_URL $DATA/$DATA_NAME --transfers=64 +MAINNET_22816573_SNAPSHOT="release:pub.harmony.one/mainnet.min.22816573/harmony_sharddb_0" + +case "$NETWORK" in +mainnet) + CONFIG_PATH="-c /root/harmony-mainnet.conf" + ;; +mainnet-22816573) + CONFIG_PATH="-c /root/harmony-mainnet.conf" + rclone -P -L sync $MAINNET_22816573_SNAPSHOT $DATA/$DATA_NAME --transfers=64 + ;; +testnet) + CONFIG_PATH="-c /root/harmony-pstn.conf" + ;; +*) + echo "unknown network" + exit 1 + ;; +esac + +if [ "$MODE" = "offline" ]; then + BASE_ARGS=(--datadir "$DATA" --log.dir "$LOGS" --run.offline --dns.server false --dns.client false --sync.legacy.server false --sync.legacy.client false) +else + BASE_ARGS=(--datadir "$DATA" --log.dir "$LOGS") fi mkdir -p "$LOGS" -echo -e NODE ARGS: \" "$@" "${BASE_ARGS[@]}" \" -echo "NODE VERSION: $(./harmony --version)" -"$DIR/harmony" "$@" "${BASE_ARGS[@]}" +echo -e NODE ARGS: \" $CONFIG_PATH "$@" "${BASE_ARGS[@]}" \" +echo "NODE VERSION: $($DIR/harmony --version)" + +"$DIR/harmony" $CONFIG_PATH "$@" "${BASE_ARGS[@]}"