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

Feature/parity #2

Open
wants to merge 11 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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/target
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "go-ethereum"]
path = go-ethereum
url = https://github.com/ethereum/go-ethereum
[submodule "openethereum"]
path = openethereum
url = https://github.com/openethereum/openethereum.git
[submodule "yasm"]
path = yasm
url = https://github.com/yasm/yasm.git
4 changes: 2 additions & 2 deletions .travis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ before_script:
- IMAGE="ethereum:${VERSION/\//-}"

env:
- VERSION=1.19.11
- VERSION=2.7.2

language: bash

script:
- docker build -t "$IMAGE" .
- docker run "$IMAGE" version | grep "Geth"
- docker run "$IMAGE" version | grep -i "parity"

services: docker
46 changes: 26 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
# Stage 1 - Build

FROM golang:1.14-buster as builder
FROM bitwyre/native-builder:latest as builder
WORKDIR /app/parity

COPY go-ethereum /app/src/go-ethereum
WORKDIR /app/src/go-ethereum
# YASM
COPY yasm yasm
RUN cd yasm && \
./autogen.sh && \
./configure && \
make -j$(nproc) install

RUN apt-get update && apt-get install -y build-essential
RUN echo "\nSubmodule files:"&& \
ls -Falg --group-directories-first && \
echo && \
gcc --version && \
make -j$(nproc) geth
RUN cd /app/src/go-ethereum/build && \
ls -Falg --group-directories-first && \
strip bin/geth
# Open-Ethereum
COPY openethereum openethereum
WORKDIR /app/parity/openethereum
ENV PATH /root/.cargo/bin:/usr/lib/llvm-10/bin:$PATH
RUN cargo build --release --features final && \
echo "\nBinary info:" && file target/release/parity && size target/release/parity


# Stage 2 - Production Image

FROM ubuntu:18.04

LABEL maintainer "Yefta Sutanto <[email protected]>"
LABEL maintainer "Yefta Sutanto ([email protected]), Aditya Kresna ([email protected])"

RUN apt-get update && \
apt-get install -y --no-install-recommends gosu && \
rm -rf /var/lib/apt/lists/* && \
groupadd -r ethereum && useradd -r -m -g ethereum ethereum
RUN mkdir -p /home/ethereum/.ethereum && \
RUN mkdir -p /home/ethereum/.local/share/io.parity.ethereum && \
chown -R ethereum:ethereum /home/ethereum

COPY --from=builder /app/src/go-ethereum/build/bin /usr/local/bin
COPY --from=builder /app/parity/openethereum/target/release/parity /usr/local/bin/parity
COPY testnet-config.toml /home/ethereum/.local/share/io.parity.ethereum/config.toml
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

VOLUME ["/home/ethereum/.ethereum"]
EXPOSE 8545 8546 8547 30303 30303/udp
RUN chmod +x /docker-entrypoint.sh && \
# Take ownership once again
chown -R ethereum:ethereum /home/ethereum

VOLUME ["/home/ethereum/.local/share/io.parity.ethereum"]
EXPOSE 8082 8083 8545 8546 8547 30303 30303/udp

ENV ETHEREUM_DATA "/home/ethereum/.ethereum"
ENV ETHEREUM_DATA "/home/ethereum/.local/share/io.parity.ethereum"

ENTRYPOINT ["/./docker-entrypoint.sh"]
CMD ["geth"]
CMD ["parity"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/bitwyre/crypto-ethereum.svg)](https://hub.docker.com/r/bitwyre/crypto-ethereum/)
[![ImageLayers](https://images.microbadger.com/badges/image/bitwyre/crypto-ethereum.svg)](https://microbadger.com/images/bitwyre/crypto-ethereum)

Runs the Ethereum geth full-node in a container.
Runs the Ethereum `parity` full-node in a container.

Copyright (C) 2020, Bitwyre Technologies LLC.

## Authors

- [Yefta Sutanto](https://github.com/nevrending)

- [Aditya Kresna](https://github.com/Ujang360)
10 changes: 5 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
set -e

if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments for geth"
echo "$0: assuming arguments for parity"

set -- geth "$@"
set -- parity "$@"
fi

if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "geth" ]; then
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "parity" ]; then
mkdir -p "$ETHEREUM_DATA"
chmod 700 "$ETHEREUM_DATA"
chown -R ethereum "$ETHEREUM_DATA"

echo "$0: setting data directory to $ETHEREUM_DATA"

set -- "$@" --datadir="$ETHEREUM_DATA" --nousb
set -- "$@" --base-path="$ETHEREUM_DATA"
fi

if [ "$1" = "geth" ]; then
if [ "$1" = "parity" ]; then
echo
exec gosu ethereum "$@"
fi
Expand Down
1 change: 0 additions & 1 deletion go-ethereum
Submodule go-ethereum deleted from 6a62fe
1 change: 1 addition & 0 deletions openethereum
Submodule openethereum added at 41aee5
38 changes: 38 additions & 0 deletions testnet-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This config should be placed in following path:
# ~/.local/share/io.parity.ethereum/config.toml

[parity]
# Ropsten Test Network
chain = "ropsten"
# Parity continously syncs the chain
mode = "active"
# Specify the number of blocks between each auto-update check.
auto_update_check_frequency = 10
# You will be identified as 'bitwyre-eth-node' amongst other nodes..
identity = "bitwyre-eth-node"

[network]
# Parity will try to maintain connection to at least 5 peers.
min_peers = 5

[rpc]
# Allows Cross-Origin Requests from domain '*'.
cors = ["*"]
# Allow connections only using specified addresses.
hosts = ["*"]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "private", "parity_pubsub", "traces", "rpc", "shh", "shh_pubsub", "parity_transactions_pool", "personal", "parity_accounts", "secretstore"]
# Threads for handling incoming connections for HTTP JSON-RPC server.
server_threads = 2

[websockets]
# JSON-RPC will be listening for connections on IP all.
interface = "all"
# Allow connections only using specified addresses.
hosts = ["all"]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "private", "traces", "rpc", "shh", "shh_pubsub", "parity_transactions_pool", "personal", "parity_accounts", "secretstore"]

[ipc]
# Only selected APIs will be exposed over this interface.
apis = ["web3", "eth", "pubsub", "net", "parity", "parity_pubsub", "parity_accounts", "private", "traces", "rpc", "shh", "shh_pubsub", "parity_transactions_pool", "personal", "secretstore"]
1 change: 1 addition & 0 deletions yasm
Submodule yasm added at ba463d