Skip to content

Commit 1479c71

Browse files
committed
fix(nginx): serve SlimeVR GUI and add simple control script
1 parent 20b7c22 commit 1479c71

3 files changed

Lines changed: 136 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run [SlimeVR Server](https://github.com/SlimeVR/SlimeVR-Server) and its Web GUI
1313
2. Run:
1414

1515
```bash
16-
docker compose up -d --build
16+
./slimevrctl up
1717
```
1818

1919
3. Open:
@@ -25,11 +25,20 @@ http://localhost:8080
2525
Stop:
2626

2727
```bash
28-
docker compose down
28+
./slimevrctl down
2929
```
3030

3131
This repo defaults to Linux USB hotplug mode, so no extra `-f ...` flags are needed.
3232

33+
Optional commands:
34+
35+
```bash
36+
./slimevrctl status
37+
./slimevrctl logs
38+
./slimevrctl restart
39+
./slimevrctl doctor
40+
```
41+
3342
## Features
3443

3544
- Auto-downloads `slimevr.jar` and `slimevr-gui-dist.tar.gz` from official releases
@@ -134,6 +143,7 @@ http://<HOST_IP>:<WEBGUI_PORT>/?ip=<HOST_IP>
134143
- `ERR_TOO_MANY_REDIRECTS`: ensure redirect is only applied when `?ip=` is missing.
135144
- Nginx error `server directive is not allowed here`: do not replace `nginx.conf` with a `server {}` block; use `conf.d/default.conf`.
136145
- Linux USB not detected: run with `docker-compose.linux.yml` (hotplug mode).
146+
- Seeing `Welcome to nginx!` on `:8080`: rebuild/restart with `./slimevrctl restart` to apply the GUI root config.
137147
- macOS/Windows USB passthrough: Docker Desktop does not expose raw USB devices to Linux containers like native Linux does. For direct USB trackers, use Linux (native/VM/WSL2 with USB/IP).
138148
- Port already in use (`6969` or `21110`): stop conflicting processes or containers.
139149

@@ -171,4 +181,4 @@ MIT
171181
BTC: `bc1qrd3mexqu43qn0597d248725kdp3tr28252q64p`
172182

173183
<!-- AUTO-UPDATE-DATE -->
174-
**Last updated:** 2026-04-03
184+
**Last updated:** 2026-04-04

nginx/templates/default.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ server {
22
listen ${WEBGUI_PORT};
33
server_name localhost;
44

5-
root /usr/share/nginx/html;
5+
root /usr/share/nginx/html/renderer;
66
index index.html;
77

88
location = / {

slimevrctl

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
usage() {
5+
cat <<'EOF'
6+
Usage: ./slimevrctl <command>
7+
8+
Commands:
9+
up Build and start containers in background
10+
down Stop and remove containers
11+
restart Restart (down + up)
12+
logs Follow logs
13+
status Show container status
14+
doctor Run quick diagnostics
15+
EOF
16+
}
17+
18+
require_docker() {
19+
if ! command -v docker >/dev/null 2>&1; then
20+
echo "Error: docker is not installed or not in PATH."
21+
exit 1
22+
fi
23+
24+
if ! docker compose version >/dev/null 2>&1; then
25+
echo "Error: docker compose plugin is required (docker compose)."
26+
exit 1
27+
fi
28+
}
29+
30+
print_up_summary() {
31+
local slimevr_status
32+
local gui_status
33+
34+
slimevr_status="$(docker compose ps --status running --services | grep -x slimevr || true)"
35+
gui_status="$(docker compose ps --status running --services | grep -x nginx || true)"
36+
37+
if [ -n "$slimevr_status" ]; then
38+
echo "OK: slimevr UP"
39+
else
40+
echo "WARN: slimevr is not running"
41+
fi
42+
43+
if [ -n "$gui_status" ]; then
44+
echo "OK: slimevr_gui UP"
45+
else
46+
echo "WARN: slimevr_gui is not running"
47+
fi
48+
49+
echo "URL: http://localhost:${WEBGUI_PORT:-8080}"
50+
}
51+
52+
run_doctor() {
53+
echo "== SlimeVR Doctor =="
54+
echo
55+
56+
echo "[Docker]"
57+
docker --version || true
58+
docker compose version || true
59+
echo
60+
61+
echo "[Compose services]"
62+
docker compose ps || true
63+
echo
64+
65+
echo "[Serial devices]"
66+
if ls /dev/ttyACM* /dev/ttyUSB* >/dev/null 2>&1; then
67+
ls /dev/ttyACM* /dev/ttyUSB* 2>/dev/null || true
68+
else
69+
echo "No /dev/ttyACM* or /dev/ttyUSB* found"
70+
fi
71+
echo
72+
73+
echo "[User groups]"
74+
id -nG || true
75+
echo
76+
77+
echo "[Container serial visibility]"
78+
if docker compose ps --status running --services | grep -x slimevr >/dev/null 2>&1; then
79+
docker compose exec -T slimevr sh -lc 'ls /dev/ttyACM* /dev/ttyUSB* 2>/dev/null || echo "No serial devices visible inside container"' || true
80+
else
81+
echo "slimevr service is not running"
82+
fi
83+
echo
84+
85+
echo "[Recent slimevr logs]"
86+
docker compose logs --no-color --tail=40 slimevr || true
87+
}
88+
89+
main() {
90+
local cmd="${1:-}"
91+
require_docker
92+
93+
case "$cmd" in
94+
up)
95+
docker compose up -d --build
96+
print_up_summary
97+
;;
98+
down)
99+
docker compose down
100+
;;
101+
restart)
102+
docker compose down
103+
docker compose up -d --build
104+
print_up_summary
105+
;;
106+
logs)
107+
docker compose logs -f
108+
;;
109+
status)
110+
docker compose ps
111+
;;
112+
doctor)
113+
run_doctor
114+
;;
115+
*)
116+
usage
117+
exit 1
118+
;;
119+
esac
120+
}
121+
122+
main "$@"

0 commit comments

Comments
 (0)