From ff91be312cffe7da7cd92148e46b114bf29a7604 Mon Sep 17 00:00:00 2001 From: "Ivan A. Kudriavtsev" Date: Thu, 13 Jun 2024 11:43:39 +0200 Subject: [PATCH] fixed bugs with ipc permissions and listened port --- Cargo.toml | 2 +- replay/assets/test.json | 7 ++++--- replay/src/main.rs | 2 +- replaydb/src/service/configuration.rs | 11 ++++++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ca3cd06..9fefda9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ tokio-timerfd = "0.2" uuid = { version = "1", features = ["v7"] } [workspace.package] -version = "0.5.0" +version = "0.6.0" edition = "2021" authors = ["Ivan Kudriavtsev "] description = "ReplayDB Service" diff --git a/replay/assets/test.json b/replay/assets/test.json index 7efd9b6..2b6736a 100644 --- a/replay/assets/test.json +++ b/replay/assets/test.json @@ -1,7 +1,7 @@ { "common": { "pass_metadata_only": false, - "management_port": 8080, + "management_port": ${API_PORT:-8080}, "stats_period": { "secs": 60, "nanos": 0 @@ -17,7 +17,7 @@ } }, "in_stream": { - "url": "router+bind:tcp://0.0.0.0:5555", + "url": "${IN_STREAM:-router+bind:tcp://0.0.0.0:5555}", "receive_timeout": { "secs": 1, "nanos": 0 @@ -27,7 +27,8 @@ "none": null }, "source_cache_size": 1000, - "inflight_ops": 100 + "inflight_ops": 100, + "fix_ipc_permissions": 511 }, "out_stream": { "url": "pub+bind:tcp://0.0.0.0:5556", diff --git a/replay/src/main.rs b/replay/src/main.rs index 4757894..fdcbbad 100644 --- a/replay/src/main.rs +++ b/replay/src/main.rs @@ -62,7 +62,7 @@ async fn main() -> Result<()> { App::new().service(scope) }) - .bind(("127.0.0.1", port))? + .bind(("0.0.0.0", port))? .run(), ); diff --git a/replaydb/src/service/configuration.rs b/replaydb/src/service/configuration.rs index cdcd131..a325538 100644 --- a/replaydb/src/service/configuration.rs +++ b/replaydb/src/service/configuration.rs @@ -86,14 +86,19 @@ impl TryFrom<&SourceConfiguration> for NonBlockingReader { fn try_from( source_conf: &SourceConfiguration, ) -> result::Result { - let conf = ReaderConfigBuilder::default() - .url(&source_conf.url)? + let conf = ReaderConfigBuilder::default().url(&source_conf.url)?; + let conf = if let Some(fix_ipc_permissions) = source_conf.fix_ipc_permissions { + conf.with_fix_ipc_permissions(Some(fix_ipc_permissions))? + } else { + ReaderConfigBuilder::default().url(&source_conf.url)? + }; + let conf = conf .with_receive_timeout(source_conf.receive_timeout.as_millis() as i32)? .with_receive_hwm(source_conf.receive_hwm as i32)? .with_topic_prefix_spec((&source_conf.topic_prefix_spec).into())? .with_routing_cache_size(source_conf.source_cache_size)? - .with_fix_ipc_permissions(source_conf.fix_ipc_permissions)? .build()?; + let mut reader = NonBlockingReader::new(&conf, source_conf.inflight_ops)?; reader.start()?; Ok(reader)