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

Deploy pool on Docker #405

Open
wants to merge 3 commits into
base: develop
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
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.11

RUN mkdir -p /app
WORKDIR /app

COPY ./ /app

RUN make

CMD ./build/bin/open-ethereum-pool ./config.json
54 changes: 54 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: '2'
services:
proxy:
build: pool/open-ethereum-pool/
restart: always
ports:
- 3333:3333
volumes:
- ./proxy.json:/app/config.json
links:
- redis

api:
build: ./
restart: always
ports:
- 8181:8181
volumes:
- ./api.json:/app/config.json

unlocker:
build: pool/open-ethereum-pool/
restart: always
volumes:
- ./unlocker.json:/app/config.json

payouts:
build: pool/open-ethereum-pool/
restart: always
volumes:
- ./payouts.json:/app/config.json

web-builder:
build: www/
volumes:
- ./www-dist:/app/dist

web-development:
build: www/
volumes:
- ./www:/app
command: ember server --port 8082 --environment development

redis:
image: redis:latest
restart: always
ports:
- 6379:6379
volumes:
- redis:/data
command: redis-server --appendonly yes

volumes:
redis:
5 changes: 5 additions & 0 deletions payouts/unlocker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ type UnlockerConfig struct {

const minDepth = 16
const byzantiumHardForkHeight = 4370000
const constantinopleHardForkHeight = 7280000

var homesteadReward = math.MustParseBig256("5000000000000000000")
var byzantiumReward = math.MustParseBig256("3000000000000000000")
var constantinopleReward = math.MustParseBig256("2000000000000000000")

// Donate 10% from pool fees to developers
const donationFee = 10.0
Expand Down Expand Up @@ -502,6 +504,9 @@ func weiToShannonInt64(wei *big.Rat) int64 {
}

func getConstReward(height int64) *big.Int {
if height >= constantinopleHardForkHeight {
return new(big.Int).Set(constantinopleReward)
}
if height >= byzantiumHardForkHeight {
return new(big.Int).Set(byzantiumReward)
}
Expand Down
6 changes: 6 additions & 0 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ func (r *RPCClient) doPost(url string, method string, params interface{}) (*JSON
data, _ := json.Marshal(jsonReq)

req, err := http.NewRequest("POST", url, bytes.NewBuffer(data))

if err != nil {
r.markSick()
return nil, err
}

req.Header.Set("Content-Length", (string)(len(data)))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
Expand Down
17 changes: 17 additions & 0 deletions www/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:11.1.0-alpine

RUN apk add git

RUN mkdir -p /app
WORKDIR /app

COPY ./ /app

VOLUME /app/www/dist

RUN npm install -g [email protected]
RUN npm install -g bower
RUN npm install
RUN bower --allow-root install

CMD ./build.sh
2 changes: 1 addition & 1 deletion www/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh

./node_modules/.bin/ember build --environment production