rtr client 开发
This commit is contained in:
40
deploy/server/DEPLOYMENT.md
Normal file
40
deploy/server/DEPLOYMENT.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Deployment (Supervisor + Docker Compose)
|
||||
|
||||
This project runs `src/main.rs` as a long-running server that:
|
||||
|
||||
1. loads latest `.ccr` from a configured directory,
|
||||
2. applies optional SLURM filtering,
|
||||
3. starts RTR server.
|
||||
|
||||
`supervisord` is used as PID 1 in container to keep the process managed and auto-restarted.
|
||||
|
||||
## Files
|
||||
|
||||
- `deploy/server/Dockerfile`
|
||||
- `deploy/server/supervisord.conf`
|
||||
- `deploy/server/docker-compose.yml`
|
||||
|
||||
## Runtime Paths in Container
|
||||
|
||||
- CCR directory: `/app/data`
|
||||
- RocksDB directory: `/app/rtr-db`
|
||||
- SLURM directory: `/app/slurm`
|
||||
- TLS cert directory (optional): `/app/certs`
|
||||
|
||||
## Start
|
||||
|
||||
```bash
|
||||
docker compose -f deploy/server/docker-compose.yml up -d --build
|
||||
```
|
||||
|
||||
## Stop
|
||||
|
||||
```bash
|
||||
docker compose -f deploy/server/docker-compose.yml down
|
||||
```
|
||||
|
||||
## Logs
|
||||
|
||||
```bash
|
||||
docker compose -f deploy/server/docker-compose.yml logs -f rpki-rtr
|
||||
```
|
||||
44
deploy/server/Dockerfile
Normal file
44
deploy/server/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
FROM rust:1.89-bookworm AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake \
|
||||
pkg-config \
|
||||
clang \
|
||||
libclang-dev \
|
||||
libssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY src ./src
|
||||
|
||||
RUN cargo build --release --bin rpki
|
||||
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates supervisor \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /build/target/release/rpki /usr/local/bin/rpki
|
||||
COPY deploy/server/supervisord.conf /etc/supervisor/conf.d/rpki-rtr.conf
|
||||
|
||||
RUN mkdir -p /app/data /app/rtr-db /app/certs /app/slurm /var/log/supervisor
|
||||
|
||||
ENV RPKI_RTR_ENABLE_TLS=false \
|
||||
RPKI_RTR_TCP_ADDR=0.0.0.0:323 \
|
||||
RPKI_RTR_TLS_ADDR=0.0.0.0:324 \
|
||||
RPKI_RTR_DB_PATH=/app/rtr-db \
|
||||
RPKI_RTR_CCR_DIR=/app/data \
|
||||
RPKI_RTR_SLURM_DIR=/app/slurm \
|
||||
RPKI_RTR_REFRESH_INTERVAL_SECS=300 \
|
||||
RPKI_RTR_STRICT_CCR_VALIDATION=false
|
||||
|
||||
EXPOSE 323 324
|
||||
|
||||
CMD ["supervisord", "-n", "-c", "/etc/supervisor/conf.d/rpki-rtr.conf"]
|
||||
28
deploy/server/docker-compose.yml
Normal file
28
deploy/server/docker-compose.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
rpki-rtr:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: deploy/server/Dockerfile
|
||||
image: rpki-rtr:latest
|
||||
container_name: rpki-rtr
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "323:323"
|
||||
- "324:324"
|
||||
environment:
|
||||
RPKI_RTR_ENABLE_TLS: "false"
|
||||
RPKI_RTR_TCP_ADDR: "0.0.0.0:323"
|
||||
RPKI_RTR_TLS_ADDR: "0.0.0.0:324"
|
||||
RPKI_RTR_DB_PATH: "/app/rtr-db"
|
||||
RPKI_RTR_CCR_DIR: "/app/data"
|
||||
RPKI_RTR_SLURM_DIR: "/app/slurm"
|
||||
RPKI_RTR_STRICT_CCR_VALIDATION: "false"
|
||||
RPKI_RTR_REFRESH_INTERVAL_SECS: "300"
|
||||
volumes:
|
||||
- ../../data:/app/data:ro
|
||||
- ../../rtr-db:/app/rtr-db
|
||||
- ../../data:/app/slurm:ro
|
||||
# TLS mode example:
|
||||
# - ../../certs:/app/certs:ro
|
||||
18
deploy/server/supervisord.conf
Normal file
18
deploy/server/supervisord.conf
Normal file
@@ -0,0 +1,18 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
pidfile=/tmp/supervisord.pid
|
||||
|
||||
[program:rpki-rtr]
|
||||
command=/usr/local/bin/rpki
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=2
|
||||
startretries=3
|
||||
stopsignal=TERM
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/fd/2
|
||||
stderr_logfile_maxbytes=0
|
||||
Reference in New Issue
Block a user