Overview
The RippleCore Consultant App is a specialized portal for sustainability consultants managing multiple client organizations. This guide covers deployment configuration specific to the consultant app.Prerequisites
Before deploying the consultant app, ensure you have:Infrastructure Running
- PostgreSQL 18 database (shared with main app)
- Redis 7 cache (shared with main app)
- Domain name configured (e.g.,
consultant.yourdomain.com)
Main App Deployed
- Deploy main app first (see Deployment Overview)
- Ensure database schema is up to date
- Verify Redis is accessible from consultant app
Environment Configured
- All required environment variables ready
- OpenAI API key for AI theme generation (optional)
- Email service configured (Resend recommended)
Environment Variables
Required Variables
Createapps/consultant/.env.production with these variables:
Optional Variables
Deployment Methods
- Dokploy (Recommended)
- Docker Compose
- Standalone Server
Deploy with Dokploy
The consultant app includes adokploy.yaml configuration file for easy deployment.Create Service in Dokploy
- Open Dokploy dashboard
- Navigate to your RippleCore project
- Click New Service → Application
- Select Git Source → Choose repository
- Branch:
main
Configure Build
- Build context:
.(monorepo root) - Dockerfile path:
apps/consultant/Dockerfile - Build command: Auto-detected from Dockerfile
Add Environment Variables
- Copy from your
.env.productionfile - Or use Dokploy’s .env file upload feature
- Verify
DATABASE_URLandREDIS_URLpoint to shared infrastructure
Configure Domain
- Domain:
consultant.yourdomain.com - SSL: Auto (Let’s Encrypt)
- HTTP → HTTPS redirect: Enabled
- Port: 3008 (internal), 80/443 (external via Traefik)
Deploy
- ✅ Dependencies installed
- ✅ Next.js build successful
- ✅ Container started
- ✅ Health check passing
- ✅ SSL certificate issued
Port Configuration
Development
Port 3008 is used for local development:Production
Port 3008 (internal) with reverse proxy for external access:Internal Port
External Port
Multi-App Deployment
Deploying Multiple RippleCore Apps
The consultant app is typically deployed alongside the main RippleCore app:Deploy Infrastructure
- PostgreSQL 18 (shared database)
- Redis 7 (shared cache)
- Traefik or Nginx (reverse proxy)
Deploy Main App
- Domain:
app.yourdomain.com - Port: 3000
- See Deployment Overview
Deploy Consultant App
- Domain:
consultant.yourdomain.com - Port: 3008
- Use same
DATABASE_URLandREDIS_URL
Optional: Deploy Other Apps
- Marketing:
www.yourdomain.com(port 3001) - API:
api.yourdomain.com(port 3002) - Council:
council.yourdomain.com(port 3010) - Charity:
charity.yourdomain.com(port 3009)
Resource Requirements
Minimum Specifications
For the consultant app alone (not including infrastructure):CPU
Memory
Storage
Network
Recommended VPS for Full Stack
For all RippleCore apps + infrastructure:- Hetzner CPX32: 4 vCPU, 8 GB RAM, €11.99/month
- Digital Ocean: $24/month droplet (4GB RAM)
- Linode: $12/month Dedicated 4GB
Health Checks & Monitoring
Health Endpoint
The consultant app exposes a health check endpoint: URL:https://consultant.yourdomain.com/api/health
Response (healthy):
Monitoring Setup
- Uptime Monitoring
- Application Logs
- Performance Metrics
- UptimeRobot - Free tier available
- Pingdom
- Better Uptime
- HTTP status != 200
- Response time > 2 seconds
statusfield != “ok”
Deployment Checklist
Pre-Deployment
Verify Infrastructure
Run Database Migrations
Test Build Locally
Configure Environment
- Copy all required environment variables
- Generate new
BETTER_AUTH_SECRETif needed: - Verify
BETTER_AUTH_URLmatches your domain
Deployment
Deploy to Platform
Verify Health
200 OK with "status": "ok"Test Authentication
- Navigate to
https://consultant.yourdomain.com - Sign in with a consultant account
- Verify dashboard loads correctly
- Test organization switcher
Test Core Features
- Create a client invitation
- Access theme editor
- View portfolio analytics
- Test white-label preview
Post-Deployment
Configure Monitoring
- Add health check to uptime monitor
- Set up error tracking (Sentry recommended)
- Configure log aggregation
Performance Tuning
- Review response times in production
- Adjust container resource limits if needed
- Enable Redis caching verification
Security Hardening
- Verify SSL certificate is valid
- Test rate limiting (Arcjet)
- Review security headers
- Enable CORS if needed for API access
Common Deployment Issues
Database Connection Errors
Connection Refused
Connection Refused
ECONNREFUSED when connecting to PostgreSQLCauses:- Database not running
- Incorrect
DATABASE_URL - Network/firewall blocking connection
Authentication Failed
Authentication Failed
password authentication failedCauses:- Wrong database password in
DATABASE_URL - User doesn’t exist
- Verify
DATABASE_URLformat:postgresql://user:password@host:5432/database - Check database user exists and has correct password
- Verify user has permissions on
ripplecoredatabase
Redis Connection Errors
Redis Unavailable
Redis Unavailable
Build Failures
TypeScript Errors
TypeScript Errors
Dependency Issues
Dependency Issues
Runtime Issues
Theme Editor Not Loading
Theme Editor Not Loading
- Missing
OPENAI_API_KEYfor AI generation - Client-side hydration mismatch
- Browser compatibility issue
- Add
OPENAI_API_KEYfor AI features (optional but recommended) - Check browser console for errors
- Test in Chrome/Firefox latest versions
- Clear browser cache and cookies
Sessions Not Persisting
Sessions Not Persisting
- Redis not accessible
BETTER_AUTH_SECRETmismatch between apps- Secure cookie issues with HTTP (not HTTPS)
- Verify Redis connection from consultant app
- Ensure same
BETTER_AUTH_SECRETacross all apps - Use HTTPS in production (
BETTER_AUTH_TRUST_HOST=true) - Check session cookies in browser DevTools
Scaling Considerations
Horizontal Scaling
The consultant app can be scaled horizontally with multiple instances: Requirements:- Load balancer (Traefik, Nginx, HAProxy)
- Shared Redis for session storage
- Shared PostgreSQL database
- Sticky sessions NOT required (stateless)
Vertical Scaling
Adjust resources based on consultant portfolio size:| Clients | vCPU | Memory | Notes |
|---|---|---|---|
| 1-10 | 0.5 | 512 MB | Starter consultants |
| 10-30 | 1.0 | 1 GB | Growing portfolios |
| 30-100 | 2.0 | 2 GB | Established firms |
| 100+ | 4.0 | 4 GB | Enterprise consultants |
Security Considerations
Consultant-Specific Security
Multi-Client Data Isolation
Multi-Client Data Isolation
- Row-level security (RLS) in PostgreSQL enforces isolation
organizationIdfiltering on all queries- Session validation on every request
- Redis cache keys include
organizationId
API Rate Limiting
API Rate Limiting
- Authenticated: 100 requests/minute
- Bulk operations: 10 requests/minute
- AI generation: 5 requests/minute
Secrets Management
Secrets Management
- Use environment variables for all secrets
- Rotate
BETTER_AUTH_SECRETevery 90 days - Store secrets in Dokploy/platform secret manager
- Use different secrets for dev/staging/production
BETTER_AUTH_SECRET(32+ characters, shared across apps)OPENAI_API_KEY(for AI theme generation)RESEND_TOKEN(for client emails)ARCJET_KEY(for rate limiting)
Updating the Consultant App
Zero-Downtime Updates
Backup Database
Deploy New Version
- Push to git:
git push origin main - Dokploy auto-deploys from webhook
- Old container stops after new one is healthy
Run Migrations
Verify Health
Troubleshooting
Deployment Verification Script
Use this script to verify your deployment:Additional Resources
Deployment Overview
Dokploy Guide
Docker Compose
Troubleshooting
What’s Next?
Deploy the App
Invite Your First Client
Customize Branding
Monitor Performance
Onboard Consultants
