Deployment
Guide for deploying the NorChain ecosystem to production.
Overview
The NorChain ecosystem consists of multiple services that can be deployed independently or together.
Deployment Options
Option 1: Docker Compose (Recommended for Single Server)
Deploy all services using Docker Compose:
docker-compose up -dOption 2: Individual Services
Deploy each service independently:
- Explorer API (NestJS)
- Explorer App (Next.js)
- Landing Page (Next.js)
- NEX Exchange (Next.js)
- Documentation (Next.js)
Option 3: Kubernetes
Deploy to Kubernetes cluster for scalability.
Pre-Deployment Checklist
- Environment variables configured
- Database migrations run
- SSL certificates configured
- Domain names configured
- CORS settings updated
- Rate limiting configured
- Monitoring set up
- Backup strategy in place
Explorer API Deployment
Build
cd apps/explorer-api
npm run buildEnvironment Variables
NODE_ENV=production
PORT=3000
DATABASE_URL=postgresql://...
JWT_SECRET=...
RPC_URL=https://rpc.norchain.org
CHAIN_ID=65001
CORS_ORIGIN=https://explorer.norchain.org,https://norchain.orgRun
npm run start:prodDocker
docker build -t norchain-api .
docker run -p 3000:3000 --env-file .env norchain-apiExplorer App Deployment
Build
cd apps/explorer
npm run buildEnvironment Variables
NEXT_PUBLIC_API_URL=https://api.norchain.org/api/v1
NEXT_PUBLIC_RPC_URL=https://rpc.norchain.org
NEXT_PUBLIC_CHAIN_ID=65001Deploy to Vercel
vercel --prodDeploy to Docker
docker build -t norchain-explorer .
docker run -p 3002:3002 --env-file .env.local norchain-explorerLanding Page Deployment
Build
cd apps/landing
npm run buildEnvironment Variables
NEXT_PUBLIC_API_URL=https://api.norchain.org/api/v1Deploy
Similar to Explorer App deployment.
NEX Exchange Deployment
Build
cd apps/nex-exchange
npm run buildEnvironment Variables
NEXT_PUBLIC_EXPLORER_API_URL=https://api.norchain.org
NEXT_PUBLIC_RPC_URL=https://rpc.norchain.org
NEXT_PUBLIC_CHAIN_ID=65001Documentation Deployment
Build
cd apps/docs
npm run buildDeploy
Deploy static export or use Next.js hosting.
Production Considerations
Security
- Use HTTPS everywhere
- Set secure JWT secrets
- Enable rate limiting
- Configure CORS properly
- Use environment variables for secrets
Performance
- Enable Redis caching
- Use CDN for static assets
- Enable compression
- Optimize database queries
- Use connection pooling
Monitoring
- Set up health checks
- Monitor error rates
- Track API usage
- Monitor database performance
- Set up alerts
Scaling
- Use load balancers
- Scale API instances horizontally
- Use database read replicas
- Enable CDN caching
- Use Redis for session storage
Health Checks
API Health
curl https://api.norchain.org/api/v1/healthApp Health
curl https://explorer.norchain.org/api/healthRollback Procedure
- Identify issue
- Revert code changes
- Rebuild and redeploy
- Verify functionality
- Monitor for issues
Backup Strategy
Database
- Daily automated backups
- Point-in-time recovery
- Off-site backups
Configuration
- Version control for configs
- Encrypted secrets storage
- Regular config backups
Support
For deployment issues:
- Check logs
- Review monitoring
- Contact DevOps team