Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions devops/docker/compose/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ services:
start_period: 5s
retries: 3

trogon-sink-github:
trogon-source-github:
build:
context: ../../../rsworkspace
dockerfile: crates/trogon-sink-github/Dockerfile
dockerfile: crates/trogon-source-github/Dockerfile
ports:
- "${GITHUB_WEBHOOK_PORT:-8080}:${GITHUB_WEBHOOK_PORT:-8080}"
environment:
Expand Down Expand Up @@ -55,9 +55,9 @@ services:
- --url
- "${SMEE_URL:?SMEE_URL is required — create a channel at https://smee.io}"
- --target
- "http://trogon-sink-github:${GITHUB_WEBHOOK_PORT:-8080}/webhook"
- "http://trogon-source-github:${GITHUB_WEBHOOK_PORT:-8080}/webhook"
depends_on:
trogon-sink-github:
trogon-source-github:
condition: service_healthy
restart: unless-stopped
profiles:
Expand Down
10 changes: 5 additions & 5 deletions rsworkspace/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions rsworkspace/crates/acp-telemetry/src/service_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
pub enum ServiceName {
AcpNatsStdio,
AcpNatsWs,
TrogonSinkGithub,
TrogonSourceGithub,
}

impl ServiceName {
pub fn as_str(self) -> &'static str {
match self {
Self::AcpNatsStdio => "acp-nats-stdio",
Self::AcpNatsWs => "acp-nats-ws",
Self::TrogonSinkGithub => "trogon-sink-github",
Self::TrogonSourceGithub => "trogon-source-github",
}
}
}
Expand All @@ -32,16 +32,16 @@ mod tests {
fn as_str_returns_expected_values() {
assert_eq!(ServiceName::AcpNatsStdio.as_str(), "acp-nats-stdio");
assert_eq!(ServiceName::AcpNatsWs.as_str(), "acp-nats-ws");
assert_eq!(ServiceName::TrogonSinkGithub.as_str(), "trogon-sink-github");
assert_eq!(ServiceName::TrogonSourceGithub.as_str(), "trogon-source-github");
}

#[test]
fn display_delegates_to_as_str() {
assert_eq!(format!("{}", ServiceName::AcpNatsStdio), "acp-nats-stdio");
assert_eq!(format!("{}", ServiceName::AcpNatsWs), "acp-nats-ws");
assert_eq!(
format!("{}", ServiceName::TrogonSinkGithub),
"trogon-sink-github"
format!("{}", ServiceName::TrogonSourceGithub),
"trogon-source-github"
);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "trogon-sink-github"
name = "trogon-source-github"
version = "0.1.0"
edition = "2024"

[lints]
workspace = true

[[bin]]
name = "trogon-sink-github"
name = "trogon-source-github"
path = "src/main.rs"

[dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder

COPY --from=planner /build/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json -p trogon-sink-github
RUN cargo chef cook --release --recipe-path recipe.json -p trogon-source-github

COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/

RUN cargo build --release -p trogon-sink-github && \
strip target/release/trogon-sink-github
RUN cargo build --release -p trogon-source-github && \
strip target/release/trogon-source-github

# ── Stage 4: runtime ────────────────────────────────────────────────────────
FROM debian:bookworm-20250317-slim AS runtime
Expand All @@ -34,12 +34,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

RUN useradd --no-create-home --shell /usr/sbin/nologin trogon

COPY --from=builder /build/target/release/trogon-sink-github /usr/local/bin/trogon-sink-github
COPY --from=builder /build/target/release/trogon-source-github /usr/local/bin/trogon-source-github

USER trogon

EXPOSE 8080

STOPSIGNAL SIGTERM

ENTRYPOINT ["/usr/local/bin/trogon-sink-github"]
ENTRYPOINT ["/usr/local/bin/trogon-source-github"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! # trogon-sink-github
//! # trogon-source-github
//!
//! GitHub webhook receiver that publishes events to NATS JetStream.
//!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[cfg(not(coverage))]
use {
acp_telemetry::ServiceName, tracing::error, tracing::info, trogon_nats::connect,
trogon_nats::jetstream::NatsJetStreamClient, trogon_sink_github::GithubConfig,
trogon_sink_github::constants::DEFAULT_NATS_CONNECT_TIMEOUT, trogon_std::env::SystemEnv,
trogon_nats::jetstream::NatsJetStreamClient, trogon_source_github::GithubConfig,
trogon_source_github::constants::DEFAULT_NATS_CONNECT_TIMEOUT, trogon_std::env::SystemEnv,
trogon_std::fs::SystemFs,
};

Expand All @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = GithubConfig::from_env(&SystemEnv);

acp_telemetry::init_logger(
ServiceName::TrogonSinkGithub,
ServiceName::TrogonSourceGithub,
&config.subject_prefix,
&SystemEnv,
&SystemFs,
Expand All @@ -22,7 +22,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let nats = connect(&config.nats, DEFAULT_NATS_CONNECT_TIMEOUT).await?;
let js = NatsJetStreamClient::new(async_nats::jetstream::new(nats));
let result = trogon_sink_github::serve(js, config).await;
let result = trogon_source_github::serve(js, config).await;

if let Err(ref e) = result {
error!(error = %e, "GitHub webhook server stopped with error");
Expand Down
Loading