-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cctl module and extend e2e test to use it #46
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f04b4eb
cctld: initial impl using kairos-test-utils
marijanp d9b3eed
nixos/modules/cctl: initial module definition
marijanp ae1e56f
nixos/e2e: add cctl nixos module to e2e test
marijanp 6f9bbdc
Merge branch 'main' into add-cctl-module
marijanp e880399
Merge branch 'main' into add-cctl-module
marijanp a0d71e8
nixos/cctl: use string log level since casper-node uses tracing
marijanp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use kairos_test_utils::cctl; | ||
use sd_notify::NotifyState; | ||
use tokio::signal; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let _network = cctl::CCTLNetwork::run() | ||
.await | ||
.expect("An error occured while starting the CCTL network"); | ||
|
||
let _ = sd_notify::notify(true, &[NotifyState::Ready]); | ||
signal::ctrl_c().await?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ lib, pkgs, config, ... }: | ||
let | ||
inherit (lib) | ||
types | ||
mkOption | ||
mkIf | ||
mkMerge | ||
mkEnableOption | ||
mdDoc | ||
; | ||
cfg = config.services.cctl; | ||
in | ||
{ | ||
options.services.cctl = { | ||
|
||
enable = mkEnableOption (mdDoc "cctl"); | ||
|
||
package = mkOption { | ||
type = types.package; | ||
}; | ||
|
||
port = mkOption { | ||
type = types.port; | ||
default = 11101; | ||
example = 60000; | ||
description = mdDoc '' | ||
Port to listen on. | ||
TODO make port configurable in cctl | ||
''; | ||
}; | ||
|
||
logLevel = mkOption { | ||
type = types.enum [ | ||
"error" | ||
"warn" | ||
"info" | ||
"debug" | ||
"trace" | ||
]; | ||
marijanp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
default = "info"; | ||
description = '' | ||
The log-level that should be used. | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
|
||
systemd.services.cctl = | ||
{ | ||
description = "cctl"; | ||
documentation = [ "" ]; | ||
wantedBy = [ "multi-user.target" ]; | ||
after = [ "network-online.target" ]; | ||
requires = [ "network-online.target" ]; | ||
environment = { | ||
RUST_LOG = cfg.logLevel; | ||
}; | ||
serviceConfig = mkMerge [ | ||
{ | ||
ExecStart = ''${lib.getExe cfg.package}''; | ||
Type = "notify"; | ||
Restart = "always"; | ||
DynamicUser = true; | ||
} | ||
]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just do it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because CCTL does not offer a way to do that yet. Mark is aware of it and working on it.