修改deploy
This commit is contained in:
parent
8a65f639cb
commit
88c11e7a97
@ -20,8 +20,6 @@ RUN apt-get update \
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /build/target/release/rtr_debug_client /usr/local/bin/rtr_debug_client
|
COPY --from=builder /build/target/release/rtr_debug_client /usr/local/bin/rtr_debug_client
|
||||||
COPY deploy/client/entrypoint.sh /usr/local/bin/rtr-debug-client-entrypoint.sh
|
COPY --chmod=755 deploy/client/entrypoint.sh /usr/local/bin/rtr-debug-client-entrypoint.sh
|
||||||
|
|
||||||
RUN chmod +x /usr/local/bin/rtr-debug-client-entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/rtr-debug-client-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/rtr-debug-client-entrypoint.sh"]
|
||||||
|
|||||||
@ -61,6 +61,7 @@ RUN apt-get update \
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /build/target/release/rpki /usr/local/bin/rpki
|
COPY --from=builder /build/target/release/rpki /usr/local/bin/rpki
|
||||||
|
COPY --chmod=755 deploy/server/entrypoint.sh /usr/local/bin/rpki-rtr-entrypoint.sh
|
||||||
|
|
||||||
RUN mkdir -p /app/data /app/rtr-db /app/certs /app/slurm /app/logs
|
RUN mkdir -p /app/data /app/rtr-db /app/certs /app/slurm /app/logs
|
||||||
|
|
||||||
@ -75,4 +76,4 @@ ENV RPKI_RTR_ENABLE_TLS=false \
|
|||||||
|
|
||||||
EXPOSE 323 324
|
EXPOSE 323 324
|
||||||
|
|
||||||
CMD ["/usr/local/bin/rpki"]
|
ENTRYPOINT ["/usr/local/bin/rpki-rtr-entrypoint.sh"]
|
||||||
|
|||||||
10
deploy/server/entrypoint.sh
Normal file
10
deploy/server/entrypoint.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
mkdir -p /app/logs
|
||||||
|
|
||||||
|
log_name="${HOSTNAME:-rpki-rtr}"
|
||||||
|
stdout_log="/app/logs/${log_name}.stdout.log"
|
||||||
|
stderr_log="/app/logs/${log_name}.stderr.log"
|
||||||
|
|
||||||
|
exec /usr/local/bin/rpki "$@" >>"$stdout_log" 2>>"$stderr_log"
|
||||||
34
src/main.rs
34
src/main.rs
@ -1,7 +1,7 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::time::Duration;
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
use chrono::{FixedOffset, Utc};
|
use chrono::{FixedOffset, Utc};
|
||||||
@ -284,13 +284,29 @@ fn init_shared_cache(config: &AppConfig, store: &RtrStore) -> Result<SharedRtrCa
|
|||||||
slurm_dir: config.slurm_dir.clone(),
|
slurm_dir: config.slurm_dir.clone(),
|
||||||
strict_ccr_validation: config.strict_ccr_validation,
|
strict_ccr_validation: config.strict_ccr_validation,
|
||||||
};
|
};
|
||||||
|
let source_to_delta_started = Instant::now();
|
||||||
let initial_cache = RtrCache::default().init(
|
let initial_cache = RtrCache::default().init(
|
||||||
store,
|
store,
|
||||||
config.max_delta,
|
config.max_delta,
|
||||||
config.prune_delta_by_snapshot_size,
|
config.prune_delta_by_snapshot_size,
|
||||||
config.timing,
|
config.timing,
|
||||||
|| load_payloads_from_latest_sources(&payload_load_config),
|
|| {
|
||||||
|
let payloads = load_payloads_from_latest_sources(&payload_load_config)?;
|
||||||
|
info!(
|
||||||
|
"RTR source-to-delta timing: phase=startup_load_complete, ccr_dir={}, payload_count={}, elapsed_ms={}",
|
||||||
|
payload_load_config.ccr_dir,
|
||||||
|
payloads.len(),
|
||||||
|
source_to_delta_started.elapsed().as_millis()
|
||||||
|
);
|
||||||
|
Ok(payloads)
|
||||||
|
},
|
||||||
)?;
|
)?;
|
||||||
|
info!(
|
||||||
|
"RTR source-to-delta timing: phase=startup_cache_init_complete, ccr_dir={}, serials={:?}, elapsed_ms={}",
|
||||||
|
payload_load_config.ccr_dir,
|
||||||
|
initial_cache.serials(),
|
||||||
|
source_to_delta_started.elapsed().as_millis()
|
||||||
|
);
|
||||||
|
|
||||||
let shared_cache: SharedRtrCache = Arc::new(RwLock::new(initial_cache));
|
let shared_cache: SharedRtrCache = Arc::new(RwLock::new(initial_cache));
|
||||||
|
|
||||||
@ -369,6 +385,7 @@ fn spawn_refresh_task(
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
interval.tick().await;
|
interval.tick().await;
|
||||||
|
let source_to_delta_started = Instant::now();
|
||||||
|
|
||||||
match load_payloads_from_latest_sources(&payload_load_config) {
|
match load_payloads_from_latest_sources(&payload_load_config) {
|
||||||
Ok(payloads) => {
|
Ok(payloads) => {
|
||||||
@ -410,6 +427,13 @@ fn spawn_refresh_task(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
info!(
|
||||||
|
"RTR source-to-delta timing: phase=refresh_cache_update_complete, ccr_dir={}, payload_count={}, changed={}, elapsed_ms={}",
|
||||||
|
payload_load_config.ccr_dir,
|
||||||
|
payload_count,
|
||||||
|
updated,
|
||||||
|
source_to_delta_started.elapsed().as_millis()
|
||||||
|
);
|
||||||
|
|
||||||
if updated {
|
if updated {
|
||||||
notifier.notify_cache_updated();
|
notifier.notify_cache_updated();
|
||||||
@ -418,8 +442,10 @@ fn spawn_refresh_task(
|
|||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(
|
warn!(
|
||||||
"failed to reload CCR/SLURM payloads from {}: {:?}",
|
"failed to reload CCR/SLURM payloads from {}: {:?} (source_to_delta_elapsed_ms={})",
|
||||||
payload_load_config.ccr_dir, err
|
payload_load_config.ccr_dir,
|
||||||
|
err,
|
||||||
|
source_to_delta_started.elapsed().as_millis()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user