self hosted index - nself-org/nchat GitHub Wiki
Quick reference index for all self-hosted deployment documentation and resources.
| Document | Description | Audience |
|---|---|---|
| Self-Hosted Guide | Complete deployment guide with step-by-step instructions | Everyone |
| Quick Reference | Quick commands and common tasks | Administrators |
| Troubleshooting | Problem-solving guide | Support teams |
-
One-Line Installation (Recommended)
curl -fsSL https://raw.githubusercontent.com/yourusername/nself-chat/main/scripts/self-hosted-install.sh | bash -
Manual Installation
-
Custom Deployment
| Script | Location | Purpose |
|---|---|---|
self-hosted-install.sh |
/scripts/ |
One-line installer |
update-nchat.sh |
/scripts/ |
Update automation |
Created during installation in /usr/local/bin/:
| Script | Purpose | Usage |
|---|---|---|
backup-nchat |
Create backup | sudo backup-nchat |
update-nchat |
Update to latest | sudo update-nchat |
diagnose-nchat |
Run diagnostics | sudo diagnose-nchat |
| File | Purpose | Usage |
|---|---|---|
docker-compose.production.yml |
Production stack | Default |
docker-compose.monitoring.yml |
Monitoring stack | Optional add-on |
Nginx (Reverse Proxy + SSL):
-
/deploy/nginx/nginx.conf- Main configuration -
/deploy/nginx/conf.d/nchat.conf- Virtual host
PostgreSQL (Database):
-
/deploy/postgres/postgresql.conf- Performance tuning -
/deploy/postgres/init-scripts/01-init.sql- Initialization
Monitoring:
-
/deploy/monitoring/prometheus/prometheus.yml- Metrics -
/deploy/monitoring/grafana/- Dashboards and provisioning
| File | Purpose | Location |
|---|---|---|
.env.production.example |
Configuration template | Project root |
.env.production |
Active configuration |
/opt/nself-chat/ (installed) |
Minimum required settings:
DOMAIN=chat.example.com
[email protected]
POSTGRES_PASSWORD=strong_password
HASURA_ADMIN_SECRET=strong_secret
SMTP_HOST=smtp.example.com
SMTP_USER=your_smtp_user
SMTP_PASS=your_smtp_password- OAuth providers (Google, GitHub, LinkedIn)
- Storage backends (AWS S3, Cloudflare R2)
- Monitoring and analytics
- Feature flags
- Performance tuning
When monitoring is enabled:
| Service | URL | Default Credentials |
|---|---|---|
| Grafana | https://chat.example.com/grafana | admin/admin |
| Prometheus | https://chat.example.com/prometheus | N/A |
-
System Metrics
- CPU usage
- Memory usage
- Disk I/O
- Network traffic
-
Application Metrics
- Request rate
- Response times
- Error rates
- Active users
-
Database Metrics
- Connection pool
- Query performance
- Cache hit rates
- Table sizes
-
Container Metrics
- Resource usage
- Health status
- Restart counts
- Strong passwords configured
- SSL certificate valid
- Firewall enabled (ports 22, 80, 443)
- Fail2ban installed (optional)
- 2FA enabled for admin accounts
- Regular updates scheduled
- Backups configured and tested
- Access logs monitored
| File | Purpose |
|---|---|
/etc/letsencrypt/live/DOMAIN/ |
SSL certificates |
/etc/fail2ban/jail.d/ |
Fail2ban configuration |
/var/log/nginx/ |
Access and error logs |
| Type | Location | Retention |
|---|---|---|
| Automatic backups | /var/backups/nself-chat/ |
30 days |
| Database dumps | Included in backup archive | 30 days |
| Uploaded files | Included in backup archive | 30 days |
| Configuration | Included in backup archive | 30 days |
# Create backup
sudo /usr/local/bin/backup-nchat
# List backups
ls -lh /var/backups/nself-chat/
# Test backup integrity
tar tzf /var/backups/nself-chat/nchat-backup-LATEST.tar.gz- Automatic backup created before update
- Pre-flight checks verify system readiness
- Code pulled from repository
- Images rebuilt with latest dependencies
- Migrations run for database schema
- Services restarted with new version
- Verification ensures update succeeded
- Automatic rollback on failure
# Update to latest version
sudo /usr/local/bin/update-nchat
# Update to specific version
sudo /usr/local/bin/update-nchat v1.0.1
# Check current version
cd /opt/nself-chat && git describe --tags# Run full diagnostic
sudo /usr/local/bin/diagnose-nchat
# Check service status
cd /opt/nself-chat
docker compose -f docker-compose.production.yml ps
# View recent errors
docker compose -f docker-compose.production.yml logs --tail=100 | grep -i error
# Test application health
curl -I https://chat.example.com/api/healthQuick links to solutions:
- Services Won't Start
- 502 Bad Gateway
- SSL Problems
- Database Errors
- Disk Space
- High Memory
- Slow Performance
- Email Issues
# Edit PostgreSQL config
nano /opt/nself-chat/deploy/postgres/postgresql.conf
# Key settings for 8GB RAM:
shared_buffers = 2GB
effective_cache_size = 6GB# Increase Node.js memory
echo "NODE_OPTIONS=--max-old-space-size=4096" >> .env.production
# Restart application
docker compose -f docker-compose.production.yml restart nchat# Configure Redis
docker compose -f docker-compose.production.yml exec redis \
redis-cli CONFIG SET maxmemory 1gb| Users | Server | Storage | Total/Month | Savings vs Slack |
|---|---|---|---|---|
| 1-25 | $24 | $0 | $24 | $176/month |
| 25-100 | $48 | $5 | $53 | $347/month |
| 100-500 | $96 | $20 | $116 | $3,884/month |
Best Value:
- Hetzner: €8.46/month for 4GB VPS
- DigitalOcean: $24/month for 4GB droplet
- Vultr: $24/month for 4GB instance
Best Performance:
- AWS EC2: t3.medium with reserved instance
- Google Cloud: e2-medium with committed use
- Azure: B2s with reserved instance
# 1. One-line install
curl -fsSL https://raw.githubusercontent.com/yourusername/nself-chat/main/scripts/self-hosted-install.sh | bash
# 2. Follow prompts:
# - Domain name
# - Email for SSL
# - Admin email
# - Company name
# - Enable monitoring (optional)
# 3. Complete setup
open https://chat.example.com/setup# Check status
docker compose -f /opt/nself-chat/docker-compose.production.yml ps
# View logs
docker compose -f /opt/nself-chat/docker-compose.production.yml logs -f
# Restart
docker compose -f /opt/nself-chat/docker-compose.production.yml restart# Backup (runs daily automatically)
sudo /usr/local/bin/backup-nchat
# Update (when new version available)
sudo /usr/local/bin/update-nchat
# Diagnostics (when issues occur)
sudo /usr/local/bin/diagnose-nchat- Main Guide: self-hosted.md
- Troubleshooting: self-hosted-troubleshooting.md
- Production Guide: production-deployment.md
- Quick Reference: ../../../deploy/self-hosted/README.md
- GitHub Issues: https://github.com/yourusername/nself-chat/issues
- Discord Community: https://discord.gg/nself
- Forum: https://community.nself.chat
- Documentation: https://docs.nself.chat
- Email: [email protected]
- Enterprise Support: Available for commercial deployments
- Consulting: Deployment and migration services
- Server provisioned (2+ CPU, 4+ GB RAM, 20+ GB disk)
- Domain registered and DNS configured
- Port 80 and 443 accessible
- SMTP credentials obtained (SendGrid, Mailgun, etc.)
- Backup solution planned
- Installer script run successfully
- All services started and healthy
- SSL certificate obtained
- Firewall configured
- Backups scheduled
- Setup wizard completed
- SMTP configured and tested
- First backup created and verified
- Admin account secured with strong password
- 2FA enabled for admin accounts
- Documentation reviewed
- Team members invited
- Regular backups verified (weekly)
- System updates applied (monthly)
- Application updates applied (as released)
- Logs reviewed (monthly)
- Performance monitored (if enabled)
- Disk space monitored (weekly)
- Docker Documentation: https://docs.docker.com/
- Let's Encrypt: https://letsencrypt.org/
- PostgreSQL: https://www.postgresql.org/docs/
- Nginx: https://nginx.org/en/docs/
Initial release with:
- One-line installation script
- Production Docker Compose configuration
- Automatic SSL/TLS via Let's Encrypt
- Comprehensive monitoring stack
- Automated backups
- Update management
- Complete documentation
Last Updated: January 31, 2026 Version: 1.0.0 Maintained by: nself-chat Team