Context-Store-LLM / deploy-huggingface.md
BarisT
Clean Context Store for HuggingFace deployment
5b12974
|
Raw History Blame Contribute Delete
2.89 kB

Deploy Context Store to HuggingFace

Step 1: Setup External Services

Follow external-services-setup.md to configure:

  • PostgreSQL (Neon.tech - Free)
  • Neo4j (Aura - Free)
  • Redis (Upstash - Free)

Step 2: Deploy to HuggingFace Spaces

Option A: Direct GitHub Integration

  1. Create HuggingFace Space

    https://huggingface.co/spaces
    β†’ "Create new Space"
    β†’ Name: context-store
    β†’ SDK: Docker
    β†’ Visibility: Public (Free)
    β†’ Connect Repository: BTankut/Context-Store
    
  2. Configure Environment Variables In your Space settings, add:

    DATABASE_URL=your_neon_postgresql_url
    DIRECT_URL=your_neon_postgresql_url
    NEO4J_URI=neo4j+s://your-aura-instance.databases.neo4j.io
    NEO4J_USERNAME=neo4j
    NEO4J_PASSWORD=your_neo4j_password
    REDIS_HOST=your-upstash-host.upstash.io
    REDIS_PORT=6379
    REDIS_PASSWORD=your_upstash_password
    OPENAI_API_KEY=sk-your-openai-key
    TRIGGER_PROJECT_ID=proj_gtuachiolvvekkzclssn  
    TRIGGER_SECRET_KEY=tr_dev_your_trigger_key
    SESSION_SECRET=your-random-32-char-secret
    ENCRYPTION_KEY=your-32-char-encryption-key
    
  3. Trigger Deployment

    git add .
    git commit -m "Ready for HuggingFace deployment"
    git push origin main
    

Option B: Direct Upload

  1. Prepare Files

    # Create deployment archive
    tar --exclude=node_modules --exclude=.git -czf context-store.tar.gz .
    
  2. Upload to HuggingFace

    • Create Space manually
    • Upload context-store.tar.gz
    • Extract and configure environment variables

Step 3: Access Your Deployed App

  • URL: https://your-username-context-store.hf.space
  • Health Check: https://your-username-context-store.hf.space/health
  • API: https://your-username-context-store.hf.space/api/v1/search?q=test

Step 4: Setup MCP Access

After successful deployment, connect from any device:

# Install Claude Code on any device
claude mcp add context-store https://your-username-context-store.hf.space

This gives you universal access to your Context Store memory from all devices without local setup.

Troubleshooting

Database Connection Issues

  • Verify environment variables in Space settings
  • Check database service status (Neon/Aura/Upstash)
  • Test connection strings locally first

Build Failures

  • Check HuggingFace build logs
  • Ensure Dockerfile.hf is present
  • Verify pnpm-lock.yaml compatibility

Trigger.dev Issues

  • Use development environment initially
  • Prisma bundling issues are handled by excluding problematic files
  • Simple test tasks work without Prisma

Success Criteria

βœ… Web interface accessible at HuggingFace URL
βœ… Health check returns 200 OK
βœ… API endpoints respond correctly
βœ… Database connections established
βœ… MCP server accessible from Claude Code
βœ… No local dependencies required