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

Dockerizing #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules/
data/
data/*
package-lock.json

!docker/config.js
52 changes: 52 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
49 changes: 49 additions & 0 deletions docker/config.js
Original file line number Diff line number Diff line change
@@ -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,
}
3 changes: 3 additions & 0 deletions docker/createdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
echo "create database eos_snapshot_refactor;" | mysql -h db
mysql -h db eos_snapshot_refactor < bin/schema.sql
31 changes: 31 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -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