Repository navigation
Expand file tree
/
Copy pathdocker-compose.https.yml
More file actions
84 lines (80 loc) · 3.61 KB
/
Copy pathdocker-compose.https.yml
File metadata and controls
84 lines (80 loc) · 3.61 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
# Looking Glass behind Caddy with HTTPS - needed for passkeys (WebAuthn only works on https:// or http://localhost).
#
# 1. Pick a name, e.g. looking-glass.home.lan, and point it (DNS record in OPNsense: Services > Unbound DNS > Overrides)
# to the Docker host.
# 2. Put it in .env: LOOKING_GLASS_HOST=looking-glass.home.lan and PUBLIC_URL=https://looking-glass.home.lan
# 3. mkdir -p data secrets && sudo chown 10001:10001 data
# openssl rand -hex 24 > secrets/db_password && chmod 700 secrets && chmod 644 secrets/db_password
# 4. docker compose -f docker-compose.https.yml up -d
# 5. open https://looking-glass.home.lan and follow the setup wizard (setup code: docker logs looking-glass)
#
# Certificates: with `tls internal` (see Caddyfile) Caddy creates its own CA. Install its root certificate on your
# devices once, otherwise browsers show a warning and refuse passkeys:
# docker cp looking-glass-caddy:/data/caddy/pki/authorities/local/root.crt ./caddy-root.crt
# Have a real domain? Remove `tls internal` and Caddy fetches a Let's Encrypt certificate automatically
# (or use your existing Nginx Proxy Manager / Traefik / SWAG and only the lookingglass + db services below).
services:
caddy:
image: caddy:2.11-alpine
container_name: looking-glass-caddy
restart: unless-stopped
ports:
- "443:443"
- "80:80"
environment:
LOOKING_GLASS_HOST: ${LOOKING_GLASS_HOST:?set LOOKING_GLASS_HOST in .env}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
depends_on: [looking-glass]
looking-glass:
image: ghcr.io/gittimeraider/looking-glass:latest
container_name: looking-glass
restart: unless-stopped
user: "${PUID:-10001}:${PGID:-10001}" # uid:gid to run as (PUID/PGID in .env); must own the data folder
cap_drop: [ALL] # needs no Linux capabilities
security_opt: ["no-new-privileges:true"]
depends_on:
db:
condition: service_healthy
env_file: # optional: PUBLIC_URL, LOG_LEVEL ... (see .env.example)
- path: .env
required: false
environment:
COOKIE_SECURE: "true"
expose:
- "8080" # only reachable through Caddy
ports:
- "514:5514/udp"
- "514:5514/tcp"
volumes:
- ./data:/data # sudo chown -R 10001:10001 ./data (= PUID:PGID)
db:
image: postgres:18
container_name: looking-glass-db
restart: unless-stopped
shm_size: 512mb # Docker's default /dev/shm is 64 MB; parallel queries need more
# more memory to keep the log tables cached (the default is 128 MB): fewer disk reads and less CPU for the
# dashboards. About a quarter of the RAM you want the database to use; 256MB on a small machine.
command: ["postgres", "-c", "shared_buffers=512MB", "-c", "effective_cache_size=2GB"]
user: postgres # start directly as the postgres user, so no capabilities are needed
cap_drop: [ALL]
security_opt: ["no-new-privileges:true"]
secrets: [db_password]
environment:
POSTGRES_USER: lookingglass
POSTGRES_PASSWORD_FILE: /run/secrets/db_password # read once, when the database is created
POSTGRES_DB: lookingglass
volumes:
- pgdata:/var/lib/postgresql # PostgreSQL 18+ layout (data lives in /var/lib/postgresql/18/docker)
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lookingglass -d lookingglass"]
interval: 10s
timeout: 5s
retries: 10
volumes:
pgdata:
caddy_data:
secrets:
db_password:
file: ./secrets/db_password # openssl rand -hex 24 > secrets/db_password (see the top of this file)