mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
added docker file and flag for nkey seed file
This commit is contained in:
parent
0b44f1d339
commit
4ba3a599a4
2 changed files with 74 additions and 1 deletions
69
Dockerfile
Normal file
69
Dockerfile
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# build stage
|
||||||
|
FROM golang:alpine AS build-env
|
||||||
|
RUN apk --no-cache add build-base git gcc
|
||||||
|
RUN git clone https://github.com/RaaLabs/steward.git
|
||||||
|
WORKDIR /go/steward/cmd
|
||||||
|
RUN go build -o steward
|
||||||
|
|
||||||
|
# final stage
|
||||||
|
FROM alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build-env /go/steward/cmd/steward /app/
|
||||||
|
|
||||||
|
ENV CONFIG_FOLDER "./etc"
|
||||||
|
ENV SOCKET_FOLDER "./tmp"
|
||||||
|
ENV DATABASE_FOLDER "./var/lib"
|
||||||
|
ENV NODE_NAME ""
|
||||||
|
ENV BROKER_ADDRESS "127.0.0.1:4222"
|
||||||
|
ENV PROFILING_PORT ""
|
||||||
|
ENV PROM_HOST_AND_PORT ""
|
||||||
|
ENV DEFAULT_MESSAGE_TIMEOUT 10
|
||||||
|
ENV DEFAULT_MESSAGE_RETRIES 3
|
||||||
|
ENV SUBSCRIBERS_DATA_FOLDER "./var"
|
||||||
|
ENV CENTRAL_NODE_NAME ""
|
||||||
|
ENV ROOT_CA_PATH ""
|
||||||
|
ENV NKEY_SEED_FILE ""
|
||||||
|
|
||||||
|
ENV START_PUB_REQ_HELLO 60
|
||||||
|
|
||||||
|
ENV START_SUB_REQ_ERROR_LOG ""
|
||||||
|
ENV START_SUB_REQ_HELLO ""
|
||||||
|
ENV START_SUB_REQ_TO_FILE_APPEND ""
|
||||||
|
ENV START_SUB_REQ_TO_FILE ""
|
||||||
|
ENV START_SUB_REQ_PING ""
|
||||||
|
ENV START_SUB_REQ_PONG ""
|
||||||
|
ENV START_SUB_REQ_CLI_COMMAND ""
|
||||||
|
ENV START_SUB_REQN_CLI_COMMAND ""
|
||||||
|
ENV START_SUB_REQ_TO_CONSOLE ""
|
||||||
|
ENV START_SUB_REQ_HTTP_GET ""
|
||||||
|
ENV START_SUB_REQ_TAIL_FILE ""
|
||||||
|
|
||||||
|
CMD ["ash","-c","/app/steward\
|
||||||
|
-configFolder=$CONFIG_FOLDER\
|
||||||
|
-socketFolder=$SOCKET_FOLDER\
|
||||||
|
-databaseFolder=$DATABASE_FOLDER\
|
||||||
|
-nodeName=$NODE_NAME\
|
||||||
|
-brokerAddress=$BROKER_ADDRESS\
|
||||||
|
-profilingPort=$PROFILING_PORT\
|
||||||
|
-promHostAndPort=$PROM_HOST_AND_PORT\
|
||||||
|
-defaultMessageTimeout=$DEFAULT_MESSAGE_TIMEOUT\
|
||||||
|
-defaultMessageRetries=$DEFAULT_MESSAGE_RETRIES\
|
||||||
|
-subscribersDataFolder=SUBSCRIBERS_DATA_FOLDER\
|
||||||
|
-centralNodeName=$CENTRAL_NODE_NAME\
|
||||||
|
-rootCAPath=$ROOT_CA_PATH\
|
||||||
|
-nkeySeedFile=$NKEY_SEED_FILE\
|
||||||
|
|
||||||
|
-startPubREQHello=$START_PUB_REQ_HELLO\
|
||||||
|
|
||||||
|
-startSubREQErrorLog=$START_SUB_REQ_ERROR_LOG\
|
||||||
|
-startSubREQHello=$START_SUB_REQ_HELLO\
|
||||||
|
-startSubREQToFileAppend=$START_SUB_REQ_TO_FILE_APPEND\
|
||||||
|
-startSubREQToFile=$START_SUB_REQ_TO_FILE\
|
||||||
|
-startSubREQPing=$START_SUB_REQ_PING\
|
||||||
|
-startSubREQPong=$START_SUB_REQ_PONG\
|
||||||
|
-startSubREQCliCommand=$START_SUB_REQ_CLI_COMMAND\
|
||||||
|
-startSubREQnCliCommand=$START_SUB_REQN_CLI_COMMAND\
|
||||||
|
-startSubREQToConsole=$START_SUB_REQ_TO_CONSOLE\
|
||||||
|
-startSubREQHttpGet=$START_SUB_REQ_HTTP_GET\
|
||||||
|
-startSubREQTailFile=$START_SUB_REQ_TAIL_FILE\
|
||||||
|
"]
|
|
@ -102,9 +102,11 @@ type Configuration struct {
|
||||||
// Path to the certificate of the root CA
|
// Path to the certificate of the root CA
|
||||||
RootCAPath string
|
RootCAPath string
|
||||||
|
|
||||||
|
// Full path to the NKEY's seed file
|
||||||
|
NkeySeedFile string
|
||||||
|
|
||||||
// Make the current node send hello messages to central at given interval in seconds
|
// Make the current node send hello messages to central at given interval in seconds
|
||||||
StartPubREQHello int
|
StartPubREQHello int
|
||||||
|
|
||||||
// Start the central error logger.
|
// Start the central error logger.
|
||||||
// Takes a comma separated string of nodes to receive from or "*" for all nodes.
|
// Takes a comma separated string of nodes to receive from or "*" for all nodes.
|
||||||
StartSubREQErrorLog flagNodeSlice
|
StartSubREQErrorLog flagNodeSlice
|
||||||
|
@ -152,6 +154,7 @@ func newConfigurationDefaults() Configuration {
|
||||||
SubscribersDataFolder: "./var",
|
SubscribersDataFolder: "./var",
|
||||||
CentralNodeName: "",
|
CentralNodeName: "",
|
||||||
RootCAPath: "",
|
RootCAPath: "",
|
||||||
|
NkeySeedFile: "",
|
||||||
StartSubREQErrorLog: flagNodeSlice{Values: []node{}},
|
StartSubREQErrorLog: flagNodeSlice{Values: []node{}},
|
||||||
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
StartSubREQToFileAppend: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubREQToFileAppend: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
|
@ -195,6 +198,7 @@ func (c *Configuration) CheckFlags() error {
|
||||||
flag.StringVar(&c.SubscribersDataFolder, "subscribersDataFolder", fc.SubscribersDataFolder, "The data folder where subscribers are allowed to write their data if needed")
|
flag.StringVar(&c.SubscribersDataFolder, "subscribersDataFolder", fc.SubscribersDataFolder, "The data folder where subscribers are allowed to write their data if needed")
|
||||||
flag.StringVar(&c.CentralNodeName, "centralNodeName", fc.CentralNodeName, "The name of the central node to receive messages published by this node")
|
flag.StringVar(&c.CentralNodeName, "centralNodeName", fc.CentralNodeName, "The name of the central node to receive messages published by this node")
|
||||||
flag.StringVar(&c.RootCAPath, "rootCAPath", fc.RootCAPath, "If TLS, enter the path for where to find the root CA certificate")
|
flag.StringVar(&c.RootCAPath, "rootCAPath", fc.RootCAPath, "If TLS, enter the path for where to find the root CA certificate")
|
||||||
|
flag.StringVar(&c.NkeySeedFile, "nkeySeedFile", fc.NkeySeedFile, "The full path of the nkeys seed file")
|
||||||
|
|
||||||
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")
|
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue