Context-Store-LLM / external-services-setup.md
BarisT
Clean Context Store for HuggingFace deployment
5b12974
|
Raw History Blame Contribute Delete
2.57 kB
# Context Store - External Services Setup
## Required External Services
To deploy Context Store without local dependencies, set up these cloud services:
### 1. PostgreSQL Database
**Recommended: Neon (Free tier available)**
1. Go to https://neon.tech
2. Create account and new project
3. Copy connection string
4. Set `DATABASE_URL` and `DIRECT_URL` to the same value
**Alternative: Supabase**
1. Go to https://supabase.com
2. Create project
3. Get connection string from Settings > Database
### 2. Neo4j Knowledge Graph
**Neo4j Aura (Free tier available)**
1. Go to https://neo4j.com/cloud/aura/
2. Create free account
3. Create database instance
4. Copy connection URI, username, password
5. Set `NEO4J_URI`, `NEO4J_USERNAME`, `NEO4J_PASSWORD`
### 3. Redis Cache
**Recommended: Upstash Redis (Free tier available)**
1. Go to https://upstash.com
2. Create Redis database
3. Copy connection details
4. Set `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD`
**Alternative: Redis Cloud**
1. Go to https://redis.com/redis-enterprise-cloud/
2. Create database
3. Get connection details
### 4. Environment Variables
Create `.env` file with these values:
```env
# PostgreSQL (from Neon/Supabase)
DATABASE_URL=postgresql://username:password@hostname:port/database
DIRECT_URL=postgresql://username:password@hostname:port/database
# Neo4j (from Aura)
NEO4J_URI=neo4j+s://your-instance.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password
# Redis (from Upstash)
REDIS_HOST=your-redis.upstash.io
REDIS_PORT=6379
REDIS_PASSWORD=your-password
# Required APIs
OPENAI_API_KEY=sk-your-key
TRIGGER_PROJECT_ID=proj_gtuachiolvvekkzclssn
TRIGGER_SECRET_KEY=tr_dev_your-key
# App Security
SESSION_SECRET=your-long-random-string-at-least-32-chars
ENCRYPTION_KEY=your-32-character-encryption-key-here
# HuggingFace Deployment
PORT=7860
NODE_ENV=production
HOST=0.0.0.0
```
### 5. Quick Setup Commands
After setting up external services:
```bash
# Deploy to HuggingFace
git add .
git commit -m "External services configuration"
git push origin main
# Create HuggingFace Space
# 1. Go to https://huggingface.co/spaces
# 2. Click "Create new Space"
# 3. Choose Docker SDK
# 4. Connect your GitHub repo
# 5. Add environment variables in Space settings
```
## Service Costs (Free Tiers)
- **Neon PostgreSQL**: 500MB storage free
- **Neo4j Aura**: 200k nodes + 400k relationships free
- **Upstash Redis**: 10k commands/day free
- **HuggingFace Spaces**: Free for public spaces
- **Trigger.dev**: 1000 runs/month free
Total: **$0/month** for development usage