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.
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
# Memory OS — Docker Compose
|
||||
# Qdrant + Redis + ARQ Worker + Monitoring (Prometheus + Grafana)
|
||||
|
||||
services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
command: >
|
||||
sh -c '
|
||||
mkdir -p /usr/local/etc/redis &&
|
||||
echo "requirepass $${REDIS_PASSWORD}" > /usr/local/etc/redis/redis.conf &&
|
||||
echo "bind 0.0.0.0" >> /usr/local/etc/redis/redis.conf &&
|
||||
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
|
||||
echo "maxmemory 512mb" >> /usr/local/etc/redis/redis.conf &&
|
||||
echo "maxmemory-policy allkeys-lru" >> /usr/local/etc/redis/redis.conf &&
|
||||
redis-server /usr/local/etc/redis/redis.conf
|
||||
'
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
ports:
|
||||
- "127.0.0.1:6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
qdrant:
|
||||
image: qdrant/qdrant:v1.17.1
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:6333:6333"
|
||||
volumes:
|
||||
- qdrant_data:/qdrant/storage
|
||||
environment:
|
||||
QDRANT__SERVICE__HTTP_PORT: "6333"
|
||||
QDRANT__SERVICE__API_KEY: ${QDRANT_API_KEY:-}
|
||||
healthcheck:
|
||||
test: ["CMD", "sh", "-c", "grep -q ':18BD' /proc/net/tcp"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ./worker
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
qdrant:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: "6379"
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
QDRANT_HOST: qdrant
|
||||
QDRANT_PORT: "6333"
|
||||
QDRANT_API_KEY: ${QDRANT_API_KEY}
|
||||
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
|
||||
EMBEDDING_DIMS: "${EMBEDDING_DIMS:-4096}"
|
||||
COLLECTION_NAME: "${COLLECTION_NAME:-knowledge_base}"
|
||||
ARQ_JOB_TIMEOUT: "300"
|
||||
ARQ_MAX_JOBS: "10"
|
||||
ARQ_KEEP_RESULT: "3600"
|
||||
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||
volumes:
|
||||
- ${MEMORY_OS_WIKI_PATH:-./wiki}:/wiki:ro
|
||||
- ${MEMORY_OS_HERMES_HOME:-./hermes}:/hermes:rw
|
||||
- ${MEMORY_OS_FABRIC_DIR:-./fabric}:/fabric:rw
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:9090:9090"
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus_data:/prometheus
|
||||
command:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
- "--web.enable-lifecycle"
|
||||
- "--storage.tsdb.retention.time=30d"
|
||||
|
||||
node-exporter:
|
||||
image: prom/node-exporter:latest
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
pid: host
|
||||
command:
|
||||
- "--path.rootfs=/host"
|
||||
volumes:
|
||||
- /:/host:ro,rslave
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000"
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
environment:
|
||||
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
||||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
qdrant_data:
|
||||
prometheus_data:
|
||||
grafana_data:
|
||||
@@ -12,8 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd -r -u 10001 appuser
|
||||
# Create non-root user matching default host UID (1000) for bind mount permissions
|
||||
RUN useradd -r -u 1000 appuser
|
||||
|
||||
# Copy source code with correct ownership
|
||||
COPY --chown=appuser:appuser . .
|
||||
|
||||
Reference in New Issue
Block a user