Installation & Deployment
Installation & Deployment
Section titled “Installation & Deployment”This guide covers the complete installation and deployment process for Querri in production environments.
System Requirements
Section titled “System Requirements”Minimum Hardware Requirements
Section titled “Minimum Hardware Requirements”- CPU: 4 cores (8+ cores recommended for production)
- RAM: 16GB minimum (32GB+ recommended for production)
- Storage: 100GB minimum (SSD recommended)
- Network: 1Gbps network interface
Software Requirements
Section titled “Software Requirements”- Docker: 20.10 or later
- Docker Compose: 2.0 or later
- Operating System: Linux (Ubuntu 20.04+ or RHEL 8+), macOS (for development)
- SSL/TLS: Valid SSL certificate for HTTPS (production)
Network Ports
Section titled “Network Ports”The following ports must be available:
| Port | Service | Description |
|---|---|---|
| 8080 | Traefik (HTTP) | Main application entry point |
| 8888 | Traefik (Internal) | Internal service communication |
| 27017 | MongoDB | Database (can be restricted to localhost) |
| 6379 | Redis | Cache and queue (can be restricted to localhost) |
| 8181 | OPA | Policy engine (internal) |
| 8180 | Healthz | Health check service |
Service Architecture
Section titled “Service Architecture”Querri consists of the following microservices:
Core Services
Section titled “Core Services”reverse-proxy (Traefik)
Section titled “reverse-proxy (Traefik)”- Routes traffic to appropriate services
- Handles JWT authentication
- Provides SSL/TLS termination
- Ports: 8080 (HTTP), 8888 (internal)
web-app (SvelteKit)
Section titled “web-app (SvelteKit)”- Frontend application
- Server-side rendering
- Communicates with server-api via Traefik
server-api (FastAPI)
Section titled “server-api (FastAPI)”- Python backend API
- Business logic and data processing
- Scalable with replicas (default: 4-6 replicas)
- Volume mounts:
/app(application code),/app/files(file storage)
hub (Python)
Section titled “hub (Python)”- Authentication service
- Organization management
- WorkOS integration for SSO
- Health check endpoint:
/hub/healthz
researcher
Section titled “researcher”- Data scraping and research operations
- Background processing
- Single replica deployment
healthz
Section titled “healthz”- System health monitoring
- External health check endpoint
- Port: 8180
Infrastructure Services
Section titled “Infrastructure Services”mongo (MongoDB)
Section titled “mongo (MongoDB)”- Primary database
- Persistent volume:
mongodb_data - Authentication required
- Caching layer
- Background task queue
- No persistence configured by default
opa (Open Policy Agent)
Section titled “opa (Open Policy Agent)”- Policy-based authorization
- Loads policies from
/policies/authz.regoand/policies/adminz.rego
Installation Steps
Section titled “Installation Steps”1. Install Docker and Docker Compose
Section titled “1. Install Docker and Docker Compose”Ubuntu/Debian:
# Install Dockercurl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh
# Install Docker Composesudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
# Enable Docker servicesudo systemctl enable dockersudo systemctl start dockerRHEL/CentOS:
# Install Dockersudo yum install -y docker
# Install Docker Composesudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
# Enable Docker servicesudo systemctl enable dockersudo systemctl start docker2. Clone Querri Repository
Section titled “2. Clone Querri Repository”# Clone the repositorygit clone https://github.com/querri/querri-stack.gitcd querri-stack/Querri3. Configure Environment
Section titled “3. Configure Environment”Create .env-prod file with required configuration (see Environment Configuration for details):
# Copy example environment filecp .env.example .env-prod
# Edit configurationnano .env-prodMinimum required variables:
- MongoDB credentials (
MONGO_INITDB_ROOT_USERNAME,MONGO_INITDB_ROOT_PASSWORD) - WorkOS credentials (
WORKOS_API_KEY,WORKOS_CLIENT_ID) - OpenAI or Azure OpenAI credentials
- JWT private key
- Redis configuration
4. Configure Traefik
Section titled “4. Configure Traefik”Create or verify the Traefik configuration directory:
# Ensure traefik directory existsmkdir -p traefik
# Verify traefik configuration filesls traefik/5. Pull Docker Images
Section titled “5. Pull Docker Images”# Pull all required imagesdocker compose pullThe following images will be pulled:
daveatquerri/querri-web-app:latestdaveatquerri/querri-server-api:latestdaveatquerri/querri-hub:latestdaveatquerri/querri-researcher:latestdaveatquerri/querri-healthz:latesttraefik:v2.11mongo:latestredis:latestopenpolicyagent/opa:0.70.0
6. Initialize MongoDB Volumes
Section titled “6. Initialize MongoDB Volumes”# Create MongoDB data volumedocker volume create mongodb_data7. Start Services
Section titled “7. Start Services”# Start all servicesdocker compose up -d
# Verify services are runningdocker compose psExpected output:
NAME STATUS PORTSreverse-proxy Up 0.0.0.0:8080->80/tcp, 0.0.0.0:8888->8888/tcpweb-app Upserver-api Up (replicas: 4)hub Up (healthy)researcher Uphealthz Up 0.0.0.0:8180->8000/tcpmongo Up 0.0.0.0:27017->27017/tcpredis Up 0.0.0.0:6379->6379/tcpopa Up 0.0.0.0:8181->8181/tcp8. Verify Health Checks
Section titled “8. Verify Health Checks”# Check hub service healthcurl http://localhost:8888/hub/healthz
# Check external health endpointcurl http://localhost:8180/healthz
# Check main applicationcurl http://localhost:8080/9. Configure DNS (Production)
Section titled “9. Configure DNS (Production)”Point your domain to the server IP address:
A Record: app.yourcompany.com -> YOUR_SERVER_IP10. Configure SSL/TLS (Production)
Section titled “10. Configure SSL/TLS (Production)”Update Traefik configuration to enable HTTPS:
traefik/traefik.yml:
entryPoints: web: address: ":80" http: redirections: entryPoint: to: websecure scheme: https websecure: address: ":443"
certificatesResolvers: letsencrypt: acme: email: admin@yourcompany.com storage: /letsencrypt/acme.json httpChallenge: entryPoint: webService Scaling
Section titled “Service Scaling”Scaling server-api Replicas
Section titled “Scaling server-api Replicas”Adjust the number of API replicas in .env-prod:
SERVER_API_REPLICAS=6Then restart services:
docker compose up -d --scale server-api=6Resource Limits
Section titled “Resource Limits”Add resource constraints to docker-compose.yml:
server-api: deploy: replicas: ${SERVER_API_REPLICAS:-4} resources: limits: cpus: '2.0' memory: 4G reservations: cpus: '0.5' memory: 1GHealth Checks
Section titled “Health Checks”Service Health Status
Section titled “Service Health Status”All services include health checks:
# View service healthdocker compose ps
# Check specific service logsdocker compose logs hubdocker compose logs server-apidocker compose logs web-appHub Service Health Check
Section titled “Hub Service Health Check”The hub service includes a comprehensive health check:
healthcheck: test: ["CMD", "python", "-c", "import urllib.request, os; urllib.request.urlopen('http://localhost:8000/hub/healthz').close()"] interval: 15s timeout: 3s retries: 10 start_period: 15sExternal Monitoring
Section titled “External Monitoring”The healthz service (port 8180) provides an external health check endpoint for monitoring systems:
# Health check endpointcurl http://localhost:8180/healthzTroubleshooting Installation
Section titled “Troubleshooting Installation”Services Failing to Start
Section titled “Services Failing to Start”# Check service logsdocker compose logs <service-name>
# Restart specific servicedocker compose restart <service-name>
# Rebuild and restartdocker compose up -d --build <service-name>Port Conflicts
Section titled “Port Conflicts”If ports are already in use, modify port mappings in docker-compose.yml:
ports: - "8081:80" # Changed from 8080 to 8081Permission Issues
Section titled “Permission Issues”# Fix Docker socket permissionssudo chmod 666 /var/run/docker.sock
# Or add user to docker groupsudo usermod -aG docker $USERnewgrp dockerDatabase Connection Issues
Section titled “Database Connection Issues”# Check MongoDB is runningdocker compose ps mongo
# Test MongoDB connectiondocker compose exec mongo mongosh -u querri -p
# View MongoDB logsdocker compose logs mongoPost-Installation
Section titled “Post-Installation”After successful installation:
- Create Admin User: Set up initial admin account via WorkOS or set
is_adminflag - Configure Organization: Set up organization settings at
/settings - Configure Integrations: Set up marketplace integrations (admin only)
- Invite Users: Invite team members via
/settings/people - Configure Backups: Set up automated backup procedures (see Backup & Maintenance)
- Set Up Monitoring: Configure monitoring and alerting (see Monitoring & Usage)
Updating Querri
Section titled “Updating Querri”To update to the latest version:
# Pull latest imagesdocker compose pull
# Restart services with new imagesdocker compose up -d
# Verify updatedocker compose pscurl http://localhost:8180/healthzSee Backup & Maintenance for detailed update procedures and rollback strategies.
Next Steps
Section titled “Next Steps”- Environment Configuration - Configure environment variables
- Security & Permissions - Set up authentication and authorization
- User Management - Add and manage users