-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
84 lines (79 loc) · 3.12 KB
/
Copy pathdocker-compose.yml
File metadata and controls
84 lines (79 loc) · 3.12 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
version: "3.9"
services:
api:
build: .
ports:
- "127.0.0.1:3600:3600" # Only accessible locally (not public)
# Secrets (PODCASTINDEX_KEY / PODCASTINDEX_SECRET and any other API
# keys) live in a `.env` file NEXT TO this compose file on the VPS.
# Docker reads it on `compose up` and injects each line as an env
# var inside the container — no rebuild needed when secrets rotate.
# The file is gitignored at the repo root (see .gitignore); do NOT
# commit it. If the file is missing, `compose up` will still start
# but anything that reads those vars (e.g. /podcasts/*) will 503.
env_file:
- .env
environment:
- PORT=3600
- REDIS_HOST=redis
- REDIS_PORT=6379
- NODE_ENV=production
# The radio service runs in a separate compose stack
# (sunoh-radio-scrapers). Both stacks attach to the external
# `sunoh-net` network at the bottom of this file so this api
# container can reach the radio container by its container_name
# (`sunoh-radio-api`). Trying http://127.0.0.1:4000 instead
# ECONNREFUSEs — every container has its own loopback.
- SUNOH_RADIO_BASE_URL=http://sunoh-radio-api:4000
# Internal Docker DNS — the shazam sidecar (Python + shazamio +
# ffmpeg) lives in this stack on the default network. Used by the
# now-playing worker to identify the current track on radio
# streams. If unset, the worker logs once and stays idle (the
# `/radios/:slug/now-playing` endpoint still serves cached results
# if any).
- SHAZAM_BASE_URL=http://shazam:8080
depends_on:
- redis
- shazam
restart: unless-stopped
# Joins both the internal default (for redis access) AND the
# external shared network (so we can reach sunoh-radio-api in the
# other stack by its container_name).
networks:
- default
- sunoh-shared
redis:
image: redis:alpine
command: redis-server --appendonly yes
volumes:
- redis_data:/data
restart: unless-stopped
# Default network only — redis is private to this stack. Putting
# it on the shared network would let the radio stack resolve
# `redis` and accidentally connect.
networks:
- default
# Shazam recognition sidecar — Python + shazamio + ffmpeg, wrapped in
# a tiny FastAPI service. Lives here (not in sunoh-radio) so the radio
# catalog stack stays focused on cataloguing, and so the listener-
# driven worker that calls it can share Redis with the rest of the
# API. Internal-only — exposed to siblings on the default network but
# not published to the host.
shazam:
build: ./shazam-sidecar
restart: unless-stopped
networks:
- default
volumes:
redis_data:
# `default` is the implicit per-stack network. `sunoh-shared` is the
# cross-stack network — create once on the host with:
# docker network create sunoh-net
# The sunoh-radio-scrapers stack joins the same external network in
# ITS docker-compose.prod.yml, exposing its container as
# `sunoh-radio-api` over Docker's built-in DNS.
networks:
default:
sunoh-shared:
name: sunoh-net
external: true