mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-390] Add faucet dockerfile (#544)
* [NOD-390] Add faucet Dockerfile * [NOD-390] Allow running migration without -api-server-url and --private-key arguments * [NOD-390] Change kasparov-server to kasparovd in its Dockerfile * [NOD-390] Change API server and Kasparov server to kasparovd
This commit is contained in:
parent
1cd2eb9308
commit
07651e51c8
@ -78,10 +78,7 @@ func (dag *BlockDAG) processOrphans(hash *daghash.Hash, flags BehaviorFlags) err
|
||||
processHashes = processHashes[1:]
|
||||
|
||||
// Look up all orphans that are parented by the block we just
|
||||
// accepted. This will typically only be one, but it could
|
||||
// be multiple if multiple blocks are mined and broadcast
|
||||
// around the same time. The one with the most proof of work
|
||||
// will eventually win out. An indexing for loop is
|
||||
// accepted. An indexing for loop is
|
||||
// intentionally used over a range here as range does not
|
||||
// reevaluate the slice on each iteration nor does it adjust the
|
||||
// index for the modified slice.
|
||||
|
@ -28,8 +28,8 @@ var (
|
||||
type Config struct {
|
||||
LogDir string `long:"logdir" description:"Directory to log output."`
|
||||
HTTPListen string `long:"listen" description:"HTTP address to listen on (default: 0.0.0.0:8081)"`
|
||||
APIServerURL string `long:"api-server-url" description:"The API server url to connect to" required:"true"`
|
||||
PrivateKey string `long:"private-key" description:"Faucet Private key" required:"true"`
|
||||
KasparovdURL string `long:"kasparovd-url" description:"The API server url to connect to"`
|
||||
PrivateKey string `long:"private-key" description:"Faucet Private key"`
|
||||
DBAddress string `long:"dbaddress" description:"Database address"`
|
||||
DBUser string `long:"dbuser" description:"Database user" required:"true"`
|
||||
DBPassword string `long:"dbpass" description:"Database password" required:"true"`
|
||||
@ -56,6 +56,15 @@ func Parse() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !cfg.Migrate {
|
||||
if cfg.KasparovdURL == "" {
|
||||
return errors.New("api-server-url argument is required when --migrate flag is not raised")
|
||||
}
|
||||
if cfg.PrivateKey == "" {
|
||||
return errors.New("private-key argument is required when --migrate flag is not raised")
|
||||
}
|
||||
}
|
||||
|
||||
err = resolveNetwork(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
|
28
faucet/docker/Dockerfile
Normal file
28
faucet/docker/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
# -- multistage docker build: stage #1: build stage
|
||||
FROM golang:1.13-alpine AS build
|
||||
|
||||
RUN mkdir -p /go/src/github.com/kaspanet/kaspad
|
||||
|
||||
WORKDIR /go/src/github.com/kaspanet/kaspad
|
||||
|
||||
RUN apk add --no-cache curl git
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cd faucet && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o faucet .
|
||||
|
||||
# --- multistage docker build: stage #2: runtime image
|
||||
FROM alpine
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache tini
|
||||
|
||||
COPY --from=build /go/src/github.com/kaspanet/kaspad/faucet /app/
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/app/faucet"]
|
@ -40,7 +40,7 @@ func apiURL(requestPath string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
u, err := url.Parse(cfg.APIServerURL)
|
||||
u, err := url.Parse(cfg.KasparovdURL)
|
||||
if err != nil {
|
||||
return "", errors.WithStack(err)
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
logFilename = "apiserver.log"
|
||||
errLogFilename = "apiserver_err.log"
|
||||
logFilename = "kasparovd.log"
|
||||
errLogFilename = "kasparovd_err.log"
|
||||
)
|
||||
|
||||
var (
|
||||
// Default configuration options
|
||||
defaultLogDir = util.AppDataDir("apiserver", false)
|
||||
defaultLogDir = util.AppDataDir("kasparovd", false)
|
||||
defaultHTTPListen = "0.0.0.0:8080"
|
||||
activeConfig *Config
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cd kasparov/kasparovd && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o kasparov-server .
|
||||
RUN cd kasparov/kasparovd && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o kasparovd .
|
||||
|
||||
# --- multistage docker build: stage #2: runtime image
|
||||
FROM alpine
|
||||
@ -26,4 +26,4 @@ COPY --from=build /go/src/github.com/kaspanet/kaspad/kasparov/kasparovd/ /app/
|
||||
COPY --from=build /go/src/github.com/kaspanet/kaspad/kasparov/database/migrations/ /database/migrations/
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/app/kasparov-server"]
|
||||
CMD ["/app/kasparovd"]
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
logFilename = "syncd.log"
|
||||
errLogFilename = "syncd_err.log"
|
||||
logFilename = "kasparov_syncd.log"
|
||||
errLogFilename = "kasparov_syncd_err.log"
|
||||
)
|
||||
|
||||
var (
|
||||
// Default configuration options
|
||||
defaultLogDir = util.AppDataDir("syncd", false)
|
||||
defaultLogDir = util.AppDataDir("kasparov_syncd", false)
|
||||
activeConfig *Config
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user