diff --git a/containers/docker/develop-alpine/Dockerfile b/containers/docker/develop-alpine/Dockerfile index 0415283dbe..27998998ea 100644 --- a/containers/docker/develop-alpine/Dockerfile +++ b/containers/docker/develop-alpine/Dockerfile @@ -2,11 +2,11 @@ FROM alpine:3.7 RUN \ apk add --update go git make gcc musl-dev linux-headers ca-certificates && \ - git clone --depth 1 https://github.com/empyrean/go-ethereum && \ - (cd go-ethereum && make geth) && \ - cp go-ethereum/build/bin/geth /geth && \ + git clone --depth 1 https://github.com/ShyftNetwork/go-empyrean && \ + (cd go-empyrean && make geth) && \ + cp go-empyrean/build/bin/geth /geth && \ 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 30303 diff --git a/containers/docker/develop-alpine/pg/Dockerfile b/containers/docker/develop-alpine/pg/Dockerfile new file mode 100644 index 0000000000..53bf37ed04 --- /dev/null +++ b/containers/docker/develop-alpine/pg/Dockerfile @@ -0,0 +1,3 @@ +FROM postgres:10.4-alpine + +EXPOSE 5432 \ No newline at end of file diff --git a/containers/docker/develop-alpine/shyftApi/Dockerfile b/containers/docker/develop-alpine/shyftApi/Dockerfile new file mode 100644 index 0000000000..e69de29bb2 diff --git a/containers/docker/develop-alpine/shyftGeth/Dockerfile b/containers/docker/develop-alpine/shyftGeth/Dockerfile new file mode 100644 index 0000000000..6f87485cd0 --- /dev/null +++ b/containers/docker/develop-alpine/shyftGeth/Dockerfile @@ -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"] \ No newline at end of file diff --git a/core/db.go b/core/db.go index 48f86ac7a1..31911822f9 100644 --- a/core/db.go +++ b/core/db.go @@ -1,18 +1,18 @@ package core import ( - "fmt" - "database/sql" + "database/sql" + "fmt" ) var blockExplorerDb *sql.DB const ( - connStr = "user=postgres dbname=shyftdb sslmode=disable" - connStrTest = "user=postgres dbname=shyftdbtest sslmode=disable" + connStr = "user=postgres dbname=shyftdb 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) if err != nil { 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) if err != nil { fmt.Println("ERROR OPENING DB, NOT INITIALIZING") @@ -37,9 +37,9 @@ func InitDBTest() (*sql.DB, error){ } func DBConnection() (*sql.DB, error) { - if (blockExplorerDb == nil) { + if blockExplorerDb == nil { _, err := InitDB() - if(err != nil) { + if err != nil { return nil, err } } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..68ff2fb428 --- /dev/null +++ b/docker-compose.yml @@ -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 + + diff --git a/shyft-cli/initShyftGeth.sh b/shyft-cli/initShyftGeth.sh index c6a8d115e1..942fa66f45 100755 --- a/shyft-cli/initShyftGeth.sh +++ b/shyft-cli/initShyftGeth.sh @@ -1,2 +1,2 @@ #!/bin/sh -./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json \ No newline at end of file +./geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json \ No newline at end of file