Merge pull request 'Add authenticated Mem0 memory service' (#5) from feat/infra-mem0 into main
Reviewed-on: http://localhost:13000/slh/infra/pulls/5 Reviewed-by: slh <spenguin725@gmail.com>
This commit is contained in:
commit
7b8b7c469a
2
.gitignore
vendored
2
.gitignore
vendored
@ -17,3 +17,5 @@ litellm/.infra-litellm-state
|
|||||||
git-bridge/state/
|
git-bridge/state/
|
||||||
|
|
||||||
litellm/.env
|
litellm/.env
|
||||||
|
mem0/.env
|
||||||
|
mem0/history/
|
||||||
|
|||||||
@ -147,6 +147,54 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- git_forge
|
- git_forge
|
||||||
|
|
||||||
|
mem0:
|
||||||
|
container_name: mem0
|
||||||
|
build:
|
||||||
|
context: ./mem0
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
MEM0_SOURCE_REF: 42cf18c4e6adb448e981aa1c7b55c1602b0cb670
|
||||||
|
MEM0AI_VERSION: 2.0.12
|
||||||
|
HTTP_PROXY: ${MEM0_BUILD_PROXY:-http://192.168.0.4:7890}
|
||||||
|
HTTPS_PROXY: ${MEM0_BUILD_PROXY:-http://192.168.0.4:7890}
|
||||||
|
NO_PROXY: localhost,127.0.0.1,postgres,litellm
|
||||||
|
restart: unless-stopped
|
||||||
|
stop_grace_period: 30s
|
||||||
|
env_file:
|
||||||
|
- ./mem0/.env
|
||||||
|
environment:
|
||||||
|
POSTGRES_HOST: postgres
|
||||||
|
POSTGRES_PORT: "5432"
|
||||||
|
POSTGRES_DB: mem0
|
||||||
|
POSTGRES_USER: mem0
|
||||||
|
POSTGRES_COLLECTION_NAME: mem0_bootstrap_unused
|
||||||
|
APP_DB_NAME: mem0_app
|
||||||
|
OPENAI_API_KEY: internal-litellm
|
||||||
|
OPENAI_BASE_URL: http://host.docker.internal:4000/v1
|
||||||
|
MEM0_DEFAULT_LLM_MODEL: grok-fast
|
||||||
|
MEM0_DEFAULT_EMBEDDER_MODEL: voyage-4
|
||||||
|
AUTH_DISABLED: "false"
|
||||||
|
MEM0_TELEMETRY: "false"
|
||||||
|
DASHBOARD_URL: http://127.0.0.1:8888
|
||||||
|
HISTORY_DB_PATH: /app/history/history.db
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
extra_hosts:
|
||||||
|
- host.docker.internal:host-gateway
|
||||||
|
volumes:
|
||||||
|
- ./mem0/history:/app/history
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:8888:8000"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/openapi.json', timeout=3).read()"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 18
|
||||||
|
start_period: 30s
|
||||||
|
networks:
|
||||||
|
- git_forge
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
git_forge:
|
git_forge:
|
||||||
name: git_forge
|
name: git_forge
|
||||||
|
|||||||
27
mem0/Dockerfile
Normal file
27
mem0/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
FROM python:3.12-slim-bookworm AS source
|
||||||
|
|
||||||
|
ARG MEM0_SOURCE_REF=42cf18c4e6adb448e981aa1c7b55c1602b0cb670
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends ca-certificates git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
WORKDIR /src
|
||||||
|
RUN git init \
|
||||||
|
&& git remote add origin https://github.com/mem0ai/mem0.git \
|
||||||
|
&& git fetch --depth 1 origin "${MEM0_SOURCE_REF}" \
|
||||||
|
&& test "$(git rev-parse FETCH_HEAD)" = "${MEM0_SOURCE_REF}" \
|
||||||
|
&& git checkout --detach FETCH_HEAD
|
||||||
|
|
||||||
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
ARG MEM0AI_VERSION=2.0.12
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=source /src/server/requirements.txt /tmp/requirements.txt
|
||||||
|
RUN sed -i -E "s/^mem0ai.*/mem0ai==${MEM0AI_VERSION}/" /tmp/requirements.txt \
|
||||||
|
&& pip install --no-cache-dir -r /tmp/requirements.txt \
|
||||||
|
&& rm -f /tmp/requirements.txt
|
||||||
|
COPY --from=source /src/server/ /app/
|
||||||
|
RUN mkdir -p /app/history
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["sh", "-c", "alembic upgrade head && exec uvicorn main:app --host 0.0.0.0 --port 8000"]
|
||||||
14
mem0/README.md
Normal file
14
mem0/README.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Mem0
|
||||||
|
|
||||||
|
Infra runs the authenticated Mem0 OSS REST API without the optional dashboard,
|
||||||
|
Neo4j, or Qdrant. PostgreSQL/pgvector stores data in isolated `mem0` and
|
||||||
|
`mem0_app` databases. Model traffic goes through the existing LiteLLM gateway:
|
||||||
|
|
||||||
|
- memory extraction: `grok-fast`
|
||||||
|
- embeddings: `voyage-4`, 1024 dimensions
|
||||||
|
|
||||||
|
The service is bound to `127.0.0.1:8888`. The OSS API paths do not use `/v1`.
|
||||||
|
Only `POSTGRES_PASSWORD`, `JWT_SECRET`, and `ADMIN_API_KEY` live in the ignored
|
||||||
|
`mem0/.env` with mode `0600`. Non-secret runtime settings stay in Compose, and no
|
||||||
|
model-provider credential is copied into Mem0. The image source is pinned to the
|
||||||
|
upstream Mem0 `v2.0.12` release commit.
|
||||||
Loading…
x
Reference in New Issue
Block a user