Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
92 lines (87 loc) · 3.14 KB
/
Copy pathdocker-compose.yml
File metadata and controls
92 lines (87 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# SpectrumAlert container stack.
#
# docker compose up -d # dashboard on http://localhost:8088
# docker compose logs -f # follow the dashboard log
# docker compose run --rm spectrumalert monitor status # one-off CLI command
# docker compose --profile service up spectrumalert-service
# docker compose --profile autonomous up spectrumalert-autonomous
#
# The default service used to run `monitor status`, which prints a table and
# exits 0. With `restart: unless-stopped` that put the container in a permanent
# restart loop and nothing ever came up. The default is now the long-running web
# dashboard; use `docker compose run` for CLI commands.
#
# USB access: the SDR is handed over with `devices:` plus `group_add: plugdev`.
# The image's non-root `spectrum` user is already in plugdev (gid 46, which is
# what the host uses), so this works without `privileged: true` and without
# bind-mounting the whole of /dev into the container.
x-usb: &usb
devices:
- /dev/bus/usb:/dev/bus/usb
group_add:
- plugdev
x-persistence: &persistence
volumes:
- ./data:/app/data
- ./models:/app/models
- ./logs:/app/logs
- ./config:/app/config
services:
# Default service: the web dashboard, with the SDR attached.
spectrumalert:
build: .
image: spectrumalert:latest
container_name: spectrum-alert
restart: unless-stopped
<<: [*usb, *persistence]
environment:
- PYTHONUNBUFFERED=1
- LOG_LEVEL=INFO
ports:
# Host port only; the app always listens on 8000 inside the container.
# 8088 rather than 8000 because 8000 is Portainer's convention and is
# usually already bound. Override with SPECTRUM_ALERT_WEB_PORT.
- "${SPECTRUM_ALERT_WEB_PORT:-8088}:8000"
command: ["web", "--host", "0.0.0.0", "--port", "8000"]
healthcheck:
test: ["CMD", "python", "-c",
"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/', timeout=5).status==200 else 1)"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
# Autonomous service: 24h data collection + training + monitoring.
spectrumalert-autonomous:
build: .
image: spectrumalert:latest
container_name: spectrum-alert-autonomous
restart: unless-stopped
<<: [*usb, *persistence]
environment:
- PYTHONUNBUFFERED=1
- LOG_LEVEL=INFO
- COLLECTION_HOURS=24
- SERVICE_LITE_MODE=false
- SERVICE_ALERT_THRESHOLD=0.7
- RETRAIN_INTERVAL_HOURS=168
- MIN_TRAINING_SAMPLES=1000
# Was `python autonomous_service.py`, a file that does not exist.
command: ["monitor", "autonomous"]
profiles:
- autonomous
# Service mode: continuous monitoring.
spectrumalert-service:
build: .
image: spectrumalert:latest
container_name: spectrum-alert-service
restart: unless-stopped
<<: [*usb, *persistence]
environment:
- PYTHONUNBUFFERED=1
- LOG_LEVEL=INFO
- SERVICE_LITE_MODE=false
- SERVICE_ALERT_THRESHOLD=0.7
# Was `python service_mode.py`, a file that does not exist.
command: ["monitor", "start"]
profiles:
- service