Skip to content

Commit f257878

Browse files
authored
Merge pull request #238 from AdExNetwork/issue-233-validator_worker_docker-image
Issue #233 validator worker docker image
2 parents 19b1d22 + 2ba5f50 commit f257878

File tree

8 files changed

+97
-31
lines changed

8 files changed

+97
-31
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target/
2+
scripts/
3+
node_modules
4+
Dockerfile
5+
docker-compose.yml

Cargo.lock

Lines changed: 26 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ members = [
77
"validator_worker",
88
"sentry",
99
]
10-
11-
[patch.crates-io]
12-
redis = {version = "0.13.1-alpha.0", git = "https://github.com/mitsuhiko/redis-rs"}

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM rust:1.40 as builder
2+
3+
4+
5+
WORKDIR /usr/src/app
6+
7+
COPY . .
8+
9+
RUN cargo install --path validator_worker --all-features
10+
11+
WORKDIR /usr/local/bin
12+
13+
RUN cp $CARGO_HOME/bin/validator_worker .
14+
15+
FROM ubuntu:18.04
16+
17+
# `ethereum` or `dummy`
18+
ENV ADAPTER=
19+
20+
# only applicable if you use the `--adapter ethereum`
21+
ENV KEYSTORE_FILE=
22+
ENV KEYSTORE_PWD=
23+
24+
# Only applicable if you use the `--adapter dummy`
25+
ENV DUMMY_IDENTITY=
26+
27+
# If set it will override the configuration file used
28+
ENV CONFIG=
29+
# Defaults to `http://127.0.0.1:8005`
30+
ENV SENTRY_URL=
31+
# Set to any value to run the `validator_worker` in `single tick` mode
32+
# default: `infinite`
33+
ENV SINGLE_TICK=
34+
35+
WORKDIR /usr/local/bin
36+
37+
RUN apt update && apt-get install -y libssl-dev
38+
39+
COPY --from=builder /usr/local/bin/validator_worker .
40+
41+
ENTRYPOINT validator_worker -a ${ADAPTER:-ethereum} \
42+
${KEYSTORE_FILE:+-k $KEYSTORE_FILE} \
43+
${DUMMY_IDENTITY:+-i $DUMMY_IDENTITY} \
44+
${SINGLE_TICK:+-t} \
45+
${SENTRY_URL:+-u $SENTRY_URL} ${CONFIG}

adapter/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ eth_checksum = "0.1.1"
1919
ethabi = { git = "https://github.com/samparsky/ethabi", branch = "graph-patches" }
2020
tiny-keccak = "1.5"
2121
parity-crypto = { version = "0.4.2", features = ["publickey"] }
22-
ethstore = { version = "0.2.1", git = "https://github.com/paritytech/parity-ethereum"}
23-
ethkey = { version = "0.4.0", git = "https://github.com/paritytech/parity-ethereum"}
22+
ethstore = { version = "0.2.1", git = "https://github.com/elpiel/parity-ethereum"}
23+
ethkey = { version = "0.4.0", git = "https://github.com/elpiel/parity-ethereum"}
2424
sha2 = "0.8.0"
2525
base64 = "0.10.1"
2626
lazy_static = "1.4.0"

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.7'
2+
3+
services:
4+
validator:
5+
build: .
6+
container_name: 'adex-network-validator'
7+
restart: always
8+
# For Ethereum adapter
9+
#volumes:
10+
# - "/root/keystore.json:/app/keystore.json"
11+
env_file:
12+
- validator.env

sentry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tokio = { version = "0.2", features = ["macros"] }
1919
hyper = { version = "0.13", features = ["stream"] }
2020
regex = "1"
2121
# Database
22-
redis = { version = "0.13.1-alpha.0", features = ["tokio-rt-core"] }
22+
redis = { version = "0.14", features = ["tokio-rt-core"] }
2323
bb8 = { git = "https://github.com/khuey/bb8" }
2424
bb8-postgres = { git = "https://github.com/khuey/bb8", features = ["with-chrono-0_4", "with-serde_json-1"] }
2525
# Migrations

validator.env.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SENTRY_URL=http://localhost:8005
2+
ADAPTER=dummy
3+
DUMMY_IDENTITY=ce07CbB7e054514D590a0262C93070D838bFBA2e
4+
# for Ethereum adapter
5+
#KEYSTORE_FILE="/app/keystore.json"
6+
#KEYSTORE_PWD="adexvalidator"

0 commit comments

Comments
 (0)