Skip to content

Commit 8d611b2

Browse files
committed
Add an entrypoint script for Nsight streamer that sets the TURN host to the correct IP. Pass the BREV_ENV_ID variable into the containers.
1 parent f57543f commit 8d611b2

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

build/docker-compose.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ services:
2020
- "0.0.0.0:8888:8888" # JupyterLab
2121
volumes:
2222
- /home/ubuntu/pyhpc-tutorial:/pyhpc-tutorial
23+
environment:
24+
- BREV_ENV_ID
2325
user: root
2426
working_dir: /pyhpc-tutorial/notebooks
2527
restart: unless-stopped
@@ -37,18 +39,14 @@ services:
3739
- driver: nvidia
3840
count: all
3941
capabilities: [gpu]
40-
environment:
41-
- NVIDIA_DRIVER_CAPABILITIES=all
42-
- HOST_IP=0.0.0.0
43-
- WEB_USERNAME=""
44-
- WEB_PASSWORD=""
45-
- SELKIES_TURN_HOST=nsight-turn0-${BREV_ENV_ID}.brevlab.com
46-
- TURN_PORT=80
4742
ports:
4843
- "0.0.0.0:8080:8080" # HTTP
4944
- "0.0.0.0:3478:3478" # TURN
5045
volumes:
5146
- /home/ubuntu/pyhpc-tutorial:/pyhpc-tutorial
47+
environment:
48+
- BREV_ENV_ID
5249
user: root
5350
working_dir: /pyhpc-tutorial/notebooks
51+
entrypoint: ["/pyhpc-tutorial/build/nsight-start.bash"]
5452
restart: unless-stopped

build/nsight-start.bash

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
apt-get update
4+
apt-get install -y curl
5+
6+
EXTERNAL_IP=$(curl -sSL ifconfig.me)
7+
8+
export NVIDIA_DRIVER_CAPABILITIES=all
9+
export HOST_IP=0.0.0.0
10+
export WEB_USERNAME=""
11+
export WEB_PASSWORD=""
12+
export SELKIES_TURN_HOST=$(curl -sSL ifconfig.me)
13+
14+
VARS=("NVIDIA_DRIVER_CAPABILITIES" "HOST_IP" "WEB_USERNAME" "WEB_PASSWORD" "SELKIES_TURN_HOST")
15+
for VAR in "${VARS[@]}"; do
16+
if [[ -n "${!VAR+x}" ]]; then
17+
echo "export $VAR=${!VAR}" >> ~/.bashrc
18+
fi
19+
done
20+
21+
source /setup/entrypoint.sh "$@"

0 commit comments

Comments
 (0)