-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
69 lines (59 loc) · 1.92 KB
/
Copy pathdocker-compose.yml
File metadata and controls
69 lines (59 loc) · 1.92 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
# Obsidian LiveSync - CouchDB Backend
# Designed for Raspberry Pi (ARM64) + Tailscale
#
# Usage:
# 1. cp .env.example .env && edit .env
# 2. docker compose up -d
# 3. ./scripts/couchdb-init.sh (first time only)
# 4. sudo tailscale serve --bg --https 6984 http://127.0.0.1:5984
services:
couchdb:
image: couchdb:${COUCHDB_IMAGE_TAG:-3.4.3}
container_name: obsidian-couchdb
restart: unless-stopped
environment:
- COUCHDB_USER=${COUCHDB_USER:?Set COUCHDB_USER in .env}
- COUCHDB_PASSWORD=${COUCHDB_PASSWORD:?Set COUCHDB_PASSWORD in .env}
- COUCHDB_SECRET=${COUCHDB_SECRET:-}
volumes:
- ${COUCHDB_DATA_PATH:-./couchdb-data}:/opt/couchdb/data
- ./couchdb/local.ini:/opt/couchdb/etc/local.d/001-livesync.ini
# Localhost only; tailscale serve (port 6984) handles external HTTPS access
ports:
- "127.0.0.1:5984:5984"
healthcheck:
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/5984' || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 60s
# Drop all caps except the 5 the entrypoint needs (chown/chmod, write
# docker.ini, then setpriv to uid 5984). No :ro on local.ini — entrypoint
# chowns config files and crashes if read-only (couchdb-docker#192, #204).
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- FOWNER
- SETUID
- SETGID
# Give CouchDB time to flush writes on slow SD card before SIGKILL
stop_grace_period: 30s
deploy:
resources:
limits:
memory: ${COUCHDB_MEM_LIMIT:-512m}
reservations:
memory: 128m
# Keep CouchDB logs and Erlang temp files in RAM to reduce SD card writes
tmpfs:
- /opt/couchdb/var/log:size=10m,uid=5984,gid=5984
- /tmp:size=50m
logging:
driver: json-file
options:
max-size: "5m"
max-file: "2"