File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed
templates/trace-collector Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ services:
5151 template_path : templates/file-server
5252 render_path : dist/file-server
5353
54+ trace-collector :
55+ template_path : templates/trace-collector
56+ render_path : dist/trace-collector
57+
5458# Global variables that are available in all templates
5559globals :
5660 ndnNetwork : /ndn
Original file line number Diff line number Diff line change @@ -220,3 +220,26 @@ services:
220220 nfd : { condition: service_healthy }
221221 logging :
222222 driver : local
223+
224+ trace-collector :
225+ image : ghcr.io/sankalpatimilsina12/trace-collector:20250328
226+ init : true
227+ network_mode : service:nfd
228+ volumes :
229+ - trace-collector-ssh:/root/.ssh # SSH keys
230+ - trace-collector-dump:/root/dump # Dumps
231+ - ${PWD}/dist/trace-collector:/config # Entrypoint
232+ - ${PWD}/dist/file-server/trace-collector-pubkey:/file-server/trace-collector-pubkey # Publish public key
233+ entrypoint : /bin/bash
234+ command : /config/entrypoint.sh
235+ restart : unless-stopped
236+ depends_on :
237+ nfd : { condition: service_healthy }
238+ file-server : { condition: service_healthy }
239+ logging :
240+ driver : local
241+
242+ # Persist trace-collector's SSH keys and dump files
243+ volumes :
244+ trace-collector-ssh :
245+ trace-collector-dump :
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ # Variables
5+ SITE=" {{ site }}"
6+ SITE_CLEAN=$( echo " $SITE " | sed ' s#^/##; s#/#_#g' ) # Eg. /edu/memphis get converted to edu_memphis
7+ SSH_DIR=" /root/.ssh"
8+ PRIVATE_KEY=" $SSH_DIR /id_rsa"
9+ PUBLIC_KEY=" $SSH_DIR /id_rsa.pub"
10+ PUBKEY_EXPORT_PATH=" /file-server/trace-collector-pubkey/id_rsa.pub"
11+
12+ # Ensure permissions
13+ mkdir -p " $SSH_DIR "
14+ chmod 700 " $SSH_DIR "
15+
16+ # Generate SSH key pair if not already present
17+ if [[ ! -f " $PRIVATE_KEY " || ! -f " $PUBLIC_KEY " ]]; then
18+ echo " [trace-collector] No SSH key pair found. Generating a new one..."
19+ ssh-keygen -t rsa -b 4096 -N " " -f " $PRIVATE_KEY "
20+ else
21+ echo " [trace-collector] SSH key pair already exists."
22+ fi
23+
24+ # Always export the public key
25+ mkdir -p " $( dirname " $PUBKEY_EXPORT_PATH " ) "
26+ cp " $PUBLIC_KEY " " $PUBKEY_EXPORT_PATH "
27+ echo " [trace-collector] Public key copied to $PUBKEY_EXPORT_PATH "
28+
29+ # Run
30+ echo " [trace-collector] Starting trace collector..."
31+ exec python3.10 /app/scheduler.py --site " $SITE_CLEAN "
You can’t perform that action at this time.
0 commit comments