-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
113 lines (106 loc) · 4 KB
/
docker-compose.yml
File metadata and controls
113 lines (106 loc) · 4 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
services:
# ─── Nginx reverse proxy + React SPA ──────────────────────────────────────
nginx:
build:
context: .
dockerfile: docker/nginx/Dockerfile
ports:
- "8080:80"
depends_on:
- api
- qlever
networks:
- shexmap-net
restart: unless-stopped
# ─── Node.js / Fastify API ─────────────────────────────────────────────────
api:
build:
context: .
dockerfile: docker/api/Dockerfile
env_file: .env
environment:
NODE_ENV: production
QLEVER_SPARQL_URL: http://qlever:7001/sparql
QLEVER_UPDATE_URL: http://qlever:7001/update
QLEVER_ACCESS_TOKEN: ${QLEVER_ACCESS_TOKEN:-shexmap-dev-token}
depends_on:
qlever-init:
condition: service_completed_successfully
networks:
- shexmap-net
restart: unless-stopped
# ─── QLever index initialiser (runs once, exits) ──────────────────────────
qlever-init:
image: adfreiburg/qlever:latest
user: "0"
entrypoint: ["/bin/sh", "/scripts/init-index.sh"]
environment:
# Optional: set to a path inside the container to restore from a backup.
# Example: RESTORE_FROM=/backups/2024-01-01T12-00-00.ttl
# The sparql/backup/ host directory is mounted at /backups below.
RESTORE_FROM: ${RESTORE_FROM:-}
BASE_NAMESPACE: ${BASE_NAMESPACE:-https://w3id.org/shexmap/}
volumes:
- qlever-data:/data # persisted index files
- ./sparql:/sparql-data:ro # seed + ontology Turtle files
- ./docker/qlever:/scripts:ro
- ./sparql/backup:/backups:ro # backup files available to restore from
working_dir: /data
networks:
- shexmap-net
# ─── QLever SPARQL server ──────────────────────────────────────────────────
qlever:
image: adfreiburg/qlever:latest
entrypoint: ["sh", "-c",
"qlever start --name shexmap --description 'ShExMap Repository' --port 7001 --system native --run-in-foreground --access-token \"${QLEVER_ACCESS_TOKEN:-shexmap-dev-token}\""
]
volumes:
- qlever-data:/data # index built by qlever-init
working_dir: /data
depends_on:
qlever-init:
condition: service_completed_successfully
networks:
- shexmap-net
restart: unless-stopped
# ─── GitHub ShEx Harvester (opt-in) ───────────────────────────────────────
# Periodically crawls GitHub for .shex files containing %Map: annotations
# and imports them via the REST API. Off by default; enable with:
# docker compose --profile harvester up
#
# Required env vars: GITHUB_TOKEN (strongly recommended for higher rate limits)
# Optional: HARVESTER_API_KEY (when AUTH_ENABLED=true), HARVEST_INTERVAL_HOURS
harvester:
build:
context: .
dockerfile: docker/api/Dockerfile
profiles: ["harvester"]
entrypoint:
- sh
- -c
- |
INTERVAL=$${HARVEST_INTERVAL_HOURS:-24}
echo "[harvester] Starting — interval=${INTERVAL}h"
while true; do
npx tsx scripts/collect-github-shex.ts \
--api-url "http://api:3000/api/v1" \
--sparql-url "http://qlever:7001/sparql" \
${GITHUB_TOKEN:+--token "$GITHUB_TOKEN"} \
${HARVESTER_API_KEY:+--api-key "$HARVESTER_API_KEY"}
echo "[harvester] Next run in $${INTERVAL}h"
sleep $$(( INTERVAL * 3600 ))
done
env_file: .env
environment:
NODE_ENV: production
depends_on:
qlever-init:
condition: service_completed_successfully
networks:
- shexmap-net
restart: unless-stopped
volumes:
qlever-data:
networks:
shexmap-net:
driver: bridge