1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-31 01:24:31 +00:00

removed debug logging flag, and added doc

This commit is contained in:
postmannen 2025-01-04 23:07:04 +01:00
parent 595032fbb5
commit e7a061b69f
5 changed files with 13 additions and 10 deletions

View file

@ -96,8 +96,6 @@ type Configuration struct {
// EnableAclCheck to enable ACL checking
EnableAclCheck bool `comment:"EnableAclCheck to enable ACL checking"`
// EnableDebug will also enable printing all the messages received in the errorKernel to STDERR.
EnableDebug bool `comment:"EnableDebug will also enable printing all the messages received in the errorKernel to STDERR."`
// LogLevel
LogLevel string `comment:"LogLevel error/info/warning/debug/none."`
LogConsoleTimestamps bool `comment:"LogConsoleTimestamps true/false for enabling or disabling timestamps when printing errors and information to stderr"`
@ -197,7 +195,6 @@ func NewConfiguration() *Configuration {
flag.BoolVar(&c.EnableAclCheck, "enableAclCheck", CheckEnv("ENABLE_ACL_CHECK", c.EnableAclCheck).(bool), "true/false *TESTING* enable Acl checking.")
flag.BoolVar(&c.StartProcesses.IsCentralKey, "isCentralKey", CheckEnv("IS_CENTRAL_KEY", c.StartProcesses.IsCentralKey).(bool), "true/false, *TESTING* is this the central public key server")
flag.BoolVar(&c.StartProcesses.IsCentralAcl, "isCentralAcl", CheckEnv("IS_CENTRAL_ACL", c.StartProcesses.IsCentralAcl).(bool), "true/false, *TESTING* is this the central acl server")
flag.BoolVar(&c.EnableDebug, "enableDebug", CheckEnv("ENABLE_DEBUG", c.EnableDebug).(bool), "true/false, will enable debug logging so all messages sent to the errorKernel will also be printed to STDERR")
flag.StringVar(&c.LogLevel, "logLevel", CheckEnv("LOG_LEVEL", c.LogLevel).(string), "error/info/warning/debug/none")
flag.BoolVar(&c.LogConsoleTimestamps, "LogConsoleTimestamps", CheckEnv("LOG_CONSOLE_TIMESTAMPS", c.LogConsoleTimestamps).(bool), "true/false for enabling or disabling timestamps when printing errors and information to stderr")
flag.IntVar(&c.KeepPublishersAliveFor, "keepPublishersAliveFor", CheckEnv("KEEP_PUBLISHERS_ALIVE_FOR", c.KeepPublishersAliveFor).(int), "The amount of time we allow a publisher to stay alive without receiving any messages to publish")
@ -292,8 +289,7 @@ func newConfigurationDefaults() Configuration {
EnableSocket: true,
EnableSignatureCheck: false,
EnableAclCheck: false,
EnableDebug: false,
LogLevel: "debug",
LogLevel: "info",
LogConsoleTimestamps: false,
KeepPublishersAliveFor: 10,

View file

@ -6,6 +6,12 @@ In operations ctrl can be used to send a set of commands to execute to a node, a
In forensics ctrl can be used to execute commands with tools to gather information needed. If the tools are not already present on an end ctrl node, ctrl can be used to copy the tools to that node, and then ctrl can run them to gather information.
</style>
</head>
<body>
<p align="center"><img src="https://github.com/postmannen/ctrl/blob/main/doc/core-messaging.svg?raw=true" /></p>
</body>
## Usecases
Some example usecases are:

View file

@ -2,11 +2,11 @@
Run ctrl as a docker container in a github workflow. This can for example be as part of a CI/CD pipeline, or for content versioning.
This howto will show the steps involved to get ctrl up and running as Github Action Runner. First we start with setting up a NATS Server, we then setup the local ctrl node **node1**, and then the node that will be started as a Github Action Runner.
Or with other words.. you have a github repository that holds the instructions for what ctrl should do. There is a github action attached to it. When the repository is updated, the github action will start a ctrl container (runner) which will read the instructions you pushed to the repository. The runner will then effectuate to instructions on all the nodes and the commands defined in the instructions.
This howto assumes that you have a nats-server setup, and at least one ctrl node instance up running. How to setup a **nats-server** and a **ctrl node** on a computer/server can be found in the **User Guides** section of the documentation.
This howto assumes that you have a nats-server setup, and at least one ctrl node instance up running. How to setup a basic **nats-server** and a **ctrl node** on a computer/server/container can be found in the **User Guides** section of the documentation.
In the examples below I've used the name **node1** as an example for the node that will receive the message when the github repository are updated.
In the examples below I've used the name **node1** as an example for the node that will receive the message when the github repository are updated, but this could be any number of nodes you'd like.
## Github Action Runner setup

View file

@ -55,6 +55,8 @@ LOG_LEVEL=info
START_PUB_HELLO=60
```
Create 2-3 (node1,node2,node3) nodes which will be the nodes that scrape some metrics on some host.
##### Startup folder
Each ctrl instance started will have a **startup** folder in it's running directory. Messages in the startup folder will be read at startup, and handled by ctrl.
@ -69,7 +71,7 @@ Put the following message in the **startup** folder on all the nodes that will c
# Deliver the message locally
- local
# Set the node where we send the reply with the result
fromNode: central
fromNode: metrics
method: httpGet
methodArgs:
- http://localhost:9100/metrics

View file

@ -78,7 +78,6 @@ func newServerForTesting(addressAndPort string, testFolder string) (*server, *Co
conf.DatabaseFolder = testFolder
conf.StartProcesses.IsCentralErrorLogger = true
conf.StartProcesses.IsCentralAcl = true
conf.EnableDebug = false
conf.LogLevel = "none"
ctrlServer, err := NewServer(&conf, "test")