-
-
Notifications
You must be signed in to change notification settings - Fork 88
feat: wip traffic detection #880
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
Conversation
@@ -14,7 +14,7 @@ RUN cargo chef prepare --recipe-path recipe.json | |||
# ------------------ # | |||
FROM lukemathwalker/cargo-chef:latest-rust-${RUST_VERSION} as cacher | |||
WORKDIR /data/odin | |||
RUN apt-get update && apt-get install -y cmake | |||
RUN apt-get update && apt-get install -y cmake libpcap-dev |
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.
pcap used to sniff for packets
@@ -21,7 +21,7 @@ member_clippy: | |||
cargo clippy | |||
|
|||
docker-build: setup | |||
docker compose -f ./docker-compose.dev.yml build | |||
docker compose -f ./docker-compose.dev.yml build --progress=plain |
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 docker stdio hides critical build failure output by default
@@ -2,6 +2,7 @@ version: "3" | |||
services: | |||
odin: | |||
image: mbround18/odin:latest | |||
platform: "linux/amd64" |
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.
i'm on mac m1 with arm.
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.
This should only really be in your docker-compose.dev.yaml but have you had success running valheim on m1? weve had lots of issues before with people struggling with it.
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.
arrggg no i couldn't dev at all! i should have searched earlier 😢
@@ -58,6 +58,9 @@ pub struct Configuration { | |||
|
|||
/// Sets the save interval in seconds | |||
pub save_interval: Option<u16>, | |||
|
|||
/// Steam home dirname | |||
pub steam_home_dirname: String, |
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.
the repo is very much coded to only be executing in cointainer. i just couldnt get the container to ever boot. the steam script segfaulting and not emitting any output :(
i figured "maybe i can at least unit/integration test my feature" without actually running a real server. however, 'odin configure' and 'odin install' were some pre-reqs that i only started to hack through to test this approach, but well exceeded my timebox today
src/odin/commands/configure.rs
Outdated
Path::new("/home/steam/.bashrc"), | ||
PathBuf::from_iter([&self.steam_home_dirname, "valheim"]), | ||
PathBuf::from_iter([&self.steam_home_dirname, "scripts"]), | ||
PathBuf::from_iter([&self.steam_home_dirname, ".bashrc"]) |
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.
my attempts to support running external of the container, by de-hardcoding these values
error!(target: "commands_start", "Error: {}", err); | ||
exit(1); | ||
}) | ||
.expect("failed to daemonize server") |
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.
i didn't see a repo error enum, but didn't want to a) introduce one or b) go .unwrap()
crazy, so i opted to just use String
as the Err
variant to get sane messaging propagated up. not married to it (or any of this really) at all!
src/odin/commands/start.rs
Outdated
match pause_on_idle_s > 0 { | ||
true => loop { | ||
let mut child = run_server(&config); | ||
let _ = server::spawn_kill_on_idle(&mut child, pause_on_idle_s).map_err(|err| { |
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.
let _ = server::spawn_kill_on_idle(&mut child, pause_on_idle_s).map_err(|err| { | |
let _ = server::kill_on_idle(&mut child, pause_on_idle_s).map_err(|err| { |
src/odin/server/traffic.rs
Outdated
|
||
use pcap::{Capture, Device}; | ||
|
||
pub fn spawn_kill_on_idle(child: &mut Child, pause_on_idle_s: u32) -> Result<(), String> { |
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.
well, the plan was to pause the process. i realized... i'd need another cgroup to pause anything, and i'm not yet talented enough to do that. so, my first pass was going to be naively killing the pid, then rebooting it on traffic. then on a second pass, try the whole pause/resume bit, once i can learn about firing up that server in a pausable cgroup.
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.
arrrg i'm such a dummy! the proc does respond to SIGSTOP/SIGCONT already. no cgroups required
src/odin/server/traffic.rs
Outdated
|
||
use pcap::{Capture, Device}; | ||
|
||
pub fn spawn_kill_on_idle(child: &mut Child, pause_on_idle_s: u32) -> Result<(), String> { |
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.
pub fn spawn_kill_on_idle(child: &mut Child, pause_on_idle_s: u32) -> Result<(), String> { | |
pub fn kill_on_idle(child: &mut Child, pause_on_idle_s: u32) -> Result<(), String> { |
} | ||
child.kill().map_err(|e| e.to_string())?; | ||
Ok(()) | ||
} |
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.
really, this is probably wrong to block the main thread. should probably have this as a bg thread, with an Arc<Mutex<Child>>
that is swapped on restart
@cdaringe this is a really good first pass! :) ill start diving through it later tonight, apologies on delay man ive been busy remodeling a kitchen |
closing for now, just to halt the constant auto-merges 😄 |
Description
Contributions
Checklist