1
Prerequisites
Server Requirements
- RamNode VPS with minimum 4GB RAM (8GB recommended for production)
- 2+ vCPU cores
- 40GB+ SSD storage
- Ubuntu 22.04 LTS or Debian 12
- Root or sudo access
Domain and DNS
- A registered domain name (e.g., chat.yourdomain.com)
- DNS A record pointing to your VPS IP address
Email Service (Optional but Recommended)
SMTP credentials for sending transactional emails. Supported providers: Amazon SES, SendGrid, Mailgun, or any SMTP server.
2
Initial Server Setup
Connect and update system
ssh root@your-vps-ip
apt update && apt upgrade -yInstall dependencies
apt install -y curl wget git apt-transport-https ca-certificates gnupg lsb-releaseConfigure firewall
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable3
Install Docker and Docker Compose
Add Docker GPG key and repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) \
signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/nullInstall Docker
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Verify installation
docker --version
docker compose version
# Enable on boot
systemctl enable docker
systemctl start docker4
Install Chatwoot
Download Chatwoot configuration
mkdir -p /opt/chatwoot
cd /opt/chatwoot
wget -O .env https://raw.githubusercontent.com/chatwoot/chatwoot/develop/.env.example
wget -O docker-compose.yaml https://raw.githubusercontent.com/chatwoot/chatwoot/develop/docker-compose.production.yamlGenerate secret keys
# Generate SECRET_KEY_BASE
openssl rand -hex 64
# Generate RAILS_MASTER_KEY (if needed)
openssl rand -hex 32Configure Environment Variables
Edit /opt/chatwoot/.env
# Application Settings
SECRET_KEY_BASE=your_generated_secret_key_base
FRONTEND_URL=https://chat.yourdomain.com
RAILS_ENV=production
# Database Configuration
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=your_secure_database_password
POSTGRES_DATABASE=chatwoot_production
# Redis Configuration
REDIS_URL=redis://redis:6379
# Email Configuration (SMTP)
MAILER_SENDER_EMAIL=noreply@yourdomain.com
SMTP_ADDRESS=smtp.yourmailprovider.com
SMTP_PORT=587
SMTP_USERNAME=your_smtp_username
SMTP_PASSWORD=your_smtp_password
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=true
# Storage
ACTIVE_STORAGE_SERVICE=local
# Optional
ENABLE_ACCOUNT_SIGNUP=false5
Initialize Database
Start database services
cd /opt/chatwoot
docker compose up -d postgres redis
# Wait 30 seconds for services to initializeRun database migrations
docker compose run --rm rails bundle exec rails db:chatwoot_prepareLaunch Chatwoot
docker compose up -d
# Verify running containers
docker compose psYou should see the following containers running: rails, sidekiq, postgres, and redis.
6
Configure Nginx Reverse Proxy
Install Nginx
apt install -y nginxCreate Nginx configuration
# /etc/nginx/sites-available/chatwoot
server {
listen 80;
server_name chat.yourdomain.com;
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl http2;
server_name chat.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/chat.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/chat.yourdomain.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
client_max_body_size 50M;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
location /cable {
proxy_pass http://127.0.0.1:3000/cable;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
}Enable site and obtain SSL
ln -s /etc/nginx/sites-available/chatwoot /etc/nginx/sites-enabled/
nginx -t
# Install Certbot
apt install -y certbot python3-certbot-nginx
# Obtain SSL certificate
certbot --nginx -d chat.yourdomain.com
systemctl reload nginx7
Create Admin Account
Access your Chatwoot installation through your browser at https://chat.yourdomain.com and complete the initial setup wizard.
Alternative: Create via Command Line
Create admin account
docker compose exec rails bundle exec rails console
# In the Rails console:
SuperAdmin.create!(email: 'admin@yourdomain.com', password: 'YourSecurePassword123!')8
Maintenance and Operations
Chatwoot Deployed Successfully!
Your self-hosted customer engagement platform is now running. Configure your inboxes, integrate with your website, and start providing excellent customer support.
