Skip to content

Commit 16e394c

Browse files
author
ClaudioDrews
committed
fix: align worker UID with host user (1000) for bind mount read access
Worker ran as appuser (UID 10001) but wiki files are owned by host user hermes (UID 1000) with permissions 600. Changed Dockerfile to create appuser with UID 1000 so the container process can read bind-mounted wiki files.
1 parent 57912f5 commit 16e394c

2 files changed

Lines changed: 118 additions & 2 deletions

File tree

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Memory OS — Docker Compose
2+
# Qdrant + Redis + ARQ Worker + Monitoring (Prometheus + Grafana)
3+
4+
services:
5+
redis:
6+
image: redis:7-alpine
7+
restart: unless-stopped
8+
command: >
9+
sh -c '
10+
mkdir -p /usr/local/etc/redis &&
11+
echo "requirepass $${REDIS_PASSWORD}" > /usr/local/etc/redis/redis.conf &&
12+
echo "bind 0.0.0.0" >> /usr/local/etc/redis/redis.conf &&
13+
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
14+
echo "maxmemory 512mb" >> /usr/local/etc/redis/redis.conf &&
15+
echo "maxmemory-policy allkeys-lru" >> /usr/local/etc/redis/redis.conf &&
16+
redis-server /usr/local/etc/redis/redis.conf
17+
'
18+
environment:
19+
REDIS_PASSWORD: ${REDIS_PASSWORD}
20+
ports:
21+
- "127.0.0.1:6379:6379"
22+
volumes:
23+
- redis_data:/data
24+
healthcheck:
25+
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
26+
interval: 5s
27+
timeout: 3s
28+
retries: 5
29+
30+
qdrant:
31+
image: qdrant/qdrant:v1.17.1
32+
restart: unless-stopped
33+
ports:
34+
- "127.0.0.1:6333:6333"
35+
volumes:
36+
- qdrant_data:/qdrant/storage
37+
environment:
38+
QDRANT__SERVICE__HTTP_PORT: "6333"
39+
QDRANT__SERVICE__API_KEY: ${QDRANT_API_KEY:-}
40+
healthcheck:
41+
test: ["CMD", "sh", "-c", "grep -q ':18BD' /proc/net/tcp"]
42+
interval: 10s
43+
timeout: 5s
44+
retries: 5
45+
start_period: 10s
46+
47+
worker:
48+
build:
49+
context: ./worker
50+
dockerfile: Dockerfile
51+
restart: unless-stopped
52+
depends_on:
53+
qdrant:
54+
condition: service_healthy
55+
redis:
56+
condition: service_healthy
57+
environment:
58+
REDIS_HOST: redis
59+
REDIS_PORT: "6379"
60+
REDIS_PASSWORD: ${REDIS_PASSWORD}
61+
QDRANT_HOST: qdrant
62+
QDRANT_PORT: "6333"
63+
QDRANT_API_KEY: ${QDRANT_API_KEY}
64+
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
65+
EMBEDDING_DIMS: "${EMBEDDING_DIMS:-4096}"
66+
COLLECTION_NAME: "${COLLECTION_NAME:-knowledge_base}"
67+
ARQ_JOB_TIMEOUT: "300"
68+
ARQ_MAX_JOBS: "10"
69+
ARQ_KEEP_RESULT: "3600"
70+
LOG_LEVEL: ${LOG_LEVEL:-INFO}
71+
volumes:
72+
- ${MEMORY_OS_WIKI_PATH:-./wiki}:/wiki:ro
73+
- ${MEMORY_OS_HERMES_HOME:-./hermes}:/hermes:rw
74+
- ${MEMORY_OS_FABRIC_DIR:-./fabric}:/fabric:rw
75+
76+
prometheus:
77+
image: prom/prometheus:latest
78+
restart: unless-stopped
79+
ports:
80+
- "127.0.0.1:9090:9090"
81+
volumes:
82+
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
83+
- prometheus_data:/prometheus
84+
command:
85+
- "--config.file=/etc/prometheus/prometheus.yml"
86+
- "--storage.tsdb.path=/prometheus"
87+
- "--web.enable-lifecycle"
88+
- "--storage.tsdb.retention.time=30d"
89+
90+
node-exporter:
91+
image: prom/node-exporter:latest
92+
restart: unless-stopped
93+
network_mode: host
94+
pid: host
95+
command:
96+
- "--path.rootfs=/host"
97+
volumes:
98+
- /:/host:ro,rslave
99+
100+
grafana:
101+
image: grafana/grafana:latest
102+
restart: unless-stopped
103+
ports:
104+
- "127.0.0.1:3000:3000"
105+
volumes:
106+
- grafana_data:/var/lib/grafana
107+
environment:
108+
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
109+
GF_AUTH_ANONYMOUS_ENABLED: "true"
110+
GF_USERS_ALLOW_SIGN_UP: "false"
111+
112+
volumes:
113+
redis_data:
114+
qdrant_data:
115+
prometheus_data:
116+
grafana_data:

docker/worker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1212
COPY requirements.txt .
1313
RUN pip install --no-cache-dir -r requirements.txt
1414

15-
# Create non-root user
16-
RUN useradd -r -u 10001 appuser
15+
# Create non-root user matching default host UID (1000) for bind mount permissions
16+
RUN useradd -r -u 1000 appuser
1717

1818
# Copy source code with correct ownership
1919
COPY --chown=appuser:appuser . .

0 commit comments

Comments
 (0)