From 87607a3991f79dd9628ad17c0e4baaea685c46f9 Mon Sep 17 00:00:00 2001 From: yuyr Date: Fri, 10 Jul 2026 14:44:43 +0800 Subject: [PATCH] =?UTF-8?q?20260710=20=E6=94=B6=E6=95=9BDocker=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8C=85Compose=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/docker-compose/.env.example | 94 -- deploy/docker-compose/docker-compose.yml | 96 -- .../grafana/dashboards/ours-rp-repo-sync.json | 761 --------------- .../dashboards/ours-rp-soak-overview.json | 875 ------------------ .../provisioning/dashboards/dashboard.yml | 12 - .../provisioning/datasources/prometheus.yml | 10 - deploy/docker-compose/prometheus.yml | 13 - deploy/docker-installer/docs/README.en.md | 6 + deploy/docker-installer/docs/README.zh-CN.md | 6 + .../docker/deploy_remote233_arm64_compose.sh | 182 ---- 10 files changed, 12 insertions(+), 2043 deletions(-) delete mode 100644 deploy/docker-compose/.env.example delete mode 100644 deploy/docker-compose/docker-compose.yml delete mode 100644 deploy/docker-compose/grafana/dashboards/ours-rp-repo-sync.json delete mode 100644 deploy/docker-compose/grafana/dashboards/ours-rp-soak-overview.json delete mode 100644 deploy/docker-compose/grafana/provisioning/dashboards/dashboard.yml delete mode 100644 deploy/docker-compose/grafana/provisioning/datasources/prometheus.yml delete mode 100644 deploy/docker-compose/prometheus.yml delete mode 100755 scripts/docker/deploy_remote233_arm64_compose.sh diff --git a/deploy/docker-compose/.env.example b/deploy/docker-compose/.env.example deleted file mode 100644 index af728f1..0000000 --- a/deploy/docker-compose/.env.example +++ /dev/null @@ -1,94 +0,0 @@ -# ours RP Docker Compose 示例配置(remote233 ARM64/QEMU 示例) -# 复制为 .env 后再启动: -# cp .env.example .env - -# 业务镜像名称;需要先通过 docker load 导入远端 Docker。 -RPKI_IMAGE=ours-rp-runtime-arm64:dev - -# remote233 示例强制以 ARM64 运行;目标机器为 x86_64,需要 binfmt/qemu 支持。 -RPKI_PLATFORM=linux/arm64 - -# metrics sidecar 独立镜像。 -METRICS_IMAGE=ours-rp-metrics-arm64:dev -METRICS_PLATFORM=linux/arm64 -MONITOR_PLATFORM=linux/arm64 - -# 验收默认只跑 APNIC;all5 可改成 afrinic,apnic,arin,lacnic,ripe。 -RIRS=apnic - -# 固定跑两轮:首轮 snapshot,第二轮 delta。 -# 负数表示持续运行;ARM64 QEMU 首版验收不建议默认持续运行。 -MAX_RUNS=2 - -# 两轮之间间隔秒数。 -INTERVAL_SECS=0 - -# 保留最近多少个 run 目录。 -RETAIN_RUNS=5 - -# TA/TAL 输入模式: -# - file-with-ta:完全使用镜像内 fixture; -# - file-live-ta:snapshot 轮先完成 live TA 获取,delta 轮后台刷新 TA; -# - url:从 TAL URL 拉取。 -TAL_INPUT_MODE=file-live-ta - -# rsync 默认按 module-root 批量拉取,和当前 ours RP soak 默认优化配置一致。 -RSYNC_SCOPE=module-root - -# 容器里不需要杀宿主机上的其他 RP 进程;远端宿主机如有竞争进程,请在宿主机侧处理。 -DISABLE_COMPETING_RPS=0 - -# 运行态数据目录。容器内固定路径,外部由 compose volume 保存。 -RUN_ROOT=/var/lib/ours-rp -DB_DIR=/var/lib/ours-rp/state/db -RSYNC_MIRROR_ROOT=/var/lib/ours-rp/state/rsync-mirror - -# 每轮结束后清理 daemon 临时目录。 -# Docker Compose 中 tmp 是独立 volume 挂载点;脚本只清理挂载点内部 daemon-run_*,默认开启。 -CLEAN_TMP_AFTER_RUN=1 - -# 报告使用 compact JSON,降低写盘体积。 -OUTPUT_COMPACT_REPORT=1 - -# 复用 rsync mirror,避免 delta 每轮从零拉取。 -ALLOW_RSYNC_MIRROR_REUSE=1 - -# 前一轮失败时,新一轮从 snapshot 恢复。 -FAILURE_SNAPSHOT_RESET=1 - -# QEMU 验收优先降低额外统计开销;需要精确 DB 统计时改为 3 或其他正整数。 -DB_STATS_EXACT_EVERY=0 - -# 开启当前主线使用的验证缓存与请求预取能力。 -ENABLE_CHILD_CERTIFICATE_VALIDATION_CACHE=1 -RPKI_ANALYZE=1 -RPKI_EXTRA_ARGS="--enable-transport-request-prefetch --enable-publication-point-validation-cache --enable-roa-validation-cache --parallel-max-repo-sync-workers-global 4 --parallel-phase2-object-workers 4 --memory-trim-after-validation" - -# 进度日志阈值。QEMU 下执行较慢,阈值不宜过低。 -RPKI_PROGRESS_LOG=1 -RPKI_PROGRESS_SLOW_SECS=20 -RPKI_PROGRESS_STAGE_FRESH_SLOW_MS=2000 -RPKI_PROGRESS_PP_CONTROL_SLOW_MS=200 -RPKI_PROGRESS_PP_CACHE_SLOW_MS=100 -RPKI_PROGRESS_CONTROL_LOOP_SLOW_MS=2000 - -# live TA 刷新超时。 -LIVE_TA_REFRESH_CONNECT_TIMEOUT_SECS=15 -LIVE_TA_REFRESH_MAX_TIME_SECS=120 - -# file-live-ta 在 snapshot 轮先完成 live TA 获取再启动子进程,避免首轮使用旧 fixture TA。 -LIVE_TA_REFRESH_BEFORE_SNAPSHOT=1 - -# metrics sidecar 配置。 -METRICS_INSTANCE=remote233-arm64-qemu -METRICS_PORT=9556 -METRICS_POLL_SECS=10 - -# Prometheus / Grafana 配置。 -PROMETHEUS_IMAGE=prom/prometheus:v2.55.1 -GRAFANA_IMAGE=grafana/grafana:11.3.1 -PROMETHEUS_PORT=9090 -PROMETHEUS_RETENTION=7d -GRAFANA_PORT=3000 -GRAFANA_ADMIN_USER=admin -GRAFANA_ADMIN_PASSWORD=admin diff --git a/deploy/docker-compose/docker-compose.yml b/deploy/docker-compose/docker-compose.yml deleted file mode 100644 index 8ecf04c..0000000 --- a/deploy/docker-compose/docker-compose.yml +++ /dev/null @@ -1,96 +0,0 @@ -services: - ours-rp-soak: - image: ${RPKI_IMAGE:?RPKI_IMAGE is required} - platform: ${RPKI_PLATFORM:?RPKI_PLATFORM is required} - container_name: ${COMPOSE_PROJECT_NAME:-ours-rp-compose}-soak - env_file: - - ./.env - environment: - PACKAGE_ROOT: /opt/ours-rp - ENV_FILE: /opt/ours-rp/.env - RUN_ROOT: /var/lib/ours-rp - BIN_DIR: /opt/ours-rp/bin - FIXTURE_DIR: /opt/ours-rp/fixtures - volumes: - - ./.env:/opt/ours-rp/.env:ro - - rpki-state:/var/lib/ours-rp/state - - rpki-runs:/var/lib/ours-rp/runs - - rpki-logs:/var/lib/ours-rp/logs - - rpki-tmp:/var/lib/ours-rp/tmp - restart: "no" - profiles: - - core - - artifact-metrics: - image: ${METRICS_IMAGE:?METRICS_IMAGE is required} - platform: ${METRICS_PLATFORM:?METRICS_PLATFORM is required} - container_name: ${COMPOSE_PROJECT_NAME:-ours-rp-compose}-artifact-metrics - env_file: - - ./.env - command: - - /opt/ours-rp/bin/rpki_artifact_metrics - - --run-root - - /var/lib/ours-rp - - --listen - - 0.0.0.0:9556 - - --poll-secs - - ${METRICS_POLL_SECS:-10} - - --instance - - ${METRICS_INSTANCE:-docker-compose} - ports: - - "${METRICS_PORT:-9556}:9556" - volumes: - - rpki-state:/var/lib/ours-rp/state:ro - - rpki-runs:/var/lib/ours-rp/runs:ro - - rpki-logs:/var/lib/ours-rp/logs:ro - restart: unless-stopped - profiles: - - sidecar - - prometheus: - image: ${PROMETHEUS_IMAGE:-prom/prometheus:v2.55.1} - platform: ${MONITOR_PLATFORM:?MONITOR_PLATFORM is required} - container_name: ${COMPOSE_PROJECT_NAME:-ours-rp-compose}-prometheus - command: - - --config.file=/etc/prometheus/prometheus.yml - - --storage.tsdb.path=/prometheus - - --storage.tsdb.retention.time=${PROMETHEUS_RETENTION:-7d} - - --web.enable-lifecycle - depends_on: - - artifact-metrics - ports: - - "${PROMETHEUS_PORT:-9090}:9090" - volumes: - - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - - prometheus-data:/prometheus - restart: unless-stopped - profiles: - - monitor - - grafana: - image: ${GRAFANA_IMAGE:-grafana/grafana:11.3.1} - platform: ${MONITOR_PLATFORM:?MONITOR_PLATFORM is required} - container_name: ${COMPOSE_PROJECT_NAME:-ours-rp-compose}-grafana - depends_on: - - prometheus - ports: - - "${GRAFANA_PORT:-3000}:3000" - environment: - GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin} - GF_USERS_ALLOW_SIGN_UP: "false" - volumes: - - grafana-data:/var/lib/grafana - - ./grafana/provisioning:/etc/grafana/provisioning:ro - - ./grafana/dashboards:/var/lib/grafana/dashboards:ro - restart: unless-stopped - profiles: - - monitor - -volumes: - rpki-state: - rpki-runs: - rpki-logs: - rpki-tmp: - prometheus-data: - grafana-data: diff --git a/deploy/docker-compose/grafana/dashboards/ours-rp-repo-sync.json b/deploy/docker-compose/grafana/dashboards/ours-rp-repo-sync.json deleted file mode 100644 index 1c7ccc1..0000000 --- a/deploy/docker-compose/grafana/dashboards/ours-rp-repo-sync.json +++ /dev/null @@ -1,761 +0,0 @@ -{ - "annotations": { - "list": [] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": null, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 0, - "y": 0 - }, - "id": 1, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_publication_points", - "legendFormat": "publication points", - "refId": "A" - } - ], - "title": "Publication Points", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 6, - "y": 0 - }, - "id": 2, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_repo_sync_phase_count{phase=\"rrdp_ok\"}", - "legendFormat": "rrdp ok", - "refId": "A" - } - ], - "title": "RRDP OK Points", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 12, - "y": 0 - }, - "id": 3, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "sum(ours_rp_repo_sync_phase_count{phase=\"rrdp_failed_rsync_ok\"}) or vector(0)", - "legendFormat": "fallback", - "refId": "A" - } - ], - "title": "Rsync Fallback Points", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 18, - "y": 0 - }, - "id": 4, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_repo_terminal_state_count{terminal_state=\"failed_no_cache\"}", - "legendFormat": "failed no cache", - "refId": "A" - } - ], - "title": "Failed No Cache Points", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 4 - }, - "id": 5, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"repo_sync_total\"}", - "legendFormat": "repo sync total", - "refId": "A" - }, - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"rrdp_download_total\"}", - "legendFormat": "rrdp download", - "refId": "B" - }, - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"rsync_download_total\"}", - "legendFormat": "rsync download", - "refId": "C" - } - ], - "title": "Repo Sync Download Durations", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 12, - "w": 12, - "h": 8 - }, - "id": 6, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_repo_sync_phase_count", - "legendFormat": "{{phase}}", - "refId": "A" - } - ], - "title": "Repo Sync Phase Counts", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 12, - "w": 12, - "h": 8 - }, - "id": 7, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_repo_sync_phase_count{phase=\"rrdp_failed_rsync_ok\"}", - "legendFormat": "rrdp failed, rsync ok", - "refId": "A" - }, - { - "expr": "ours_rp_repo_sync_phase_count{phase=\"rrdp_failed_rsync_failed\"}", - "legendFormat": "rrdp failed, rsync failed", - "refId": "B" - }, - { - "expr": "ours_rp_repo_terminal_state_count{terminal_state=\"failed_no_cache\"}", - "legendFormat": "failed no cache", - "refId": "C" - }, - { - "expr": "ours_rp_tree_instances{state=\"failed\"}", - "legendFormat": "tree failed", - "refId": "D" - } - ], - "title": "Repo Failure / Fallback Counts", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 20, - "w": 12, - "h": 8 - }, - "id": 8, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_repo_sync_phase_duration_seconds_total{phase=\"rrdp_failed_rsync_ok\"}", - "legendFormat": "rsync fallback duration", - "refId": "A" - }, - { - "expr": "ours_rp_repo_sync_phase_duration_seconds_total{phase=\"rrdp_failed_rsync_failed\"}", - "legendFormat": "failed duration", - "refId": "B" - }, - { - "expr": "ours_rp_repo_terminal_state_duration_seconds_total{terminal_state=\"failed_no_cache\"}", - "legendFormat": "failed no cache duration", - "refId": "C" - } - ], - "title": "Repo Failure / Fallback Durations", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 29, - "w": 12, - "h": 9 - }, - "id": 9, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "show": false, - "reducer": [ - "sum" - ], - "countRows": false, - "fields": "" - } - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_rrdp_rsync_failed_repository_duration_seconds", - "format": "table", - "instant": true, - "legendFormat": "", - "refId": "A" - } - ], - "title": "RRDP + Rsync Failed Repositories", - "type": "table", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "job": true, - "terminal_state": true, - "rank": true, - "transport": true, - "__name__": true, - "publication_points": true, - "instance": true, - "repo_id": true, - "pp_id": true, - "exported_instance": true, - "rp": true, - "source": true - }, - "indexByName": { - "Time": 0, - "host": 1, - "phase": 2, - "uri": 3, - "Value": 4 - }, - "renameByName": { - "Value": "duration" - } - } - } - ] - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 29, - "w": 12, - "h": 9 - }, - "id": 11, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "show": false, - "reducer": [ - "sum" - ], - "countRows": false, - "fields": "" - } - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "topk(20, ours_rp_top_repository_sync_duration_seconds)", - "format": "table", - "instant": true, - "legendFormat": "", - "refId": "A" - } - ], - "title": "Top 20 Repositories by Sync Duration", - "type": "table", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "job": true, - "terminal_state": true, - "__name__": true, - "publication_points": true, - "instance": true, - "repo_id": true, - "phase": true, - "pp_id": true, - "exported_instance": true, - "rp": true, - "source": true - }, - "indexByName": { - "Time": 0, - "host": 1, - "rank": 2, - "transport": 3, - "uri": 4, - "Value": 5 - }, - "renameByName": { - "Value": "value" - } - } - } - ] - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 38, - "w": 24, - "h": 9 - }, - "id": 10, - "options": { - "showHeader": true, - "cellHeight": "sm", - "footer": { - "show": false, - "reducer": [ - "sum" - ], - "countRows": false, - "fields": "" - } - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "topk(20, ours_rp_top_publication_point_object_count)", - "format": "table", - "instant": true, - "legendFormat": "", - "refId": "A" - } - ], - "title": "Top Publication Points by Objects", - "type": "table", - "transformations": [ - { - "id": "organize", - "options": { - "excludeByName": { - "job": true, - "__name__": true, - "publication_points": true, - "instance": true, - "repo_id": true, - "phase": true, - "pp_id": true, - "exported_instance": true, - "rp": true, - "source": true - }, - "indexByName": { - "Time": 0, - "host": 1, - "rank": 2, - "terminal_state": 3, - "transport": 4, - "uri": 5, - "Value": 6 - }, - "renameByName": {} - } - } - ] - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "description": "Per-repository sync success in the latest successful run; 1 means successful, 0 means failed or failed_no_cache.", - "fieldConfig": { - "defaults": { - "unit": "bool" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 47 - }, - "id": 12, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "expr": "ours_rp_repository_sync_success", - "legendFormat": "{{host}} {{repo_id}}", - "refId": "A" - } - ], - "title": "Repository Sync Success by Repo", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "description": "Per-repository total sync duration aggregated from publication point repo_sync_duration_ms.", - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 55 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "expr": "ours_rp_repository_sync_duration_seconds{stat=\"sum\"}", - "legendFormat": "{{host}} {{repo_id}}", - "refId": "A" - } - ], - "title": "Repository Sync Duration by Repo", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "description": "Per-repository downloaded bytes attributed from report.json downloads events.", - "fieldConfig": { - "defaults": { - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 24, - "x": 0, - "y": 63 - }, - "id": 14, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "targets": [ - { - "expr": "ours_rp_repository_download_bytes", - "legendFormat": "{{host}} {{repo_id}}", - "refId": "A" - } - ], - "title": "Repository Download Bytes by Repo", - "type": "timeseries" - } - ], - "refresh": "5s", - "schemaVersion": 40, - "tags": [ - "ours-rp", - "rpki", - "soak", - "repo-sync" - ], - "templating": { - "list": [] - }, - "time": { - "from": "now-30m", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Ours RP Repo Sync", - "uid": "ours-rp-repo-sync", - "version": 3, - "weekStart": "" -} diff --git a/deploy/docker-compose/grafana/dashboards/ours-rp-soak-overview.json b/deploy/docker-compose/grafana/dashboards/ours-rp-soak-overview.json deleted file mode 100644 index 3316330..0000000 --- a/deploy/docker-compose/grafana/dashboards/ours-rp-soak-overview.json +++ /dev/null @@ -1,875 +0,0 @@ -{ - "annotations": { - "list": [] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": null, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 0, - "w": 6, - "h": 4 - }, - "id": 1, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_cir_trust_anchors", - "legendFormat": "RIRs", - "refId": "A" - } - ], - "title": "Current Run RIRs", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "x": 6, - "y": 0, - "w": 6, - "h": 4 - }, - "id": 2, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_run_duration_seconds", - "legendFormat": "wall", - "refId": "A" - } - ], - "title": "Latest Wall Time", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "bytes" - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 0, - "w": 6, - "h": 4 - }, - "id": 3, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_run_max_rss_bytes", - "legendFormat": "rss", - "refId": "A" - } - ], - "title": "Latest Max RSS", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 18, - "y": 0, - "w": 6, - "h": 4 - }, - "id": 4, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_publication_points", - "legendFormat": "publication points", - "refId": "A" - } - ], - "title": "Publication Points", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 4, - "w": 6, - "h": 4 - }, - "id": 9, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_run_sequence", - "legendFormat": "seq", - "refId": "A" - } - ], - "title": "Latest Run Sequence", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 2, - "unit": "percent", - "min": 0, - "max": 100, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "orange", - "value": 90 - }, - { - "color": "green", - "value": 98 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "x": 6, - "y": 4, - "w": 6, - "h": 4 - }, - "id": 10, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "100 * sum by (job, instance, exported_instance) (ours_rp_repo_terminal_state_count{terminal_state=\"publication_point_cache\"}) / sum by (job, instance, exported_instance) (ours_rp_publication_points)", - "legendFormat": "PP cache hit ratio", - "refId": "A" - } - ], - "title": "Latest PP Cache Hit Ratio", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none", - "decimals": 0 - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 4, - "w": 6, - "h": 4 - }, - "id": 11, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_vrps{kind=\"total\"}", - "legendFormat": "VRPs raw", - "refId": "A" - } - ], - "title": "VRPs", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none", - "decimals": 0 - }, - "overrides": [] - }, - "gridPos": { - "x": 18, - "y": 4, - "w": 6, - "h": 4 - }, - "id": 12, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "11.3.1", - "targets": [ - { - "expr": "ours_rp_vaps", - "legendFormat": "VAPs", - "refId": "A" - } - ], - "title": "VAPs", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 8, - "w": 12, - "h": 8 - }, - "id": 5, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_run_duration_seconds", - "legendFormat": "wall", - "refId": "A" - }, - { - "expr": "ours_rp_stage_duration_seconds{stage=\"validation\"}", - "legendFormat": "validation", - "refId": "B" - } - ], - "title": "Run / Validation Duration", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 8, - "w": 12, - "h": 8 - }, - "id": 6, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_vrps{kind=\"total\"}", - "legendFormat": "VRPs raw", - "refId": "A" - }, - { - "expr": "ours_rp_vrps{kind=\"unique\"}", - "legendFormat": "VRPs unique", - "refId": "D" - }, - { - "expr": "ours_rp_vaps", - "legendFormat": "VAPs", - "refId": "B" - }, - { - "expr": "ours_rp_cir_objects", - "legendFormat": "CIR objects", - "refId": "C" - } - ], - "title": "Output and Input Sizes", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "decimals": 0, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 16, - "w": 12, - "h": 8 - }, - "id": 8, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_large_publication_points", - "legendFormat": "> {{object_count_gt}} objects", - "refId": "A" - } - ], - "title": "Large Publication Points by Object Count", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 16, - "w": 12, - "h": 8 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ - "lastNotNull" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"validation\"}", - "legendFormat": "validation", - "refId": "A" - }, - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"report_write\"}", - "legendFormat": "report write", - "refId": "E" - }, - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"ccr_write\"}", - "legendFormat": "ccr write", - "refId": "F" - }, - { - "expr": "ours_rp_run_stage_duration_seconds{stage=\"cir_write\"}", - "legendFormat": "cir write", - "refId": "G" - } - ], - "title": "Output Stage Durations", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "bytes", - "decimals": 2 - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 24, - "w": 12, - "h": 8 - }, - "id": 14, - "options": { - "legend": { - "calcs": [ - "lastNotNull", - "max" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_run_max_rss_bytes", - "legendFormat": "Max RSS", - "refId": "A" - } - ], - "title": "Max RSS Over Time", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "percent", - "decimals": 2, - "min": 0, - "max": 100, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "orange", - "value": 90 - }, - { - "color": "green", - "value": 98 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "x": 12, - "y": 24, - "w": 12, - "h": 8 - }, - "id": 17, - "options": { - "legend": { - "calcs": [ - "lastNotNull", - "min", - "max" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "expr": "100 * sum by (job, instance, exported_instance) (ours_rp_repo_terminal_state_count{terminal_state=\"publication_point_cache\"}) / sum by (job, instance, exported_instance) (ours_rp_publication_points)", - "legendFormat": "PP cache hit ratio", - "refId": "A" - } - ], - "title": "PP Cache Hit Ratio", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "bytes", - "decimals": 2 - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 32, - "w": 24, - "h": 8 - }, - "id": 15, - "options": { - "legend": { - "calcs": [ - "lastNotNull", - "max" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_state_db_size_bytes", - "legendFormat": "{{db}}", - "refId": "A" - } - ], - "title": "State DB Size Over Time", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none", - "decimals": 0 - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 40, - "w": 24, - "h": 8 - }, - "id": 16, - "options": { - "legend": { - "calcs": [ - "lastNotNull", - "max" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "ours_rp_state_db_files", - "legendFormat": "{{db}}", - "refId": "A" - } - ], - "title": "State DB File Count Over Time", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "Prometheus" - }, - "fieldConfig": { - "defaults": { - "unit": "none", - "decimals": 0, - "min": 0 - }, - "overrides": [] - }, - "gridPos": { - "x": 0, - "y": 48, - "w": 24, - "h": 8 - }, - "id": 18, - "options": { - "legend": { - "calcs": [ - "lastNotNull", - "max" - ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "none" - } - }, - "targets": [ - { - "expr": "sum by (job, instance, exported_instance) (ours_rp_repo_terminal_state_count{terminal_state=\"fresh\"})", - "legendFormat": "fresh pp", - "refId": "A" - }, - { - "expr": "sum by (job, instance, exported_instance) (ours_rp_cir_objects_by_source_type{exported_source=\"fresh\",object_type=\"roa\"})", - "legendFormat": "fresh roa", - "refId": "B" - }, - { - "expr": "sum by (job, instance, exported_instance) (ours_rp_cir_objects_by_source_type{exported_source=\"fresh\",object_type=\"manifest\"})", - "legendFormat": "fresh mft", - "refId": "C" - }, - { - "expr": "sum by (job, instance, exported_instance) (ours_rp_cir_objects_by_source_type{exported_source=\"fresh\",object_type=\"certificate\"})", - "legendFormat": "fresh crt", - "refId": "D" - }, - { - "expr": "sum by (job, instance, exported_instance) (ours_rp_cir_objects_by_source_type{exported_source=\"fresh\",object_type=\"crl\"})", - "legendFormat": "fresh crl", - "refId": "E" - } - ], - "title": "Fresh PP / Object Counts by Run", - "type": "timeseries" - } - ], - "refresh": "5s", - "schemaVersion": 40, - "tags": [ - "ours-rp", - "rpki", - "soak" - ], - "templating": { - "list": [] - }, - "time": { - "from": "now-30m", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Ours RP Soak Overview", - "uid": "ours-rp-soak-overview", - "version": 4, - "weekStart": "" -} diff --git a/deploy/docker-compose/grafana/provisioning/dashboards/dashboard.yml b/deploy/docker-compose/grafana/provisioning/dashboards/dashboard.yml deleted file mode 100644 index 5079abf..0000000 --- a/deploy/docker-compose/grafana/provisioning/dashboards/dashboard.yml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: 1 - -providers: - - name: ours-rp-docker-compose - orgId: 1 - folder: Ours RP Docker Compose - type: file - disableDeletion: false - updateIntervalSeconds: 10 - allowUiUpdates: true - options: - path: /var/lib/grafana/dashboards diff --git a/deploy/docker-compose/grafana/provisioning/datasources/prometheus.yml b/deploy/docker-compose/grafana/provisioning/datasources/prometheus.yml deleted file mode 100644 index 25e8d70..0000000 --- a/deploy/docker-compose/grafana/provisioning/datasources/prometheus.yml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: 1 - -datasources: - - name: Prometheus - uid: Prometheus - type: prometheus - access: proxy - url: http://prometheus:9090 - isDefault: true - editable: true diff --git a/deploy/docker-compose/prometheus.yml b/deploy/docker-compose/prometheus.yml deleted file mode 100644 index 1e658fd..0000000 --- a/deploy/docker-compose/prometheus.yml +++ /dev/null @@ -1,13 +0,0 @@ -global: - scrape_interval: 5s - evaluation_interval: 5s - -scrape_configs: - - job_name: ours-rp-artifact-metrics - metrics_path: /metrics - static_configs: - - targets: - - artifact-metrics:9556 - labels: - rp: ours-rp - source: docker-compose-artifact-sidecar diff --git a/deploy/docker-installer/docs/README.en.md b/deploy/docker-installer/docs/README.en.md index 0335788..317a026 100644 --- a/deploy/docker-installer/docs/README.en.md +++ b/deploy/docker-installer/docs/README.en.md @@ -12,6 +12,12 @@ By default the host architecture must match `PACKAGE_ARCH` from `PACKAGE-MANIFES ALLOW_CROSS_ARCH=1 ``` +## Compose Template Source + +`compose/` is the single production Docker Compose template source. The Docker installer build script copies this directory directly. Do not maintain a second copy of the Compose, Prometheus, or Grafana dashboard files elsewhere. + +The legacy direct Compose deployment entry point has been removed. For either amd64 or arm64, build the matching installer package with `scripts/docker/build_docker_installer_package.sh`, then use `install.sh`, `start.sh`, and `status.sh` as described here. + ## Quick Start ```bash diff --git a/deploy/docker-installer/docs/README.zh-CN.md b/deploy/docker-installer/docs/README.zh-CN.md index cc21c3c..dc09e66 100644 --- a/deploy/docker-installer/docs/README.zh-CN.md +++ b/deploy/docker-installer/docs/README.zh-CN.md @@ -12,6 +12,12 @@ ALLOW_CROSS_ARCH=1 ``` +## Compose 模板来源 + +`compose/` 是唯一的生产 Docker Compose 模板来源,Docker 安装包构建脚本会直接复制该目录。不要在其他目录维护第二份 compose、Prometheus 或 Grafana dashboard 文件。 + +旧的直接 Compose 部署入口已经移除。需要部署 amd64 或 arm64 时,统一先用 `scripts/docker/build_docker_installer_package.sh` 构建对应架构安装包,再按本说明执行 `install.sh`、`start.sh` 和 `status.sh`。 + ## 快速开始 ```bash diff --git a/scripts/docker/deploy_remote233_arm64_compose.sh b/scripts/docker/deploy_remote233_arm64_compose.sh deleted file mode 100755 index cf1a5fe..0000000 --- a/scripts/docker/deploy_remote233_arm64_compose.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" - -REMOTE_HOST="${REMOTE_HOST:-root@47.77.204.233}" -REMOTE_ROOT="${REMOTE_ROOT:-/root/ours-rp-arm64-compose}" -IMAGE_TAG="${IMAGE_TAG:-ours-rp-runtime-arm64:dev}" -IMAGE_TAR="${IMAGE_TAR:-$REPO_ROOT/target/arm64-docker/ours-rp-runtime-arm64-dev.tar.gz}" -METRICS_IMAGE="${METRICS_IMAGE:-ours-rp-metrics-arm64:dev}" -METRICS_IMAGE_TAR="${METRICS_IMAGE_TAR:-$REPO_ROOT/target/arm64-docker/ours-rp-metrics-arm64-dev.tar.gz}" -EXECUTE="${EXECUTE:-0}" -INSTALL_DOCKER="${INSTALL_DOCKER:-1}" -INSTALL_BINFMT="${INSTALL_BINFMT:-1}" -START_CORE="${START_CORE:-0}" -START_SIDECARS="${START_SIDECARS:-0}" - -usage() { - cat <<'USAGE' -Usage: - scripts/docker/deploy_remote233_arm64_compose.sh [options] - -Default is dry-run. Pass --execute to modify the remote host. - -Options: - --execute Actually install/copy/load/start on remote - --remote SSH host (default: root@47.77.204.233) - --remote-root Remote compose root - --image Image tag loaded by docker load - --image-tar Local docker save tar.gz - --metrics-image Metrics image tag loaded by docker load - --metrics-image-tar - Local metrics docker save tar.gz - --no-install-docker Skip Docker installation - --no-binfmt Skip binfmt/qemu installation - --start-core Start ours-rp-soak after deploy - --start-sidecars Start artifact metrics, Prometheus and Grafana after deploy - -h, --help Show this help -USAGE -} - -while [[ $# -gt 0 ]]; do - case "$1" in - --execute) - EXECUTE=1 - shift - ;; - --remote) - REMOTE_HOST="$2" - shift 2 - ;; - --remote-root) - REMOTE_ROOT="$2" - shift 2 - ;; - --image) - IMAGE_TAG="$2" - shift 2 - ;; - --image-tar) - IMAGE_TAR="$2" - shift 2 - ;; - --metrics-image) - METRICS_IMAGE="$2" - shift 2 - ;; - --metrics-image-tar) - METRICS_IMAGE_TAR="$2" - shift 2 - ;; - --no-install-docker) - INSTALL_DOCKER=0 - shift - ;; - --no-binfmt) - INSTALL_BINFMT=0 - shift - ;; - --start-core) - START_CORE=1 - shift - ;; - --start-sidecars) - START_SIDECARS=1 - shift - ;; - -h|--help) - usage - exit 0 - ;; - *) - echo "unknown option: $1" >&2 - usage >&2 - exit 2 - ;; - esac -done - -require_command() { - command -v "$1" >/dev/null 2>&1 || { - echo "missing required command: $1" >&2 - exit 2 - } -} - -run_or_echo() { - if [[ "$EXECUTE" == "1" ]]; then - "$@" - else - printf 'DRY-RUN:' - printf ' %q' "$@" - printf '\n' - fi -} - -remote_run() { - if [[ "$EXECUTE" == "1" ]]; then - ssh "$REMOTE_HOST" "$@" - else - printf 'DRY-RUN: ssh %q %q\n' "$REMOTE_HOST" "$*" - fi -} - -require_command ssh -require_command rsync - -[[ -f "$IMAGE_TAR" ]] || { - echo "missing image tar: $IMAGE_TAR" >&2 - exit 2 -} -[[ -f "$METRICS_IMAGE_TAR" ]] || { - echo "missing metrics image tar: $METRICS_IMAGE_TAR" >&2 - exit 2 -} - -compose_src="$REPO_ROOT/deploy/docker-compose/" -[[ -f "$compose_src/docker-compose.yml" ]] || { - echo "missing compose source: $compose_src" >&2 - exit 2 -} - -echo "remote=$REMOTE_HOST" -echo "remote_root=$REMOTE_ROOT" -echo "image=$IMAGE_TAG" -echo "image_tar=$IMAGE_TAR" -echo "metrics_image=$METRICS_IMAGE" -echo "metrics_image_tar=$METRICS_IMAGE_TAR" - -if [[ "$INSTALL_DOCKER" == "1" ]]; then - remote_run "if ! command -v docker >/dev/null 2>&1; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io; fi; if ! docker compose version >/dev/null 2>&1; then if apt-cache show docker-compose-plugin >/dev/null 2>&1; then DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose-plugin; elif apt-cache show docker-compose-v2 >/dev/null 2>&1; then DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose-v2; elif apt-cache show docker-compose >/dev/null 2>&1; then DEBIAN_FRONTEND=noninteractive apt-get install -y docker-compose; else echo 'no docker compose package found' >&2; exit 2; fi; fi; systemctl enable --now docker || true" -fi - -remote_run "mkdir -p '$REMOTE_ROOT/images'" -run_or_echo rsync -a --delete "$compose_src" "$REMOTE_HOST:$REMOTE_ROOT/" -run_or_echo rsync -a "$IMAGE_TAR" "$REMOTE_HOST:$REMOTE_ROOT/images/" -run_or_echo rsync -a "$METRICS_IMAGE_TAR" "$REMOTE_HOST:$REMOTE_ROOT/images/" - -remote_tar="$REMOTE_ROOT/images/$(basename "$IMAGE_TAR")" -remote_metrics_tar="$REMOTE_ROOT/images/$(basename "$METRICS_IMAGE_TAR")" -remote_run "cd '$REMOTE_ROOT' && test -f .env || cp .env.example .env" -remote_run "gunzip -c '$remote_tar' | docker load" -remote_run "gunzip -c '$remote_metrics_tar' | docker load" - -if [[ "$INSTALL_BINFMT" == "1" ]]; then - remote_run "docker run --rm --privileged tonistiigi/binfmt --install arm64" -fi - -remote_run "docker run --rm --platform linux/arm64 '$IMAGE_TAG' uname -m" -remote_run "docker run --rm --platform linux/arm64 '$IMAGE_TAG' /opt/ours-rp/bin/rpki --help >/tmp/ours-rp-arm64-help.txt && head -5 /tmp/ours-rp-arm64-help.txt" -remote_run "docker run --rm --platform linux/arm64 '$METRICS_IMAGE' /opt/ours-rp/bin/rpki_artifact_metrics --help >/tmp/ours-rp-arm64-metrics-help.txt && head -5 /tmp/ours-rp-arm64-metrics-help.txt" - -if [[ "$START_CORE" == "1" ]]; then - remote_run "cd '$REMOTE_ROOT' && docker compose --profile core up -d ours-rp-soak" -fi - -if [[ "$START_SIDECARS" == "1" ]]; then - remote_run "cd '$REMOTE_ROOT' && docker compose --profile sidecar --profile monitor up -d artifact-metrics prometheus grafana" -fi - -remote_run "cd '$REMOTE_ROOT' && docker compose ps"