Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
64 lines (61 loc) · 2.68 KB
/
Copy pathdocker-compose.yml
File metadata and controls
64 lines (61 loc) · 2.68 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
# FR-008 — docker compose up with ZERO keys yields a fully working system.
# The stack is keyless by construction: no provider key is read anywhere.
#
# ONE image for both services: only `api` carries the build section, `ingest`
# reuses the very same tag, so `docker compose build` builds once (two build
# sections on one tag built the image twice). CRIBLE_IMAGE overrides the tag
# (e.g. a pinned release, or a throwaway tag for local testing).
services:
ingest:
image: ${CRIBLE_IMAGE:-ghcr.io/maxgfr/crible:latest}
# never pull on its own: the tag comes from api's build (or from an
# explicit `docker compose pull`), so both services always run one image
pull_policy: never
command: ["crible", "ingest", "--loop"]
# an init as PID 1 forwards SIGTERM; the loop stops between stages and
# saves its budget window (it was SIGKILLed mid-write on every stop)
init: true
stop_grace_period: 1m
volumes:
- crible-data:/data
environment:
CRIBLE_DATA_DIR: /data
CRIBLE_BUDGET_PER_HOUR: ${CRIBLE_BUDGET_PER_HOUR:-330}
CRIBLE_BOOTSTRAP_SAMPLE: ${CRIBLE_BOOTSTRAP_SAMPLE:-}
# SEC fair-access: naming the operator (+ contact email) is polite and
# avoids WAF throttling of the EDGAR audited-US layer. Keyless, optional.
CRIBLE_SEC_USER_AGENT: ${CRIBLE_SEC_USER_AGENT:-crible-screener}
# optional: whole-US audited coverage via the companyfacts bulk (~1.4 GB
# weekly) instead of the per-CIK trickle — set to 1 to enable
CRIBLE_EDGAR_BULK: ${CRIBLE_EDGAR_BULK:-}
# healthy = the loop wrote its heartbeat (status.json, rewritten after
# every crawl cycle) less than 2 h ago; a missing or stale heartbeat
# means the loop is dead or wedged. start_period covers the first cycle
# on an empty volume (universe download + bootstrap sample).
healthcheck:
test: ["CMD", "python", "-c", "import os,pathlib,sys,time; p=pathlib.Path(os.environ.get('CRIBLE_DATA_DIR','/data'))/'status.json'; sys.exit(0 if p.is_file() and time.time()-p.stat().st_mtime < 7200 else 1)"]
interval: 60s
timeout: 5s
retries: 3
start_period: 15m
restart: unless-stopped
api:
image: ${CRIBLE_IMAGE:-ghcr.io/maxgfr/crible:latest}
build: .
ports:
- "${CRIBLE_PORT:-8000}:8000"
volumes:
- crible-data:/data
environment:
CRIBLE_DATA_DIR: /data
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/healthz', timeout=3).status==200 else 1)"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
depends_on:
- ingest
restart: unless-stopped
volumes:
crible-data: