Update start_server.sh
Browse files- start_server.sh +19 -30
start_server.sh
CHANGED
|
@@ -1,36 +1,25 @@
|
|
| 1 |
#!/bin/bash
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
CRYPTPASS=`openssl passwd -apr1 ${NGX_PASS}`
|
| 6 |
-
PORT="${PORT:-8080}"
|
| 7 |
-
|
| 8 |
-
echo "USERNAME:" $NGX_NAME
|
| 9 |
-
echo "PASSWORD:" $NGX_PASS
|
| 10 |
-
|
| 11 |
-
echo "${NGX_NAME}:${CRYPTPASS}" > ngpasswd
|
| 12 |
-
|
| 13 |
-
COMMIT=$(cat /app/openvscode-server/product.json | awk '/commit/{print $4;exit}' FS='[""]')
|
| 14 |
-
sed -i "s/#COMMIT#/$COMMIT/" nginx.conf
|
| 15 |
-
sed -i "s/#PORT#/$PORT/" nginx.conf
|
| 16 |
-
nginx -c $PWD/nginx.conf
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
python3 scripts/sync_hf.py &
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
|
| 4 |
+
# 1. Move to the root workspace
|
| 5 |
+
cd /root/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# 2. Start your dataset sync in the root context
|
| 8 |
+
# Ensure scripts/sync_hf.py uses /root/app/data
|
| 9 |
+
python3 scripts/sync_hf.py --path /root/app/data &
|
| 10 |
|
| 11 |
+
# 3. Setup Nginx (running as root)
|
| 12 |
+
nginx -c /root/app/nginx.conf
|
|
|
|
| 13 |
|
| 14 |
+
# 4. Launch VS Code forced into /root
|
| 15 |
+
# --user-data-dir and --extensions-dir are key to avoiding /home/user
|
| 16 |
+
vscode="/opt/openvscode-server/bin/openvscode-server"
|
| 17 |
|
| 18 |
+
exec $vscode \
|
| 19 |
+
--host 0.0.0.0 \
|
| 20 |
+
--port 5050 \
|
| 21 |
+
--without-connection-token \
|
| 22 |
+
--working-dir / \
|
| 23 |
+
--user-data-dir /root/.vscode-server \
|
| 24 |
+
--extensions-dir /root/.vscode-server/extensions \
|
| 25 |
+
"${@}"
|