diff --git a/.gitignore b/.gitignore index 37dc9bc..9af6d24 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ node_modules/ data/ data/* package-lock.json + +!docker/config.js diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..0e355ec --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,52 @@ +FROM node:8 + +WORKDIR /build + +# install tools and dependencies +RUN apt-get update && \ + apt-get install -y \ + g++ \ + build-essential \ + curl \ + git \ + file \ + binutils \ + libssl-dev \ + pkg-config \ + libudev-dev \ + mysql-client + +# install rustup +#RUN curl https://sh.rustup.rs -sSf | sh -s -- -y + +# rustup directory +#ENV PATH /root/.cargo/bin:$PATH + +# show backtraces +#ENV RUST_BACKTRACE 1 + +# show tools +#RUN rustc -vV && \ +#cargo -V && \ +#gcc -v &&\ +#g++ -v + +# build parity +#RUN git clone https://github.com/paritytech/parity.git +#RUN cd parity && \ +# cargo build --release --verbose && \ +# ls /build/parity/target/release/parity && \ +# strip /build/parity/target/release/parity + +#ENV PATH /build/parity/target/release:$PATH + +# build genesis +RUN mkdir genesis +WORKDIR /build/genesis +ADD . /build/genesis +RUN npm install -g lerna +RUN npm install +RUN cp docker/config.js . + +EXPOSE 8080 8545 8180 +#ENTRYPOINT ["node snapshot.js --load_config"] diff --git a/docker/config.js b/docker/config.js new file mode 100644 index 0000000..b2664f7 --- /dev/null +++ b/docker/config.js @@ -0,0 +1,49 @@ +module.exports = { + //Take snapshot up to which period? If left undefined, it will default to the last closed period. + period: 0, + + //The Author + author: "Anonymous", + + //Include block.one distribution in snapshot + include_b1: true, + + //Minimum balance required for snapshot inclusion. + //Note: 1 EOS is recommended, as there will be a minimum balance required to have the bandwidth required for a functional account. Additionally, this prevents dust from appearing as an initial accounts, and cleans up the chain. + snapshot_minimum_balance: 1, + + //Overwrite the snapshot.json in root directory. + overwrite_snapshot: true, + + //ETH node Connection Details + eth_node_type: 'ipc', + eth_node_path: '/root/ipc/jsonrpc.ipc', + + //Redis Connection Details + redis_host: null, + redis_port: null, + + //Mysql Connection Details + mysql_db: "eos_snapshot_refactor", + mysql_user: "root", + mysql_pass: null, + mysql_host: "db", + mysql_port: 3306, + + // + // Advanced/Developer settings + // Probably do not need to change this. + // + + //Recalculate wallets table based on already synced + recalculate_wallets: false, + + //For if parity is syncing but you're testing for a period that you know is already synced. + skip_web3_sync: false + + //Enable fallback 1.0? (deprecated) + //registration_fallback: false, + + //Cache Signatures from/for fallback (deprecated) + //cache_signatures: true, +} diff --git a/docker/createdb.sh b/docker/createdb.sh new file mode 100755 index 0000000..a21c103 --- /dev/null +++ b/docker/createdb.sh @@ -0,0 +1,3 @@ +#!/bin/sh +echo "create database eos_snapshot_refactor;" | mysql -h db +mysql -h db eos_snapshot_refactor < bin/schema.sql diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..4543054 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.1' + +services: + db: + image: mariadb:5 + restart: always + environment: + - MYSQL_ALLOW_EMPTY_PASSWORD=1 + volumes: + - ./data:/var/lib/mysql + parity: + image: parity/parity:v1.11.3 + command: --mode active --min-peers 150 --tracing off --pruning fast --db-compaction ssd --jsonrpc-apis all --chain mainnet --no-warp --cache-size 16384 --ipc-path /root/ipc/jsonrpc.ipc + volumes: + - ./io.parity.ethereum:/root/.local/share/io.parity.ethereum + - ipc:/root/ipc + genesis: + build: + context: .. + dockerfile: docker/Dockerfile + command: node snapshot.js --load_config --poll --resume --period=350 --verbose_mt --recalculate_wallets --auto-update=none + volumes: + - ipc:/root/ipc + depends_on: + - db + - parity + +volumes: + ipc: + external: true + diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 0000000..5881c64 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,3 @@ +#!/bin/sh +parity --mode active --tracing off --pruning fast --db-compaction hdd --jsonrpc-apis all --chain mainnet --no-warp --cache-size 2048 & +node snapshot.js --load_config