mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Interim ShyftNetwork/PG Docker - TODO: Check Connection Params
This commit is contained in:
parent
024acc8cb3
commit
d6270fbe94
7 changed files with 86 additions and 13 deletions
|
|
@ -2,11 +2,11 @@ FROM alpine:3.7
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk add --update go git make gcc musl-dev linux-headers ca-certificates && \
|
apk add --update go git make gcc musl-dev linux-headers ca-certificates && \
|
||||||
git clone --depth 1 https://github.com/empyrean/go-ethereum && \
|
git clone --depth 1 https://github.com/ShyftNetwork/go-empyrean && \
|
||||||
(cd go-ethereum && make geth) && \
|
(cd go-empyrean && make geth) && \
|
||||||
cp go-ethereum/build/bin/geth /geth && \
|
cp go-empyrean/build/bin/geth /geth && \
|
||||||
apk del go git make gcc musl-dev linux-headers && \
|
apk del go git make gcc musl-dev linux-headers && \
|
||||||
rm -rf /go-ethereum && rm -rf /var/cache/apk/*
|
rm -rf /go-empyrean && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
EXPOSE 8545
|
EXPOSE 8545
|
||||||
EXPOSE 30303
|
EXPOSE 30303
|
||||||
|
|
|
||||||
3
containers/docker/develop-alpine/pg/Dockerfile
Normal file
3
containers/docker/develop-alpine/pg/Dockerfile
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
FROM postgres:10.4-alpine
|
||||||
|
|
||||||
|
EXPOSE 5432
|
||||||
0
containers/docker/develop-alpine/shyftApi/Dockerfile
Normal file
0
containers/docker/develop-alpine/shyftApi/Dockerfile
Normal file
31
containers/docker/develop-alpine/shyftGeth/Dockerfile
Normal file
31
containers/docker/develop-alpine/shyftGeth/Dockerfile
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
FROM golang:1.10.3-alpine
|
||||||
|
|
||||||
|
# To copy complete directory
|
||||||
|
COPY ./ /go/src/github.com/ShyftEthereum/go-empyrean
|
||||||
|
WORKDIR /go/src/github.com/ShyftEthereum/go-empyrean
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
apk add --update git make gcc musl-dev linux-headers ca-certificates && \
|
||||||
|
(cd /go/src/github.com/ShyftEthereum/go-empyrean && make geth) && \
|
||||||
|
cp /go/src/github.com/ShyftEthereum/go-empyrean/build/bin/geth /geth
|
||||||
|
|
||||||
|
COPY ./shyft-cli/initShyftGeth.sh /
|
||||||
|
COPY ./shyft-cli/resetShyftGeth.sh /
|
||||||
|
COPY ./shyft-cli/startShyftGeth.sh /
|
||||||
|
COPY config.toml /
|
||||||
|
COPY unlockPasswords.txt /
|
||||||
|
COPY ShyftNetwork.json /
|
||||||
|
|
||||||
|
COPY UTC--2018-03-18T22-35-03.111589431Z--43ec6d0942f7faef069f7f63d0384a27f529b062 /
|
||||||
|
COPY UTC--2018-03-18T22-36-53.786508893Z--9e602164c5826ebb5a6b68e4afd9cd466043dc4a /
|
||||||
|
COPY UTC--2018-03-18T22-37-04.212101982Z--5bd738164c61fb50eb12e227846cbaef2de965aa /
|
||||||
|
COPY UTC--2018-03-18T22-37-12.082606217Z--c04ee4131895f1d0c294d508af65d94060aa42bb /
|
||||||
|
COPY UTC--2018-03-18T22-37-19.650676366Z--07d899c4ac0c1725c35c5f816e60273b33a964f7 /
|
||||||
|
|
||||||
|
RUN cd / && ls -a
|
||||||
|
# EXPOSE 8545
|
||||||
|
# EXPOSE 30303
|
||||||
|
WORKDIR /
|
||||||
|
RUN ["./initShyftGeth.sh"]
|
||||||
|
|
||||||
|
ENTRYPOINT ["./startShyftGeth.sh"]
|
||||||
10
core/db.go
10
core/db.go
|
|
@ -1,8 +1,8 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var blockExplorerDb *sql.DB
|
var blockExplorerDb *sql.DB
|
||||||
|
|
@ -12,7 +12,7 @@ const (
|
||||||
connStrTest = "user=postgres dbname=shyftdbtest sslmode=disable"
|
connStrTest = "user=postgres dbname=shyftdbtest sslmode=disable"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitDB() (*sql.DB, error){
|
func InitDB() (*sql.DB, error) {
|
||||||
db, err := sql.Open("postgres", connStr)
|
db, err := sql.Open("postgres", connStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")
|
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")
|
||||||
|
|
@ -24,7 +24,7 @@ func InitDB() (*sql.DB, error){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitDBTest() (*sql.DB, error){
|
func InitDBTest() (*sql.DB, error) {
|
||||||
db, err := sql.Open("postgres", connStrTest)
|
db, err := sql.Open("postgres", connStrTest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")
|
fmt.Println("ERROR OPENING DB, NOT INITIALIZING")
|
||||||
|
|
@ -37,9 +37,9 @@ func InitDBTest() (*sql.DB, error){
|
||||||
}
|
}
|
||||||
|
|
||||||
func DBConnection() (*sql.DB, error) {
|
func DBConnection() (*sql.DB, error) {
|
||||||
if (blockExplorerDb == nil) {
|
if blockExplorerDb == nil {
|
||||||
_, err := InitDB()
|
_, err := InitDB()
|
||||||
if(err != nil) {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
39
docker-compose.yml
Normal file
39
docker-compose.yml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
shyftgeth:
|
||||||
|
build:
|
||||||
|
context: $PWD
|
||||||
|
dockerfile: containers/docker/develop-alpine/shyftGeth/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8545:8545"
|
||||||
|
- "8546:8546"
|
||||||
|
- "30301:30301"
|
||||||
|
- "30303:30303/udp"
|
||||||
|
- "30304:30304"
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- .:/go/src/ShyftNetwork/go-empyrean
|
||||||
|
working_dir: /go/src/ShyftNetwork/go-empyrean
|
||||||
|
depends_on:
|
||||||
|
- pg
|
||||||
|
pg:
|
||||||
|
build:
|
||||||
|
context: $PWD
|
||||||
|
dockerfile: containers/docker/develop-alpine/pg/Dockerfile
|
||||||
|
volumes:
|
||||||
|
- ./pg-data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "5432"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSGRES_PASSWORD=docker
|
||||||
|
- PGDATA=/pg-data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# api:
|
||||||
|
# build:
|
||||||
|
# context: ./containers/docker/develop-alpine/shyftApi
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
./geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
||||||
Loading…
Reference in a new issue