mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-07 21:32:32 +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:]
|
processHashes = processHashes[1:]
|
||||||
|
|
||||||
// Look up all orphans that are parented by the block we just
|
// Look up all orphans that are parented by the block we just
|
||||||
// accepted. This will typically only be one, but it could
|
// accepted. An indexing for loop is
|
||||||
// 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
|
|
||||||
// intentionally used over a range here as range does not
|
// intentionally used over a range here as range does not
|
||||||
// reevaluate the slice on each iteration nor does it adjust the
|
// reevaluate the slice on each iteration nor does it adjust the
|
||||||
// index for the modified slice.
|
// index for the modified slice.
|
||||||
|
@ -28,8 +28,8 @@ var (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
LogDir string `long:"logdir" description:"Directory to log output."`
|
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)"`
|
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"`
|
KasparovdURL string `long:"kasparovd-url" description:"The API server url to connect to"`
|
||||||
PrivateKey string `long:"private-key" description:"Faucet Private key" required:"true"`
|
PrivateKey string `long:"private-key" description:"Faucet Private key"`
|
||||||
DBAddress string `long:"dbaddress" description:"Database address"`
|
DBAddress string `long:"dbaddress" description:"Database address"`
|
||||||
DBUser string `long:"dbuser" description:"Database user" required:"true"`
|
DBUser string `long:"dbuser" description:"Database user" required:"true"`
|
||||||
DBPassword string `long:"dbpass" description:"Database password" required:"true"`
|
DBPassword string `long:"dbpass" description:"Database password" required:"true"`
|
||||||
@ -56,6 +56,15 @@ func Parse() error {
|
|||||||
return err
|
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)
|
err = resolveNetwork(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
u, err := url.Parse(cfg.APIServerURL)
|
u, err := url.Parse(cfg.KasparovdURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.WithStack(err)
|
return "", errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
logFilename = "apiserver.log"
|
logFilename = "kasparovd.log"
|
||||||
errLogFilename = "apiserver_err.log"
|
errLogFilename = "kasparovd_err.log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Default configuration options
|
// Default configuration options
|
||||||
defaultLogDir = util.AppDataDir("apiserver", false)
|
defaultLogDir = util.AppDataDir("kasparovd", false)
|
||||||
defaultHTTPListen = "0.0.0.0:8080"
|
defaultHTTPListen = "0.0.0.0:8080"
|
||||||
activeConfig *Config
|
activeConfig *Config
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,7 @@ RUN go mod download
|
|||||||
|
|
||||||
COPY . .
|
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
|
# --- multistage docker build: stage #2: runtime image
|
||||||
FROM alpine
|
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/
|
COPY --from=build /go/src/github.com/kaspanet/kaspad/kasparov/database/migrations/ /database/migrations/
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
CMD ["/app/kasparov-server"]
|
CMD ["/app/kasparovd"]
|
||||||
|
@ -8,13 +8,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
logFilename = "syncd.log"
|
logFilename = "kasparov_syncd.log"
|
||||||
errLogFilename = "syncd_err.log"
|
errLogFilename = "kasparov_syncd_err.log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Default configuration options
|
// Default configuration options
|
||||||
defaultLogDir = util.AppDataDir("syncd", false)
|
defaultLogDir = util.AppDataDir("kasparov_syncd", false)
|
||||||
activeConfig *Config
|
activeConfig *Config
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user