mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Interim ShyftGeth & PG Docker Working - TODO: ShyftBlockExplorerApi ShyftBlockExplorerUI & Monitoring
This commit is contained in:
parent
5c009528a9
commit
905021b5e2
8 changed files with 84 additions and 35 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -52,3 +52,6 @@ shyftData/*
|
||||||
shyft-cli/web3/token_test/node_modules
|
shyft-cli/web3/token_test/node_modules
|
||||||
shyft-cli/web3/transfer-through-master/node_modules
|
shyft-cli/web3/transfer-through-master/node_modules
|
||||||
shyft-cli/web3/transfer-through-master/build
|
shyft-cli/web3/transfer-through-master/build
|
||||||
|
|
||||||
|
# Remove pg data
|
||||||
|
pg-data/*
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ WORKDIR /go/src/github.com/ShyftEthereum/go-empyrean
|
||||||
RUN \
|
RUN \
|
||||||
apk add --update git make gcc musl-dev linux-headers ca-certificates && \
|
apk add --update git make gcc musl-dev linux-headers ca-certificates && \
|
||||||
(cd /go/src/github.com/ShyftEthereum/go-empyrean && make geth) && \
|
(cd /go/src/github.com/ShyftEthereum/go-empyrean && make geth) && \
|
||||||
cp /go/src/github.com/ShyftEthereum/go-empyrean/build/bin/geth /geth
|
cp -v /go/src/github.com/ShyftEthereum/go-empyrean/build/bin/geth /bin
|
||||||
|
|
||||||
COPY ./shyft-cli/initShyftGeth.sh /
|
COPY ./shyft-cli/initShyftGeth.sh /
|
||||||
COPY ./shyft-cli/resetShyftGeth.sh /
|
COPY ./shyft-cli/resetShyftGeth.sh /
|
||||||
COPY ./shyft-cli/startShyftGeth.sh /
|
COPY ./shyft-cli/startShyftGeth.sh /
|
||||||
|
|
@ -23,9 +22,6 @@ COPY UTC--2018-03-18T22-37-04.212101982Z--5bd738164c61fb50eb12e227846cbaef2de965
|
||||||
COPY UTC--2018-03-18T22-37-12.082606217Z--c04ee4131895f1d0c294d508af65d94060aa42bb /
|
COPY UTC--2018-03-18T22-37-12.082606217Z--c04ee4131895f1d0c294d508af65d94060aa42bb /
|
||||||
COPY UTC--2018-03-18T22-37-19.650676366Z--07d899c4ac0c1725c35c5f816e60273b33a964f7 /
|
COPY UTC--2018-03-18T22-37-19.650676366Z--07d899c4ac0c1725c35c5f816e60273b33a964f7 /
|
||||||
|
|
||||||
RUN cd / && ls -a
|
|
||||||
# EXPOSE 8545
|
|
||||||
# EXPOSE 30303
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
CMD ["./initShyftGeth.sh"]
|
CMD ["./initShyftGeth.sh", "/go/src/ShyftNetwork/go-empyrean/shyft-cli/initShyftGeth.sh/startShyftGeth.sh"]
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ import (
|
||||||
|
|
||||||
var blockExplorerDb *sql.DB
|
var blockExplorerDb *sql.DB
|
||||||
|
|
||||||
|
// @NOTE:SHYFT - TODO: Move connection parameters into an env file
|
||||||
const (
|
const (
|
||||||
// connStr = "user=postgres dbname=shyftdb password=docker sslmode=disable"
|
connStr = "user=postgres dbname=shyftdb host=pg password=docker sslmode=disable"
|
||||||
connStr = "postgresql://postgres:docker@pg:5432/shyftdb"
|
// connStr = "postgresql://postgres:docker@pg:5432/shyftdb"
|
||||||
connStrTest = "user=postgres dbname=shyftdbtest password=docker sslmode=disable"
|
connStrTest = "user=postgres dbname=shyftdbtest password=docker sslmode=disable"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
shyftgeth:
|
shyftgeth:
|
||||||
build:
|
build:
|
||||||
context: $PWD
|
context: $PWD
|
||||||
|
|
@ -14,25 +14,33 @@
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/go/src/ShyftNetwork/go-empyrean
|
- .:/go/src/ShyftNetwork/go-empyrean
|
||||||
# working_dir: /go/src/ShyftNetwork/go-empyrean
|
working_dir: /go/src/ShyftNetwork/go-empyrean
|
||||||
depends_on:
|
depends_on:
|
||||||
- pg
|
- pg
|
||||||
# command: ["./wait-for-postgres.sh", "pg:5432","./initShyftGeth.sh" ]
|
networks:
|
||||||
entrypoint: ["/go/src/ShyftNetwork/go-empyrean/wait-for-postgres.sh", "pg:5432","/go/src/ShyftNetwork/go-empyrean/shyft-cli/initShyftGeth.sh"]
|
- shyftnet
|
||||||
|
command: >
|
||||||
|
sh -c '/go/src/ShyftNetwork/go-empyrean/wait-for.sh pg:5432 &&
|
||||||
|
/initShyftGeth.sh &&
|
||||||
|
/startShyftGeth.sh'
|
||||||
pg:
|
pg:
|
||||||
build:
|
build:
|
||||||
context: $PWD
|
context: $PWD
|
||||||
dockerfile: containers/docker/develop-alpine/pg/Dockerfile
|
dockerfile: containers/docker/develop-alpine/pg/Dockerfile
|
||||||
volumes:
|
volumes:
|
||||||
- ./pg-data:/var/lib/postgresql/data
|
- ./pg-data/data:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- "5432"
|
- "8001:5432"
|
||||||
|
networks:
|
||||||
|
- shyftnet
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSGRES_PASSWORD=docker
|
- POSGRES_PASSWORD=docker
|
||||||
- PGDATA=/pg-data
|
- PGDATA=/pg-data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
shyftnet:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
|
||||||
# api:
|
# api:
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
./geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
./build/bin/geth --config config.toml --ws --wsaddr="0.0.0.0" --wsorigins "*" --nat=none --mine --minerthreads 4 --targetgaslimit 80000000 --unlock "0x43EC6d0942f7fAeF069F7F63D0384a27f529B062,0x9e602164C5826ebb5A6B68E4AFD9Cd466043dc4A,0x5Bd738164C61FB50eb12E227846CbaeF2dE965Aa,0xC04eE4131895F1d0C294D508AF65D94060AA42BB,0x07D899C4aC0c1725C35C5f816e60273B33a964F7" --password ./unlockPasswords.txt
|
/bin/geth --config config.toml --ws --wsaddr="0.0.0.0" --wsorigins "*" --nat=none --mine --minerthreads 4 --targetgaslimit 80000000 --unlock "0x43EC6d0942f7fAeF069F7F63D0384a27f529B062,0x9e602164C5826ebb5A6B68E4AFD9Cd466043dc4A,0x5Bd738164C61FB50eb12E227846CbaeF2dE965Aa,0xC04eE4131895F1d0C294D508AF65D94060AA42BB,0x07D899C4aC0c1725C35C5f816e60273B33a964F7" --password ./unlockPasswords.txt
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# wait-for-postgres.sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
host="$1"
|
|
||||||
shift
|
|
||||||
cmd="$@"
|
|
||||||
|
|
||||||
until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -U "postgres" -c '\q'; do
|
|
||||||
>&2 echo "Postgres is unavailable - sleeping"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
>&2 echo "Postgres is up - executing command"
|
|
||||||
exec $cmd
|
|
||||||
57
wait-for.sh
Executable file
57
wait-for.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo "[wait-for] [`date +'%Y%m%d%H%M%S'`] $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: `basename "$0"` [--timeout=15] <HOST>:<PORT> [<HOST_2>:<PORT_2>]"
|
||||||
|
}
|
||||||
|
|
||||||
|
unknown_arg() {
|
||||||
|
log "[ERROR] unknown argument: '$@'"
|
||||||
|
usage
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for() {
|
||||||
|
timeout=$1 && host=$2 && port=$3
|
||||||
|
log "wait '$host':'$port' up to '$timeout'"
|
||||||
|
for i in `seq $timeout` ; do
|
||||||
|
if nc -z "$host" "$port" > /dev/null 2>&1 ; then
|
||||||
|
log "wait finish '$host:$port' [`expr $(date +%s) - $START`] seconds"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
log "wait attempt '${host}:${port}' [$i]"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
log "[ERROR] wait timeout of '$timeout' on '$host:$port'"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'kill $(jobs -p) &>/dev/null' EXIT
|
||||||
|
|
||||||
|
START=$(date +%s)
|
||||||
|
timeout=15
|
||||||
|
pids=""
|
||||||
|
for i in $@ ; do
|
||||||
|
case $i in
|
||||||
|
--timeout=*) timeout="${i#*=}" ;;
|
||||||
|
-t=*) timeout="${i#*=}" ;;
|
||||||
|
*:* )
|
||||||
|
wait_for "$timeout" "${i%%:*}" "${i##*:}" &
|
||||||
|
pids="$pids $!"
|
||||||
|
;;
|
||||||
|
*) unknown_arg "$i" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
status=0
|
||||||
|
for pid in $pids; do
|
||||||
|
if ! wait $pid ; then
|
||||||
|
status=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
log "wait done with status=$status"
|
||||||
|
exit $status
|
||||||
Loading…
Reference in a new issue