Skip to content

feat(server): LAN deployment enhancements — health endpoint, retry, CORS, configurable URLs#5379

Open
jxufesoft wants to merge 3 commits into
mem0ai:mainfrom
jxufesoft:feat/lan-deployment-enhancements
Open

feat(server): LAN deployment enhancements — health endpoint, retry, CORS, configurable URLs#5379
jxufesoft wants to merge 3 commits into
mem0ai:mainfrom
jxufesoft:feat/lan-deployment-enhancements

Conversation

@jxufesoft
Copy link
Copy Markdown

@jxufesoft jxufesoft commented Jun 5, 2026

Linked Issue

N/A — addresses self-hosted deployment gaps identified during LAN setup.

Description

This PR improves the self-hosted server/ deployment experience for LAN and network-accessible environments:

Core Changes

  1. /health endpoint (server/main.py)

    • New GET /health — lightweight liveness & readiness probe with DB check (SELECT 1)
    • No auth required; returns {"status": "ok"|"degraded", "db": true|false}
    • Added to SKIPPED_REQUEST_LOG_PATHS to avoid log noise
  2. Transient error retry (server/main.py)

    • _retry_upstream() decorator with linear backoff on POST /memories and POST /search
    • Retries transient codes: provider_timeout, provider_rate_limited, provider_unavailable, datastore_unavailable, vector_store_unavailable
    • Skips retry on permanent client errors
  3. Smart CORS (server/main.py)

    • EXTRA_CORS_ORIGINS env var for explicit origin list
    • When AUTH_DISABLED=true, allows * origin so any LAN client can use the API
  4. Better error handling (server/main.py)

    • DELETE /memories/{id} returns 404 for invalid/not-found IDs instead of generic 500
  5. Configurable docker-compose (server/docker-compose.yaml)

    • DASHBOARD_URL, NEXT_PUBLIC_API_URL, INSTANCE_NAME configurable via env vars
    • PostgreSQL bound to 127.0.0.1:8432 only
    • Local source mount ..:/opt/mem0-src for dev-mode installs
    • mem0 service healthcheck using /health endpoint
  6. Global search support (mem0/memory/main.py)

    • Removes mandatory filter requirement from Memory.search() and Memory.get_all()
  7. Dashboard fixes (server/dashboard/)

    • Node 22 upgrade, cookie secure flag fix for HTTP LAN access

Type of Change

  • New feature (non-breaking change that adds functionality)

Breaking Changes

None — all new behavior is additive and backward-compatible.

Test Coverage

  • Tested manually — full Docker Compose stack on LAN with AUTH_DISABLED=true

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • New and existing tests pass locally

user and others added 3 commits June 4, 2026 23:03
- Upgrade Dashboard base image from node:20 to node:22 (pnpm 11 requires Node 22+)
- Use npm-installed pnpm@9 to avoid pnpm 11 build script approval errors
- Fix cookie secure flag: use COOKIE_SECURE env var instead of NODE_ENV
  (NODE_ENV=production caused secure=true, breaking HTTP LAN access)
- Configure LAN-accessible URLs in docker-compose.yaml

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code changes:
- mem0/memory/main.py: drop mandatory filter requirement from
  Memory.search/get_all and async versions; empty filters now
  search across all users (supports LAN-wide global search)
- server/main.py: add _retry_upstream decorator with linear backoff
  on POST /memories and POST /search for transient upstream errors;
  smart CORS (allow * when AUTH_DISABLED=true); EXTRA_CORS_ORIGINS
  env var; 404 handling for DELETE on invalid/not-found memory IDs
- server/docker-compose.yaml: configurable URLs via env vars with
  defaults; PostgreSQL bound to 127.0.0.1 only; install mem0 from
  local source via /opt/mem0-src volume mount; EXTRA_CORS_ORIGINS
  support; dashboard healthcheck uses 127.0.0.1

Documentation:
- DEPLOY_MANUAL.md: new sections for CORS/network config (3.5),
  transient error retry (9.5); updated .env example with all new
  env vars; refreshed modified-files changelog (Section 8); added
  global search example (no filters)
- server/README.md: new sections for LAN/Network Deployment,
  Transient Error Retry, and API Notes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add GET /health endpoint with DB liveness probe (SELECT 1)
- Add healthcheck to mem0 service in docker-compose
- Update SKIPPED_REQUEST_LOG_PATHS to include /health

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


user seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jxufesoft jxufesoft changed the title Feat/lan deployment enhancements feat(server): LAN deployment enhancements — health endpoint, retry, CORS, configurable URLs Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants