The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
improvement(OpenMemory MCP): Improves Docker Compose commands (#2681)
Saket Aryana22287a3bac2
diff --git a/docs/openmemory/quickstart.mdx b/docs/openmemory/quickstart.mdxindex 0750ca85e..ae3795071 100644--- a/docs/openmemory/quickstart.mdx+++ b/docs/openmemory/quickstart.mdx@@ -19,17 +19,13 @@ git clone https://github.com/mem0ai/mem0.gitcd mem0/openmemory# Create the backend .env file with your OpenAI key-pushd api && echo "OPENAI_API_KEY=your_key_here" > .env && popd+make env# Build the Docker imagesmake build# Start all services (API server, vector database, and MCP server components)-make up--# Start the frontend-cp ui/.env.example ui/.env-make ui+make up```You can configure the MCP client using the following command (replace username with your username):@@ -44,4 +40,4 @@ Once set up, OpenMemory runs locally on your machine, ensuring all your AI memor### Getting Started Today-- Github Repository: https://github.com/mem0ai/mem0/openmemory\ No newline at end of file+- Github Repository: https://github.com/mem0ai/mem0/openmemorydiff --git a/openmemory/Makefile b/openmemory/Makefileindex 8e6344bf4..fdca300f9 100644--- a/openmemory/Makefile+++ b/openmemory/Makefile@@ -1,4 +1,4 @@-.PHONY: help up down logs shell migrate test test-clean env ui-install ui-start ui-dev+.PHONY: help up down logs shell migrate test test-clean env ui-install ui-start ui-dev ui-build ui-dev-startNEXT_PUBLIC_USER_ID=$(USER)NEXT_PUBLIC_API_URL=http://localhost:8765@@ -16,55 +16,37 @@ help:@echo " make test-clean - Run tests and clean up volumes"@echo " make ui-install - Install frontend dependencies"@echo " make ui-start - Start the frontend development server"- @echo " make ui - Install dependencies and start the frontend"+ @echo " make ui-dev - Install dependencies and start the frontend in dev mode"+ @echo " make ui - Install dependencies and start the frontend in production mode"env:cd api && cp .env.example .env+ cd ui && cp .env.example .envbuild:- cd api && docker-compose build+ docker compose buildup:- cd api && docker-compose up+ NEXT_PUBLIC_USER_ID=$(USER) NEXT_PUBLIC_API_URL=$(NEXT_PUBLIC_API_URL) docker compose updown:- cd api && docker-compose down -v+ docker compose down -vrm -f api/openmemory.dblogs:- cd api && docker-compose logs -f+ docker compose logs -fshell:- cd api && docker-compose exec api bash+ docker compose exec api bashupgrade:- cd api && docker-compose exec api alembic upgrade head+ docker compose exec api alembic upgrade headmigrate:- cd api && docker-compose exec api alembic upgrade head+ docker compose exec api alembic upgrade headdowngrade:- cd api && docker-compose exec api alembic downgrade -1+ docker compose exec api alembic downgrade -1-test:- cd api && docker-compose run --rm api pytest tests/ -v--test-clean:- cd api && docker-compose run --rm api pytest tests/ -v && docker-compose down -v--# Frontend commands-ui-install:- cd ui && pnpm install--ui-build:- cd ui && pnpm build--ui-start:- cd ui && NEXT_PUBLIC_USER_ID=$(USER) NEXT_PUBLIC_API_URL=$(NEXT_PUBLIC_API_URL) pnpm start--ui-dev-start:- cd ui && NEXT_PUBLIC_USER_ID=$(USER) NEXT_PUBLIC_API_URL=$(NEXT_PUBLIC_API_URL) && pnpm dev--ui-dev: ui-install ui-dev-start--ui: ui-install ui-build ui-start\ No newline at end of file+ui-dev:+ cd ui && NEXT_PUBLIC_USER_ID=$(USER) NEXT_PUBLIC_API_URL=$(NEXT_PUBLIC_API_URL) pnpm install && pnpm devdiff --git a/openmemory/README.md b/openmemory/README.mdindex d7f540171..5433a17db 100644--- a/openmemory/README.md+++ b/openmemory/README.md@@ -15,9 +15,8 @@ OpenMemory is your personal memory layer for LLMs - private, portable, and open-You can run the project using the following two commands:```bash-make build # builds the mcp server-make up # runs openmemory mcp server-make ui # runs openmemory ui+make build # builds the mcp server and ui+make up # runs openmemory mcp server and ui```After running these commands, you will have:diff --git a/openmemory/api/.env.example b/openmemory/api/.env.exampleindex 2627a0e9f..b29363f94 100644--- a/openmemory/api/.env.example+++ b/openmemory/api/.env.example@@ -1,2 +1 @@-OPENAI_API_KEY=sk-...-USER=username\ No newline at end of file+OPENAI_API_KEY=sk-xxx\ No newline at end of filediff --git a/openmemory/api/README.md b/openmemory/api/README.mdindex 3e92170f0..bf8418c52 100644--- a/openmemory/api/README.md+++ b/openmemory/api/README.md@@ -11,7 +11,14 @@ The easiest way to get started is using Docker. Make sure you have Docker and Domake build```-2. Start the services:+2. Create `.env` file:+```bash+make env+```++Once you run this command, edit the file `api/.env` and enter the `OPENAI_API_KEY`.++3. Start the services:```bashmake up```diff --git a/openmemory/api/docker-compose.yml b/openmemory/docker-compose.ymlsimilarity index 54%rename from openmemory/api/docker-compose.ymlrename to openmemory/docker-compose.ymlindex 91434645e..fec21a740 100644--- a/openmemory/api/docker-compose.yml+++ b/openmemory/docker-compose.yml@@ -5,22 +5,31 @@ services:- "6333:6333"volumes:- mem0_storage:/mem0/storage- api:+ openmemory-mcp:image: mem0/openmemory-mcp- build: .+ build: api/environment:- - OPENAI_API_KEY- USERenv_file:- - .env+ - api/.envdepends_on:- mem0_storeports:- "8765:8765"volumes:- - .:/usr/src/openmemory+ - ./api:/usr/src/openmemorycommand: >sh -c "uvicorn main:app --host 0.0.0.0 --port 8765 --reload --workers 4"+ openmemory-ui:+ build:+ context: ui/+ dockerfile: Dockerfile+ image: mem0/openmemory-ui:latest+ ports:+ - "3000:3000"+ environment:+ - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}+ - NEXT_PUBLIC_USER_ID=${USER}volumes:mem0_storage:diff --git a/openmemory/ui/.env.dev b/openmemory/ui/.env.devdeleted file mode 100644index 896ce957a..000000000--- a/openmemory/ui/.env.dev+++ /dev/null@@ -1,2 +0,0 @@-NEXT_PUBLIC_API_URL=NEXT_PUBLIC_API_URL-NEXT_PUBLIC_USER_ID=NEXT_PUBLIC_USER_ID\ No newline at end of filediff --git a/openmemory/ui/.env.example b/openmemory/ui/.env.exampleindex 610eee89b..3768f3e59 100644--- a/openmemory/ui/.env.example+++ b/openmemory/ui/.env.example@@ -1,2 +1,2 @@-NEXT_PUBLIC_API_URL=http://localhost:8765-NEXT_PUBLIC_USER_ID=default-user+NEXT_PUBLIC_API_URL=NEXT_PUBLIC_API_URL+NEXT_PUBLIC_USER_ID=NEXT_PUBLIC_USER_IDdiff --git a/openmemory/ui/Dockerfile b/openmemory/ui/Dockerfileindex ec0f7f8db..7fd1dc982 100644--- a/openmemory/ui/Dockerfile+++ b/openmemory/ui/Dockerfile@@ -10,16 +10,12 @@ RUN apk add --no-cache libc6-compat curl && \WORKDIR /app-# Dependencies stageFROM base AS deps-# Copy lockfile and manifestCOPY package.json pnpm-lock.yaml ./-# Install dependencies using pnpmRUN pnpm install --frozen-lockfile-# Builder stageFROM base AS builderWORKDIR /app@@ -28,30 +24,24 @@ COPY --from=deps /app/pnpm-lock.yaml ./pnpm-lock.yamlCOPY . .RUN cp next.config.dev.mjs next.config.mjs-RUN cp .env.dev .env-+RUN cp .env.example .envRUN pnpm build-# Production runner stageFROM base AS runnerWORKDIR /appENV NODE_ENV=production-# Create non-root user for securityRUN addgroup --system --gid 1001 nodejs && \adduser --system --uid 1001 nextjs-# Copy production dependencies and built artifactsCOPY --from=builder /app/public ./publicCOPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static-# Copy and prepare entrypoint scriptCOPY --chown=nextjs:nodejs entrypoint.sh /home/nextjs/entrypoint.shRUN chmod +x /home/nextjs/entrypoint.sh-# Switch to non-root userUSER nextjsEXPOSE 3000diff --git a/openmemory/ui/docker-compose.yml b/openmemory/ui/docker-compose.ymldeleted file mode 100644index 6dee2b267..000000000--- a/openmemory/ui/docker-compose.yml+++ /dev/null@@ -1,13 +0,0 @@-services:- frontend:- build:- context: .- dockerfile: Dockerfile- image: mem0/openmemory-ui:latest- ports:- - "3000:3000"- env_file:- - .env- environment:- - NEXT_PUBLIC_API_URL=NEXT_PUBLIC_API_URL- - NEXT_PUBLIC_USER_ID=NEXT_PUBLIC_USER_ID