-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.example.yml
More file actions
43 lines (39 loc) · 1.69 KB
/
docker-compose.example.yml
File metadata and controls
43 lines (39 loc) · 1.69 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
# Example: watchdog as a sidecar that monitors all containers on the host.
#
# How it works (same approach as cAdvisor, Prometheus node-exporter):
# - Mount the HOST's /proc into the watchdog container read-only
# - Linux has a single process table — containers are just namespaced views
# - Watchdog reads host /proc and sees processes from ALL containers
# - No need to couple watchdog to a specific container via pid: "service:..."
#
# Socket sharing:
# - The Laravel/Symfony module writes to a Unix socket
# - Both the app container and watchdog container mount the same volume
# - They communicate through the shared socket file
services:
app:
image: your-app-image
# ... your app config
volumes:
- watchdog-socket:/var/run/watchdog # shared socket directory
horizon:
image: your-app-image
command: php artisan horizon
volumes:
- watchdog-socket:/var/run/watchdog # shared socket directory
watchdog:
image: yangusik/php-watchdog:latest
volumes:
- /proc:/host/proc:ro # host /proc mounted at /host/proc to avoid overwriting container's /proc
- ./watchdog.yml:/etc/watchdog/watchdog.yml:ro
- watchdog-socket:/var/run/watchdog # shared socket directory
- watchdog-reports:/var/log/watchdog # reports output
restart: unless-stopped
# Run as the same user as PHP workers so the Unix socket is writable by them.
# Reading /proc is allowed for any user on Linux.
# Killing processes requires matching UID — if kill: false, any user works.
# Find your PHP worker UID: docker exec <container> id www-data
user: "1000:1000"
volumes:
watchdog-socket:
watchdog-reports: