add intro documentation and user guide

This commit is contained in:
Tanmay Deep Sharma
2025-05-29 19:29:32 +05:30
parent f429db89b4
commit 7808634432
203 changed files with 8020 additions and 7794 deletions
@@ -0,0 +1,170 @@
---
title: AWS Marketplace AMI Deployment
description: Deploy Chatwoot on AWS using the marketplace AMI listing
sidebarTitle: AWS Marketplace
---
# AWS Chatwoot Deployment Guide
The following is the guide for deploying Chatwoot on AWS using the marketplace listing. Use our helm charts with AWS Elastic Kubernetes Service(EKS) for a cloud-native deployment.
## Prerequisites
- AWS account
## Install Chatwoot via AWS Marketplace AMI
### Step 1: Subscribe to Chatwoot
1. Go to [Chatwoot AWS marketplace listing](https://aws.amazon.com/marketplace/pp/prodview-tolblk4kmdqd4) and click on **Subscribe**.
![Subscribe to Chatwoot](/self-hosted/images/aws-ami/awsmp-01-subscribe.png)
### Step 2: Sign In
2. Sign in with your AWS account.
![AWS Sign In](/self-hosted/images/aws-ami/awsmp-02-signin.png)
### Step 3: Continue to Configuration
3. Click on **Continue to Configuration**.
![Continue to Configuration](/self-hosted/images/aws-ami/awsmp-03-continue.png)
### Step 4: Configure Software
4. Select the latest version in **Software Version** and pick your AWS **region**. Click **Continue to Launch**.
![Configure Software](/self-hosted/images/aws-ami/awsmp-04-configure.png)
### Step 5: Launch Configuration
5. Review the launch configuration. Leave the **Choose Action** field with the default value **Launch from Website**. Choose a VPC and subnet as per your AWS region preference.
![Launch Configuration](/self-hosted/images/aws-ami/awsmp-05-launch.png)
### Step 6: Create Security Group
6. Scroll down to the **Security Group** section and click **Create New Based On Seller Settings**.
![Create Security Group](/self-hosted/images/aws-ami/awsmp-06-sg.png)
### Step 7: Save Security Group
7. Save the new security group and choose it after creation.
![Save Security Group](/self-hosted/images/aws-ami/awsmp-07-sg.png)
### Step 8: Configure Key Pair
8. Pick a key pair you already have or create a new one in the region you are deploying. Click **Launch**.
![Configure Key Pair](/self-hosted/images/aws-ami/awsmp-08-keypair.png)
### Step 9: Launch Confirmation
9. AWS should now display a congratulations screen confirming that Chatwoot instance is launched successfully. Click on the **EC2 Console** link.
![Launch Confirmation](/self-hosted/images/aws-ami/awsmp-09-launch.png)
### Step 10: Wait for Instance
10. Wait for a few minutes to let the instance come up.
![Wait for Instance](/self-hosted/images/aws-ami/awsmp-10-ec2.png)
### Step 11: Get Public IP
11. Select the instance and copy the public IP.
![Get Public IP](/self-hosted/images/aws-ami/awsmp-11-public-ip.png)
### Step 12: Access Chatwoot
12. Visit `http://<your-public-ip>:3000`. This should bring up the Chatwoot UI. Congratulations. Woot! Woot!!
![Access Chatwoot](/self-hosted/images/aws-ami/awsmp-12-chatwoot.png)
## Configuring Chatwoot
To configure Chatwoot, we need to SSH into the instance. We will use **AWS Console Connect** for this.
### Step 1: Connect to Instance
1. Select the instance and click on **Connect**.
![Connect to Instance](/self-hosted/images/aws-ami/awsmp-13-connect.png)
### Step 2: Use Ubuntu User
2. Change the username from `root` to `ubuntu` and click **Connect**.
![Use Ubuntu User](/self-hosted/images/aws-ami/awsmp-14-connect.png)
### Step 3: Configure Environment Variables
3. Switch to the `chatwoot` user and configure the necessary environment variables. Refer to [Environment variables](/self-hosted/configuration/environment-variables) document for the complete list.
```bash
sudo -i -u chatwoot
cd chatwoot
vi .env
```
<Note>
It is recommended to configure a proxy server like Nginx and set up SSL. Make sure to modify the security group created in step 6 accordingly.
</Note>
## Updating the Instance
Please follow the Chatwoot update process in the standard [Linux VM setup](/self-hosted/deployment/linux-vm).
## Security Recommendations
### SSL Configuration
- Set up SSL certificates using Let's Encrypt or AWS Certificate Manager
- Configure Nginx as a reverse proxy
- Update security group rules to allow HTTPS traffic (port 443)
### Access Control
- Restrict SSH access to specific IP addresses
- Use IAM roles for EC2 instances where possible
- Enable AWS CloudTrail for audit logging
### Backup Strategy
- Set up automated EBS snapshots
- Configure database backups
- Store backups in S3 with appropriate lifecycle policies
## Troubleshooting
### Common Issues
<Accordion title="Instance not accessible">
**Problem**: Cannot access Chatwoot on port 3000
**Solutions**:
- Check security group allows inbound traffic on port 3000
- Verify instance is running and healthy
- Check if Chatwoot service is running: `sudo systemctl status chatwoot`
</Accordion>
<Accordion title="Application not starting">
**Problem**: Chatwoot service fails to start
**Solutions**:
- Check logs: `sudo journalctl -u chatwoot -f`
- Verify environment variables are correctly set
- Ensure database connection is working
- Check disk space and memory usage
</Accordion>
### Support Resources
- [AWS Support](https://aws.amazon.com/support/)
- [Chatwoot Community Discord](https://discord.com/invite/cJXdrwS)
- [GitHub Issues](https://github.com/chatwoot/chatwoot/issues)
---
The AWS Marketplace AMI provides a quick way to deploy Chatwoot with pre-configured settings. For production use, ensure you implement proper security measures and backup strategies.
+190 -414
View File
@@ -1,501 +1,277 @@
---
title: AWS Deployment
description: Deploy Chatwoot on Amazon Web Services with manual installation or marketplace AMI
sidebarTitle: AWS
title: AWS Chatwoot deployment guide
description: Deploy Chatwoot on AWS with a reference HA architecture
sidebarTitle: Manual Install
---
# AWS Deployment Guide
The following is a reference HA architecture guide for deploying Chatwoot on AWS. For a cloud-native deployment, use our [helm charts](https://github.com/chatwoot/charts) with AWS Elastic Kubernetes Service(EKS).
Deploy Chatwoot on Amazon Web Services (AWS) using either manual installation or the AWS Marketplace AMI for a scalable, production-ready setup.
## Introduction
## Deployment Options
<CardGroup cols={2}>
<Card title="Manual Installation" icon="code" href="#manual-installation">
Full control over the deployment with custom architecture
</Card>
<Card title="AWS Marketplace AMI" icon="aws" href="#aws-marketplace-ami">
Quick deployment using pre-configured AMI
</Card>
</CardGroup>
## Manual Installation
### Architecture Overview
This guide follows a standard 3-tier architecture on AWS for high availability:
```
Internet Gateway
|
Application Load Balancer (Public Subnets)
|
Chatwoot Instances (Private Subnets)
|
RDS PostgreSQL + ElastiCache Redis (Private Subnets)
```
We will use the Linux installation script to get a chatwoot instance running. Also instead of
relying on Redis, Postgres and Nginx installed in the same ec2; we will proceed to make use
of managed AWS services for the same viz Elasticache, RDS, and ALB.
### Prerequisites
- AWS account with appropriate permissions
- Domain name for your Chatwoot installation
- Basic knowledge of AWS services (VPC, EC2, RDS, etc.)
1. AWS account
2. Domain to use with Chatwoot
### Step 1: Network Setup
### Architecture
#### Create VPC
This guide will follow a standard 3-tier architecture on AWS.
1. Navigate to the VPC console in your chosen AWS region
2. Create a new VPC:
- **Name**: `chatwoot-vpc`
- **CIDR block**: `10.0.0.0/16`
- Leave other options as default
![aws-architecture](/self-hosted/images/aws-01-architecture.png)
#### Create Subnets
## Network
Create subnets across two availability zones:
### Create VPC
| Name | Type | AZ | CIDR Block |
|------|------|----|-----------|
| chatwoot-public-1 | Public | us-east-1a | 10.0.0.0/24 |
| chatwoot-public-2 | Public | us-east-1b | 10.0.1.0/24 |
| chatwoot-private-1 | Private | us-east-1a | 10.0.2.0/24 |
| chatwoot-private-2 | Private | us-east-1b | 10.0.3.0/24 |
1. Sign in to the AWS console and pick the region you will deploy.
2. Navigate to the VPC console and create a new vpc for chatwoot. At the `name` tag, enter
`chatwoot-vpc` and use the CIDR block `10.0.0.0/16`.
3. Leave the rest of the options as default and click on `Create VPC`.
<Note>
Enable "Auto-assign public IPv4 address" for public subnets under Actions > Subnet Settings.
</Note>
![aws-create-vpc](/self-hosted/images/aws-02-create-vpc.png)
#### Internet Gateway
### Subnets
Create two public and private subnets in the vpc we created. Make sure to have them in different AZ's and have non-overlapping CIDR ranges.
1. Create Internet Gateway named `chatwoot-igw`
2. Attach it to `chatwoot-vpc`
1. Navigate to VPC > Subnets.
2. Click on `Create Subnet`. Select the `chatwoot-vpc` we created before, name it as `chatwoot-public-1`, select an availability zone (for example, ap-south-1a), and the CIDR block as
`10.0.0.0/24`.
#### NAT Gateways
![aws-create-subnet](/self-hosted/images/aws-03-create-subnet.png)
Create NAT gateways in each public subnet:
3. Follow the same to create the remaining subnets.
1. **chatwoot-nat-1** in `chatwoot-public-1`
2. **chatwoot-nat-2** in `chatwoot-public-2`
| Name | Type | Availability Zone | CIDR Block |
| ------------------- | -------- | ------------------ | ------------- |
| `chatwoot-public-1` | public | `ap-south-1a` | `10.0.0.0/24` |
| `chatwoot-public-2` | public | `ap-south-1b` | `10.0.1.0/24` |
| `chatwoot-private-1` | private | `ap-south-1a` | `10.0.2.0/24` |
| `chatwoot-private-2` | private | `ap-south-1b` | `10.0.3.0/24` |
Allocate Elastic IPs for each NAT gateway.
4. After creating all subnets, enable `auto assign public ipv4 address` for public subnets under `Actions` > `Subnet Settings`.
#### Route Tables
### Internet Gateway
**Public Route Table** (`chatwoot-public-rt`):
- Route: `0.0.0.0/0` → `chatwoot-igw`
- Associate with public subnets
1. Select `Create Internet Gateway` , name it `chatwoot-igw`, and click create.
2. Select it from the internet gateways list, choose actions and then select `Attach to VPC`.
3. Choose `chatwoot-vpc` and click attach.
**Private Route Tables**:
- `chatwoot-private-a`: Route `0.0.0.0/0` → `chatwoot-nat-1`
- `chatwoot-private-b`: Route `0.0.0.0/0` → `chatwoot-nat-2`
![aws-create-igw](/self-hosted/images/aws-04-create-igw.png)
### Step 2: Application Load Balancer
### NAT Gateway
1. Navigate to EC2 > Load Balancers
2. Create Application Load Balancer:
- **Name**: `chatwoot-loadbalancer`
- **Scheme**: Internet-facing
- **IP address type**: IPv4
- **VPC**: `chatwoot-vpc`
- **Subnets**: Select both public subnets
Chatwoot app servers need to be deployed in the private subnet. For them to access the internet, we need to add NAT gateways to our public subnet and add a route from the private subnets.
#### Security Group for ALB
1. Navigate the VPC dashboard and select `NAT gateways`.
2. Click `Create NAT Gateway`.
Create `chatwoot-loadbalancer-sg` with rules:
- HTTP (80) from `0.0.0.0/0`
- HTTPS (443) from `0.0.0.0/0`
- TCP (3000) from `0.0.0.0/0` (for health checks)
1. Name it `chatwoot-nat-1`.
2. Select the `chatwoot-public-1` subnet.
3. Click on `Allocate Elastic IP`.
4. Add additional tags as per your need.
5. Click `Create NAT gateway`.
#### Target Group
![aws-create-nat](/self-hosted/images/aws-05-create-nat.png)
Create `chatwoot-tg` target group:
- **Target type**: Instances
- **Protocol**: HTTP
- **Port**: 3000
- **Health check path**: `/api`
3. Follow the same to create a second NAT gateway (`chatwoot-nat-2`) and choose the `chatwoot-public-2` subnet.
### Step 3: Database Setup (RDS)
### Route tables
#### RDS Security Group
The route table controls the inbound and outbound access for a subnet.
Create `chatwoot-rds-sg`:
- PostgreSQL (5432) from `chatwoot-loadbalancer-sg`
#### Public Route table
#### RDS Subnet Group
We will create route tables so that our public subnets can reach the internet via the Internet gateway.
Create `chatwoot-rds-group`:
- **VPC**: `chatwoot-vpc`
- **Subnets**: Both private subnets
Navigate to the VPC dashboard and select `Route Tables`.
1. Click `Create route table`.
2. Use the name `chatwoot-public-rt` and choose `chatwoot-vpc` under VPC.
3. Click `Create`.
#### Create RDS Instance
![aws-create-rt](/self-hosted/images/aws-06-create-rt.png)
1. Navigate to RDS > Databases
2. Create database:
- **Engine**: PostgreSQL
- **Template**: Production
- **DB instance identifier**: `chatwoot-db`
- **Master username**: `chatwoot`
- **Master password**: Generate secure password
- **DB instance class**: `db.t3.medium` (minimum)
- **Storage**: 100 GB GP2 (minimum)
- **Multi-AZ**: Yes
- **VPC**: `chatwoot-vpc`
- **Subnet group**: `chatwoot-rds-group`
- **Security group**: `chatwoot-rds-sg`
Next, we need to add a route to the internet gateway we created earlier(`chatwoot-igw`).
<Warning>
Note down the RDS endpoint, username, and password for later configuration.
</Warning>
1. Select the `chatwoot-public-rt` route table from the list and click on `Edit routes` > `Add Route`.
2. Set the destination as `0.0.0.0/0` and choose the target as `chatwoot-igw`. Click on `Save Changes`.
### Step 4: Redis Setup (ElastiCache)
Also,
#### ElastiCache Security Group
1. Select the `chatwoot-public-rt` route table from the list and click on `Subnet Associations` > `Edit subnet associations`.
2. Select both the public subnets(`chatwoot-public-1`,`chatwoot-public-2`) and click `save`.
Create `chatwoot-redis-sg`:
- Redis (6379) from `chatwoot-loadbalancer-sg`
#### Private Route table
#### ElastiCache Subnet Group
We will also create private route tables so that our private subnets can reach the internet via the NAT gateways.
Create `chatwoot-redis-group`:
- **VPC**: `chatwoot-vpc`
- **Subnets**: Both private subnets
1. Follow the above guide and create two private route tables, namely, `chatwoot-private-a` and `chatwoot-private-b`.
2. Select the route tables and add a route to the NAT gateway in their respective availability zone.
1. For `chatwoot-private-a`, add a route to `0.0.0.0/0` and target as `chatwoot-nat-1`.
2. For `chatwoot-private-b`, add a route to `0.0.0.0/0` and target as `chatwoot-nat-2`.
#### Create Redis Cluster
Also,
1. Navigate to ElastiCache > Redis clusters
2. Create cluster:
- **Name**: `chatwoot-redis`
- **Engine version**: 7.0+
- **Node type**: `cache.t3.micro` (minimum)
- **Multi-AZ**: Yes
- **Subnet group**: `chatwoot-redis-group`
- **Security group**: `chatwoot-redis-sg`
1. Associate the private route tables with corresponding private subnets.
1. For `chatwoot-private-a`, associate `chatwoot-private-1` subnet.
2. For `chatwoot-private-b`, associate `chatwoot-private-2` subnet.
### Step 5: Bastion Host
## Application Load Balancer (ALB)
Create bastion servers for secure access to private instances:
Create an application load balancer to receive traffic on port 80 and 443 and distribute it across Chatwoot instances.
1. Launch EC2 instance:
- **AMI**: Ubuntu 20.04 LTS
- **Instance type**: `t3.micro`
- **VPC**: `chatwoot-vpc`
- **Subnet**: `chatwoot-public-1`
- **Auto-assign public IP**: Yes
- **Security group**: Create `chatwoot-bastion-sg` (SSH from your IP)
1. Navigate to the EC2 section and choose the Load Balancer section.
2. Click `Create Load Balancer`.
1. Choose `Application Load Balancer`.
2. For the load balancer name, use `chatwoot-loadbalancer`.
3. Select the scheme as `internet-facing` and IP address type as `IPv4`.
4. For the network mapping section,
1. Select `chatwoot-vpc`.
2. Select the public subnets `chatwoot-public-1` and `chatwoot-public-2` under the mapping section.
5. For the Security group section,
1. Create a new security group, `chatwoot-loadbalancer-sg`.
2. Add rules to allow HTTP and HTTPS traffic from anywhere(`0.0.0.0/0`, `::/0`).
3. Also, add a rule to allow TCP on port 3000. This rule allows the load balancer health checks to pass since Chatwoot runs on port 3000.
4. Add a rule to allow SSH traffic from the bastion security group we will create at the latter stage of the guide. Revisit this section after completing the bastion step.
6. For the Listeners and routing section, create two listeners for 80 and 443. Set the forwarding rule on listener 80 to redirect `http` to `https`.
1. Also, create a target group, `chatwoot-tg`, that will forward the requests to port `3000`(Chatwoot listens on this port).
2. Add a health check to the endpoint `/api`. This endpoint is not authenticated and should return the application version.
```
{
"version": "1.22.1",
"timestamp": "2021-12-06 16:07:39"
}
```
7. Add any necessary tags and click create.
### Step 6: Chatwoot Application Servers
Also, add if you have your domain on Route53 and use ACM to generate a certificate to use with ALB.
#### Launch Chatwoot Instance
## Postgresql using AWS RDS
1. Launch EC2 instance:
- **AMI**: Ubuntu 20.04 LTS
- **Instance type**: `c5.xlarge` (minimum for production)
- **VPC**: `chatwoot-vpc`
- **Subnet**: `chatwoot-private-1`
- **Auto-assign public IP**: No
- **Storage**: 60 GB GP2
- **Security group**: `chatwoot-loadbalancer-sg`
Chatwoot uses Postgres as a DB layer, and we will use Amazon RDS with a multi-AZ option for reliability.
#### Install Chatwoot
### RDS security group
1. SSH to bastion host, then to Chatwoot instance
2. Switch to root user and download installation script:
1. Navigate to EC2 > Security groups and create a new sg.
2. Name it `chatwoot-rds-sg`.
3. Select the `chatwoot-vpc` and add an inbound rule for postgres port with source `chatwoot-loadbalancer-sg`.
### RDS subnet group
1. Navigate to the RDS section and select subnet groups.
2. Create `chatwoot-rds-group` and choose `chatwoot-vpc`.
3. Select both az's and the private subnets.
### RDS
1. Select create a database.
2. Use standard create and choose the Postgres engine.
3. Use the production template, and create a Postgres master username and password.
4. Enable Multi-AZ deployment.
5. Select `chatwoot-vpc` and select the rds security group we created earlier.
6. Enable password authentication.
7. Click create.
8. After completing the creation, note down the hostname, username, and password. We will need this to configure Chatwoot.
## Redis using AWS Elasticache
1. Follow similar steps like the rds to create Redis security and subnet groups.
2. Create the Redis cluster with a multi-AZ option.
## Creating Bastion servers
Create bastion servers in both public subnets. These servers will be used to ssh into Chatwoot servers in private subnets.
1. Navigate to the EC2 dashboard and click launch instance.
2. Use an `Ubuntu 20.04 image` with a `t3.micro` type.
3. Choose `chatwoot-vpc` and subnet `chatwoot-public-1`.
4. Name it `chatwoot-bastion-a`.
5. Add a new sg, `chatwoot-bastion-sg` and enable ssh access from anywhere.
6. Leave the rest as defaults and click launch.
7. Once the instance is up, try to SSH into the instance.
Repeat and create another bastion, `chatwoot-bastion-b` in the other AZ.
## Install Chatwoot
1. Navigate to the EC2 section, and click on launch instance.
2. Use an `Ubuntu 20.04 image` with a `c5.xlarge` instance type.
3. Choose the chatwoot-vpc and select the private subnet `chatwoot-private-1`.
4. Disable auto-assign public IP and increase the storage of root volume to 60 GB.
5. Add necessary tags. Set the `Name` tag to `chatwoot`.
6. Select the load balancer security group and click launch.
7. SSH into the bastion server and, from there, ssh to the chatwoot instance we created.
8. Switch to the `root` user.
9. Download the chatwoot Linux installation script.
```bash
sudo su -
wget https://get.chatwoot.app/linux/install.sh
chmod +x install.sh
chmod 755 install.sh
```
10. Run the script.
```bash
./install.sh --install
```
#### Configure Chatwoot
## Configure Chatwoot
1. Switch to chatwoot user and edit environment:
11. Once the installation is complete, switch to the chatwoot user and navigate to the chatwoot folder. Edit the .env file and replace the Postgres and Redis credentials with RDS and elasticache values.
```bash
sudo -i -u chatwoot
cd chatwoot
nano .env
vi .env
```
2. Update database and Redis configuration:
12. Run the db migration.
```bash
# Database
DATABASE_URL="postgresql://chatwoot:password@your-rds-endpoint:5432/chatwoot_production"
# Redis
REDIS_URL="redis://your-elasticache-endpoint:6379/0"
# Frontend URL
FRONTEND_URL="https://chatwoot.yourdomain.com"
# Force SSL
FORCE_SSL=true
# Email configuration (example with SES)
MAILER_SENDER_EMAIL="noreply@yourdomain.com"
SMTP_ADDRESS="email-smtp.us-east-1.amazonaws.com"
SMTP_PORT=587
SMTP_USERNAME="your-ses-username"
SMTP_PASSWORD="your-ses-password"
SMTP_AUTHENTICATION="plain"
SMTP_ENABLE_STARTTLS_AUTO=true
# Storage (S3)
ACTIVE_STORAGE_SERVICE="amazon"
S3_BUCKET_NAME="your-chatwoot-bucket"
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
AWS_REGION="us-east-1"
RAILS_ENV=production bundle exec rake db:prepare
```
3. Run database preparation:
13. Also modify the other necessary environment variable for your chatwoot setup. Refer to https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#configure-the-required-environment-variables
```bash
RAILS_ENV=production bundle exec rake db:chatwoot_prepare
```
4. Restart services:
14. Restart the `chatwoot` service.
```bash
sudo cwctl --restart
```
### Step 7: SSL Certificate (ACM)
## Verify login
1. Navigate to Certificate Manager
2. Request public certificate for your domain
3. Validate domain ownership
4. Attach certificate to ALB HTTPS listener
15. Add this instance to the target group attached to the alb.
16. Navigate to your chatwoot domain to see if everything is working.
### Step 8: Auto Scaling
## Create a custom AMI
#### Create AMI
1. If you are getting the onboarding page, complete the signup and verify the installation.
2. Voila !! Your chatwoot instance is up.
3. If everything looks good, proceed to create an ami from this instance and name it `chatwoot-base-ami`.
1. Stop the Chatwoot instance
2. Create AMI named `chatwoot-base-ami`
3. Terminate the original instance
## Auto Scaling Groups (ASG)
#### Launch Template
1. Create a launch configuration using the above base image.
2. Proceed to create an auto-scaling group from this launch config.
3. Set the minimum and desired capacity to 2 and the maximum to 4. Modify this as per your requirement.
4. Create a scaling policy based on CPU utilization.
5. At this point, we are good to terminate the instance we created earlier.
6. Check the load balancer or target group to verify if two new chatwoot instances have come up.
7. That's it.
Create launch template with:
- **AMI**: `chatwoot-base-ami`
- **Instance type**: `c5.xlarge`
- **Security group**: `chatwoot-loadbalancer-sg`
- **User data** (optional):
## Monitoring
```bash
#!/bin/bash
sudo cwctl --restart
```
1. Refer to https://www.chatwoot.com/docs/self-hosted/monitoring/apm-and-error-monitoring
#### Auto Scaling Group
## Updating Chatwoot
Create ASG with:
- **Launch template**: Use created template
- **VPC**: `chatwoot-vpc`
- **Subnets**: Both private subnets
- **Target group**: `chatwoot-tg`
- **Desired capacity**: 2
- **Minimum**: 2
- **Maximum**: 4
1. log in to one of the application servers and complete the update instructions. Run migrations if needed. Refer to https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#upgrading-to-a-newer-version-of-chatwoot
2. Create a new ami and update the launch config.
#### Scaling Policies
## Conclusion
Create scaling policies based on:
- CPU utilization (scale out at 70%, scale in at 30%)
- Memory utilization
- Request count per target
## AWS Marketplace AMI
### Quick Deployment
1. Navigate to AWS Marketplace
2. Search for "Chatwoot"
3. Subscribe to Chatwoot AMI
4. Launch instance with recommended settings:
- **Instance type**: `t3.medium` or larger
- **Storage**: 20 GB minimum
- **Security group**: Allow HTTP, HTTPS, and SSH
### Post-Launch Configuration
1. SSH to the instance
2. Complete initial setup:
```bash
sudo /opt/chatwoot/setup.sh
```
3. Configure domain and SSL:
```bash
sudo /opt/chatwoot/configure-domain.sh yourdomain.com
```
## Production Optimizations
### Performance Tuning
```bash
# Optimize Rails configuration
export RAILS_MAX_THREADS=20
export WEB_CONCURRENCY=4
export SIDEKIQ_CONCURRENCY=25
# Database connection pooling
export DATABASE_POOL_SIZE=25
```
### Monitoring Setup
#### CloudWatch Metrics
Enable detailed monitoring for:
- EC2 instances
- RDS database
- ElastiCache cluster
- Application Load Balancer
#### Custom Metrics
```bash
# Install CloudWatch agent
wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
sudo rpm -U ./amazon-cloudwatch-agent.rpm
# Configure custom metrics
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
```
### Backup Strategy
#### RDS Automated Backups
- Enable automated backups with 7-day retention
- Configure backup window during low-traffic hours
- Enable point-in-time recovery
#### Application Data Backup
```bash
#!/bin/bash
# Backup script for application data
DATE=$(date +%Y%m%d_%H%M%S)
# Database backup
pg_dump $DATABASE_URL | gzip > "s3://your-backup-bucket/db/chatwoot_$DATE.sql.gz"
# File uploads backup (if using local storage)
aws s3 sync /home/chatwoot/chatwoot/storage s3://your-backup-bucket/storage/
```
### Security Hardening
#### IAM Roles
Create IAM roles with minimal permissions:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::your-chatwoot-bucket/*"
},
{
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "*"
}
]
}
```
#### Security Groups
Implement least-privilege access:
- ALB: Only HTTP/HTTPS from internet
- App servers: Only from ALB and bastion
- Database: Only from app servers
- Redis: Only from app servers
## Cost Optimization
### Reserved Instances
Purchase Reserved Instances for:
- RDS database instances
- ElastiCache clusters
- Predictable EC2 workloads
### Spot Instances
Use Spot Instances for:
- Development environments
- Non-critical worker processes
- Batch processing tasks
### Storage Optimization
- Use GP3 volumes for better price/performance
- Implement S3 lifecycle policies for old backups
- Use S3 Intelligent Tiering for file storage
## Troubleshooting
### Common Issues
<Accordion title="Application not accessible">
Check:
- Security group rules
- Target group health
- Route table configuration
- DNS resolution
</Accordion>
<Accordion title="Database connection errors">
Verify:
- RDS security group allows connections
- Database credentials in .env file
- Network connectivity from app servers
</Accordion>
<Accordion title="High memory usage">
Solutions:
- Increase instance size
- Optimize Sidekiq concurrency
- Enable swap memory
- Monitor for memory leaks
</Accordion>
### Monitoring Commands
```bash
# Check application health
curl -I http://localhost:3000/api
# Monitor system resources
htop
iostat -x 1
free -h
# Check service status
sudo systemctl status chatwoot.target
```
---
This AWS deployment guide provides a comprehensive approach to hosting Chatwoot on AWS infrastructure. Choose the deployment method that best fits your requirements and scale as needed.
This document is a reference guideline for an HA chatwoot architecture on AWS. Modify or build upon this to suit your requirements.
+28 -650
View File
@@ -1,663 +1,41 @@
---
title: Azure Deployment
description: Deploy Chatwoot on Microsoft Azure with various deployment options
title: Azure Chatwoot deployment guide
description: Deploy Chatwoot on a single VM in Azure
sidebarTitle: Azure
---
# Azure Deployment Guide
This guide will deploy chatwoot on a single VM in Azure. For a cloud native deployment, use our [helm charts](https://github.com/chatwoot/charts) with Azure Kubernetes Service(AKS).
Deploy Chatwoot on Microsoft Azure using various deployment options including Virtual Machines, Container Instances, or App Service for a scalable, production-ready setup.
<Note>
This guide is a work in progress and your mileage may vary.
</Note>
## Deployment Options
## Create a Virtual Machine
<CardGroup cols={3}>
<Card title="Virtual Machines" icon="server" href="#virtual-machines">
Full control with custom VM deployment
</Card>
<Card title="Container Instances" icon="docker" href="#container-instances">
Serverless container deployment
</Card>
<Card title="App Service" icon="cloud" href="#app-service">
Platform-as-a-Service deployment
</Card>
</CardGroup>
1. Login to the Azure portal and choose Virtual Machines.
2. Select create a VM from scratch.
3. In the Basics tab, create a subscription and a new resource group.
4. Name the virtual machine as `chatwoot` and select your preferred region.
5. Select `Ubuntu 20.04 LTS - Gen2` as the image.
6. For instance size, we recommend the type `Standard_D4s_v3`(4vCPU, 16GB RAM).
7. Under authentication, leave the defaults and create a new key pair if needed.
8. Allow HTTP, HTTPS and SSH under inbound port rules.
9. Click next and leave the defaults for Disks, Networking, Management, Advanced and Tags section.
10. Select `Review + create` to spin up the VM.
## Virtual Machines Deployment
![azure-create-vm](/self-hosted/images/azure.png)
### Architecture Overview
## Install Chatwoot
```
Azure Load Balancer
|
Virtual Machines (Availability Set)
|
Azure Database for PostgreSQL + Azure Cache for Redis
```
1. SSH into the instance created from your local machine or create a bastion in azure to ssh via the browser.
2. Follow the linux VM instructions at https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm.
3. Woot! Woot! Your Chatwoot Instance is ready and can be accessed at `http://<your-instance-ip>:3000`. Or if you completed the domain setup during the installation, chatwoot should be available at `https://<your-domain>`.
### Prerequisites
<Note>
Browser access via port 3000 will only work if enabled under inbound rules.
</Note>
- Azure subscription with appropriate permissions
- Azure CLI installed and configured
- Domain name for your Chatwoot installation
## Configure Chatwoot
### Step 1: Resource Group and Network
#### Create Resource Group
```bash
# Create resource group
az group create \
--name chatwoot-rg \
--location eastus
```
#### Create Virtual Network
```bash
# Create virtual network
az network vnet create \
--resource-group chatwoot-rg \
--name chatwoot-vnet \
--address-prefix 10.0.0.0/16 \
--subnet-name chatwoot-subnet \
--subnet-prefix 10.0.1.0/24
```
#### Create Network Security Group
```bash
# Create NSG
az network nsg create \
--resource-group chatwoot-rg \
--name chatwoot-nsg
# Add rules
az network nsg rule create \
--resource-group chatwoot-rg \
--nsg-name chatwoot-nsg \
--name AllowHTTP \
--protocol tcp \
--priority 1000 \
--destination-port-range 80
az network nsg rule create \
--resource-group chatwoot-rg \
--nsg-name chatwoot-nsg \
--name AllowHTTPS \
--protocol tcp \
--priority 1001 \
--destination-port-range 443
az network nsg rule create \
--resource-group chatwoot-rg \
--nsg-name chatwoot-nsg \
--name AllowSSH \
--protocol tcp \
--priority 1002 \
--destination-port-range 22 \
--source-address-prefix "YOUR_IP_ADDRESS"
```
### Step 2: Database Setup
#### Create PostgreSQL Server
```bash
# Create PostgreSQL server
az postgres server create \
--resource-group chatwoot-rg \
--name chatwoot-postgres \
--location eastus \
--admin-user chatwoot \
--admin-password "YourSecurePassword123!" \
--sku-name GP_Gen5_2 \
--version 13
# Create database
az postgres db create \
--resource-group chatwoot-rg \
--server-name chatwoot-postgres \
--name chatwoot_production
# Configure firewall
az postgres server firewall-rule create \
--resource-group chatwoot-rg \
--server chatwoot-postgres \
--name AllowAzureServices \
--start-ip-address 0.0.0.0 \
--end-ip-address 0.0.0.0
```
#### Create Redis Cache
```bash
# Create Redis cache
az redis create \
--resource-group chatwoot-rg \
--name chatwoot-redis \
--location eastus \
--sku Basic \
--vm-size c0
```
### Step 3: Storage Account
```bash
# Create storage account
az storage account create \
--resource-group chatwoot-rg \
--name chatwootstorage \
--location eastus \
--sku Standard_LRS
# Create container for file uploads
az storage container create \
--account-name chatwootstorage \
--name uploads \
--public-access blob
```
### Step 4: Virtual Machine
#### Create Availability Set
```bash
# Create availability set
az vm availability-set create \
--resource-group chatwoot-rg \
--name chatwoot-avset \
--platform-fault-domain-count 2 \
--platform-update-domain-count 2
```
#### Create Virtual Machine
```bash
# Create VM
az vm create \
--resource-group chatwoot-rg \
--name chatwoot-vm \
--image UbuntuLTS \
--size Standard_D2s_v3 \
--availability-set chatwoot-avset \
--vnet-name chatwoot-vnet \
--subnet chatwoot-subnet \
--nsg chatwoot-nsg \
--admin-username azureuser \
--generate-ssh-keys \
--custom-data cloud-init.txt
```
#### Cloud-Init Configuration
Create `cloud-init.txt`:
```yaml
#cloud-config
package_upgrade: true
packages:
- curl
- wget
- git
runcmd:
- wget https://get.chatwoot.app/linux/install.sh
- chmod +x install.sh
- ./install.sh --install
```
### Step 5: Load Balancer
```bash
# Create public IP
az network public-ip create \
--resource-group chatwoot-rg \
--name chatwoot-lb-ip \
--sku Standard
# Create load balancer
az network lb create \
--resource-group chatwoot-rg \
--name chatwoot-lb \
--public-ip-address chatwoot-lb-ip \
--frontend-ip-name chatwoot-frontend \
--backend-pool-name chatwoot-backend
# Create health probe
az network lb probe create \
--resource-group chatwoot-rg \
--lb-name chatwoot-lb \
--name chatwoot-health \
--protocol http \
--port 3000 \
--path /api
# Create load balancing rule
az network lb rule create \
--resource-group chatwoot-rg \
--lb-name chatwoot-lb \
--name chatwoot-rule \
--protocol tcp \
--frontend-port 80 \
--backend-port 3000 \
--frontend-ip-name chatwoot-frontend \
--backend-pool-name chatwoot-backend \
--probe-name chatwoot-health
```
### Step 6: Configuration
SSH to the VM and configure Chatwoot:
```bash
# SSH to VM
ssh azureuser@<VM_PUBLIC_IP>
# Switch to chatwoot user
sudo -i -u chatwoot
cd chatwoot
# Edit environment variables
nano .env
```
Update `.env` with Azure services:
```bash
# Database
DATABASE_URL="postgresql://chatwoot:YourSecurePassword123!@chatwoot-postgres.postgres.database.azure.com:5432/chatwoot_production"
# Redis
REDIS_URL="redis://:PRIMARY_ACCESS_KEY@chatwoot-redis.redis.cache.windows.net:6380/0?ssl=true"
# Storage (Azure Blob)
ACTIVE_STORAGE_SERVICE="azure"
AZURE_STORAGE_ACCOUNT_NAME="chatwootstorage"
AZURE_STORAGE_ACCESS_KEY="your-access-key"
AZURE_STORAGE_CONTAINER="uploads"
# Frontend URL
FRONTEND_URL="https://chatwoot.yourdomain.com"
FORCE_SSL=true
```
## Container Instances Deployment
### Docker Compose for Azure
Create `docker-compose.azure.yml`:
```yaml
version: '3.8'
services:
chatwoot-web:
image: chatwoot/chatwoot:latest
environment:
- RAILS_ENV=production
- DATABASE_URL=postgresql://chatwoot:password@postgres:5432/chatwoot_production
- REDIS_URL=redis://redis:6379/0
- FRONTEND_URL=https://chatwoot.yourdomain.com
- FORCE_SSL=true
ports:
- "3000:3000"
depends_on:
- postgres
- redis
chatwoot-worker:
image: chatwoot/chatwoot:latest
environment:
- RAILS_ENV=production
- DATABASE_URL=postgresql://chatwoot:password@postgres:5432/chatwoot_production
- REDIS_URL=redis://redis:6379/0
command: bundle exec sidekiq -C config/sidekiq.yml
depends_on:
- postgres
- redis
postgres:
image: postgres:13
environment:
- POSTGRES_DB=chatwoot_production
- POSTGRES_USER=chatwoot
- POSTGRES_PASSWORD=password
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
volumes:
- redis_data:/data
volumes:
postgres_data:
redis_data:
```
### Deploy with Azure Container Instances
```bash
# Create container group
az container create \
--resource-group chatwoot-rg \
--file docker-compose.azure.yml \
--dns-name-label chatwoot-app \
--ports 3000
```
## App Service Deployment
### Create App Service Plan
```bash
# Create App Service plan
az appservice plan create \
--resource-group chatwoot-rg \
--name chatwoot-plan \
--sku P1V2 \
--is-linux
# Create web app
az webapp create \
--resource-group chatwoot-rg \
--plan chatwoot-plan \
--name chatwoot-app \
--deployment-container-image-name chatwoot/chatwoot:latest
```
### Configure App Settings
```bash
# Set environment variables
az webapp config appsettings set \
--resource-group chatwoot-rg \
--name chatwoot-app \
--settings \
RAILS_ENV=production \
DATABASE_URL="postgresql://chatwoot:password@chatwoot-postgres.postgres.database.azure.com:5432/chatwoot_production" \
REDIS_URL="redis://:key@chatwoot-redis.redis.cache.windows.net:6380/0?ssl=true" \
FRONTEND_URL="https://chatwoot-app.azurewebsites.net" \
FORCE_SSL=true
```
## Monitoring and Logging
### Application Insights
```bash
# Create Application Insights
az monitor app-insights component create \
--resource-group chatwoot-rg \
--app chatwoot-insights \
--location eastus \
--kind web
# Get instrumentation key
az monitor app-insights component show \
--resource-group chatwoot-rg \
--app chatwoot-insights \
--query instrumentationKey
```
### Log Analytics Workspace
```bash
# Create Log Analytics workspace
az monitor log-analytics workspace create \
--resource-group chatwoot-rg \
--workspace-name chatwoot-logs \
--location eastus
```
## Security Configuration
### Key Vault for Secrets
```bash
# Create Key Vault
az keyvault create \
--resource-group chatwoot-rg \
--name chatwoot-vault \
--location eastus
# Store secrets
az keyvault secret set \
--vault-name chatwoot-vault \
--name database-password \
--value "YourSecurePassword123!"
az keyvault secret set \
--vault-name chatwoot-vault \
--name redis-key \
--value "your-redis-access-key"
```
### Managed Identity
```bash
# Enable managed identity for VM
az vm identity assign \
--resource-group chatwoot-rg \
--name chatwoot-vm
# Grant access to Key Vault
az keyvault set-policy \
--name chatwoot-vault \
--object-id <MANAGED_IDENTITY_PRINCIPAL_ID> \
--secret-permissions get list
```
## Backup and Disaster Recovery
### Database Backup
```bash
# Enable automated backup for PostgreSQL
az postgres server configuration set \
--resource-group chatwoot-rg \
--server-name chatwoot-postgres \
--name backup_retention_days \
--value 7
# Create manual backup
az postgres server backup create \
--resource-group chatwoot-rg \
--server-name chatwoot-postgres \
--backup-name manual-backup-$(date +%Y%m%d)
```
### VM Backup
```bash
# Create Recovery Services vault
az backup vault create \
--resource-group chatwoot-rg \
--name chatwoot-vault \
--location eastus
# Enable backup for VM
az backup protection enable-for-vm \
--resource-group chatwoot-rg \
--vault-name chatwoot-vault \
--vm chatwoot-vm \
--policy-name DefaultPolicy
```
## Scaling and Performance
### VM Scale Sets
```bash
# Create VM scale set
az vmss create \
--resource-group chatwoot-rg \
--name chatwoot-vmss \
--image UbuntuLTS \
--vm-sku Standard_D2s_v3 \
--instance-count 2 \
--vnet-name chatwoot-vnet \
--subnet chatwoot-subnet \
--lb chatwoot-lb \
--backend-pool-name chatwoot-backend \
--custom-data cloud-init.txt
# Configure autoscaling
az monitor autoscale create \
--resource-group chatwoot-rg \
--resource chatwoot-vmss \
--resource-type Microsoft.Compute/virtualMachineScaleSets \
--name chatwoot-autoscale \
--min-count 2 \
--max-count 5 \
--count 2
# Add scale-out rule
az monitor autoscale rule create \
--resource-group chatwoot-rg \
--autoscale-name chatwoot-autoscale \
--condition "Percentage CPU > 70 avg 5m" \
--scale out 1
# Add scale-in rule
az monitor autoscale rule create \
--resource-group chatwoot-rg \
--autoscale-name chatwoot-autoscale \
--condition "Percentage CPU < 30 avg 5m" \
--scale in 1
```
## SSL Certificate
### App Service Certificate
```bash
# Create App Service certificate
az webapp config ssl upload \
--resource-group chatwoot-rg \
--name chatwoot-app \
--certificate-file certificate.pfx \
--certificate-password "certificate-password"
# Bind certificate to domain
az webapp config ssl bind \
--resource-group chatwoot-rg \
--name chatwoot-app \
--certificate-thumbprint <THUMBPRINT> \
--ssl-type SNI
```
### Let's Encrypt with VM
```bash
# Install Certbot on VM
sudo apt update
sudo apt install certbot python3-certbot-nginx
# Obtain certificate
sudo certbot --nginx -d chatwoot.yourdomain.com
# Auto-renewal
sudo crontab -e
# Add: 0 12 * * * /usr/bin/certbot renew --quiet
```
## Cost Optimization
### Reserved Instances
```bash
# Purchase reserved capacity for VMs
az reservations reservation-order purchase \
--reservation-order-id <ORDER_ID> \
--sku Standard_D2s_v3 \
--location eastus \
--quantity 2 \
--term P1Y
```
### Azure Advisor
```bash
# Get cost recommendations
az advisor recommendation list \
--category Cost \
--resource-group chatwoot-rg
```
## Troubleshooting
### Common Issues
<Accordion title="Database connection timeout">
Check:
- PostgreSQL firewall rules
- Network security group rules
- Connection string format
- SSL requirements for Azure Database
</Accordion>
<Accordion title="Redis connection issues">
Verify:
- Redis access keys
- SSL configuration (required for Azure Cache)
- Network connectivity
- Port 6380 (SSL) vs 6379 (non-SSL)
</Accordion>
<Accordion title="Storage upload failures">
Solutions:
- Verify storage account access keys
- Check container permissions
- Ensure CORS settings if needed
- Validate Azure Storage configuration
</Accordion>
### Diagnostic Commands
```bash
# Check VM status
az vm get-instance-view \
--resource-group chatwoot-rg \
--name chatwoot-vm
# View application logs
az webapp log tail \
--resource-group chatwoot-rg \
--name chatwoot-app
# Check database connectivity
az postgres server show \
--resource-group chatwoot-rg \
--name chatwoot-postgres
```
## Best Practices
### Security
- Use Azure Key Vault for secrets management
- Enable managed identities for Azure resources
- Implement network security groups with least privilege
- Enable Azure Security Center recommendations
### Performance
- Use Azure CDN for static assets
- Implement Redis caching strategies
- Monitor with Application Insights
- Use proximity placement groups for low latency
### Cost Management
- Use Azure Cost Management for monitoring
- Implement auto-shutdown for development VMs
- Consider spot instances for non-critical workloads
- Use reserved instances for predictable workloads
### Backup and Recovery
- Enable automated backups for all data services
- Test backup restoration procedures regularly
- Implement geo-redundant storage for critical data
- Document disaster recovery procedures
---
This Azure deployment guide provides multiple options for hosting Chatwoot on Microsoft Azure. Choose the deployment method that best fits your requirements, budget, and operational preferences.
1. Follow the Chatwoot docs to configure your domain, email and other parameters you need.
https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#configure-the-required-environment-variables
@@ -0,0 +1,106 @@
---
title: Caprover Chatwoot Production deployment guide
description: Deploy Chatwoot using Caprover's one-click application management
sidebarTitle: Caprover
---
## Caprover Overview
Caprover is an extremely easy to use application server management tool. It is blazing fast and uses Docker under the hood. Chatwoot has been made available as a one-click app in Caprover, and the deployment process is straightforward.
<Note>
This is a community contributed installation setup. This will only have community support for any issues in future.
</Note>
## Setup Chatwoot Using Caprover
### 1. Install Caprover on your VM
Finish your Caprover installation by referring to [Getting started guide](https://caprover.com/docs/get-started.html).
### 2. Install Chatwoot
Chatwoot is available in the one-click apps option in Caprover. Search for Chatwoot in the list of one-click apps. Replace the default `version` with the latest `version` of chatwoot. Use appropriate values for the Postgres and Redis passwords and click install. It should only take a few minutes.
### 3. Finish the setup
Head over to the `web` service in the Caprover applications and enable `Websocket Support` in the HTTP settings to true. You could also enable `https` for the application.
![caprover-enable-websocket](/self-hosted/images/caprover-websocket.png)
### 4. Configure environment variables
Caprover will take care of Postgres and Redis installation, along with the app and worker servers. We would advise you to replace the Database/Redis services with managed/standalone servers once you start scaling.
Also, ensure to set the appropriate environment variables for email, Object Store service etc. using our [Environment variables guide](/docs/self-hosted/configuration/environment-variables)
<Note>
Chatwoot requires websocket support. Do enable it from `chatwoot-web` settings page in Caprover.
</Note>
## Upgrading Chatwoot installation
To update your chatwoot installation to the latest version in Caprover, run the following command in the deployment tab for web and worker in `method 5: deploy captain-definition`. Make sure to replace `[DESIRED VERSION HERE]` with the current latest stable version. Check [here](https://www.chatwoot.com/changelog/) and [here](https://hub.docker.com/r/chatwoot/chatwoot/tags) for possible version numbers first.
### web
```json
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM chatwoot/chatwoot:[DESIRED VERSION HERE]",
"RUN chmod +x docker/entrypoints/rails.sh",
"ENTRYPOINT [\"docker/entrypoints/rails.sh\"]",
"CMD bundle exec rake db:chatwoot_prepare; bundle exec rails s -b 0.0.0.0 -p 3000"
]
}
```
### worker
```json
{
"schemaVersion": 2,
"dockerfileLines": [
"FROM chatwoot/chatwoot:[DESIRED VERSION HERE]",
"RUN chmod +x docker/entrypoints/rails.sh",
"ENTRYPOINT [\"docker/entrypoints/rails.sh\"]",
"CMD bundle exec sidekiq -C config/sidekiq.yml"
]
}
```
## Accessing Rails Console
Login to the server where you have caprover installed and execute the following commands.
```bash
# access the shell inside the container
docker exec -it $(docker ps --filter name=srv-captain--chatwoot-web -q) /bin/sh
# start rails console
RAILS_ENV=production bundle exec rails c
```
## Common Errors
### API requests failing with "You need to sign in or sign up before continuing."
Nginx by default strip of headers with `_` . Head over to the Nginx configuration option in caprover under the Chatwoot web and add the following directive.
Access the Caprover `web dashboard` > `Apps` > `Apps Edit` > `Edit Default Nginx Configurations`. Refer https://caprover.com/docs/nginx-customization.html for more details.
```nginx
# Nginx strips out underscore in headers by default
# Chatwoot relies on underscore in headers for API
# Make sure that the config is set to on.
underscores_in_headers on;
```
### Issues related to storage persistance
Please setup a cloud storage like s3 or gcs bucket or any s3 api compatible service as the active storage service.
Caprover installation needs this for storage persistance. Refer the [storage guide](/docs/self-hosted/deployment/storage/supported-providers).
## Further references
- https://isotropic.co/how-to-install-chatwoot-to-a-digitalocean-droplet/
@@ -0,0 +1,75 @@
---
title: Deploy Chatwoot to Clever Cloud
description: Deploy Chatwoot on Clever Cloud PaaS platform
sidebarTitle: Clever Cloud
---
Clever Cloud is a PaaS platform where you can deploy your applications with ease. To setup Chatwoot on Clever Cloud, you can follow the steps described below.
<Note>
This is a community contributed installation setup. This will only have community support for any issues in future.
</Note>
## 1. Create CleverCloud application
- Login to Clever Cloud dashboard
- Click on create an application
- Select your deployment type (> 2GB recommended)
- Provide an app name and select the zone
## 2. Select addons
Chatwoot requires PostgreSQL and Redis to function properly. Select Postgres and Redis from CleverCloud addons.
- Copy connection URI from Postgres Addon and set `DATABASE_URL` environment variable
- Make sure you have set REDIS_URL
## 3. Setup Clever cloud origin
- Clone Chatwoot project from Github
```bash
git clone git@github.com:chatwoot/chatwoot.git
```
- Set Clever Cloud origin
```bash
git remote add clever git+ssh://git@<id>.clever-cloud.com/<app-name>.git
```
## 4. Setup build hooks
To install the dependencies, you have to setup builds hooks. Set the following in the environment variables of the application.
```bash
CC_POST_BUILD_HOOK="RAILS_ENV=production rails assets:precompile"
CC_PRE_BUILD_HOOK="pnpm install"
CC_PRE_RUN_HOOK="rake db:chatwoot_prepare"
```
## 5. Push the latest changes
Push the latest code from your local machine to Clever Cloud.
```bash
git push clever master
```
Voila! After the deployment, you would be able to access the application.
## Environment Variables
Make sure you have the following environment variables configured in the application.
```bash
CC_POST_BUILD_HOOK="RAILS_ENV=production rails assets:precompile"
CC_PRE_BUILD_HOOK="pnpm install"
CC_PRE_RUN_HOOK="rake db:chatwoot_prepare"
DATABASE_URL="<postgres-addon-url>"
FRONTEND_URL="<clever-cloud-app-url>"
PORT="8080"
RAILS_ENV="production"
REDIS_URL="<redis-addon-url>"
SECRET_KEY_BASE="<long-secret-key>"
```
@@ -0,0 +1,41 @@
---
title: Cloudron Chatwoot deployment guide
description: Deploy Chatwoot using Cloudron's 1-click app platform
sidebarTitle: Cloudron
---
## Cloudron Overview
[Cloudron](https://cloudron.io) is a platform that makes it easy to install, manage and secure web apps on your server. Chatwoot is now available as a 1-click app in the Cloudron app store and the installation is blazing fast.
<Note>
This is a community contributed installation setup. This will only have community support for any issues in future.
</Note>
## Setup Chatwoot using Cloudron
### 1. Install Cloudron on your server
Finish your Cloudron installation by following the instructions at [Get Cloudron](https://www.cloudron.io/get.html).
### 2. Install Chatwoot
Once Cloudron installation is complete, login to your cloudron web portal and click on the appstore icon. Search for `Chatwoot` and click install. That's it. Chatwoot should be up and running in a minute or two.
Direct link to the cloudron app store listing --> https://www.cloudron.io/store/com.chatwoot.cloudronapp.html
### 3. Finish the setup
Navigate to your chatwoot domain and complete the onboarding setup.
### 4. Configure environment variables
Cloudron will take care of Postgres and Redis installation, along with the app and worker processes. We would advise you to replace the Database/Redis services with managed/standalone servers once you start scaling.
Also, ensure to set the appropriate environment variables for email, Object Store service etc. using our [Environment variables guide](/docs/self-hosted/configuration/environment-variables).
Custom environment variables can be set in `/app/data/env` using the Cloudron File manager. Be sure to reboot the app after making any changes.
## Upgrading Chatwoot installation
Chatwoot follows a monthly release pattern with a new release every 15th of the month. Use the built in [Cloudron app updates](https://docs.cloudron.io/updates/) to stay on the latest version. Read about the changelog [here](https://www.chatwoot.com/changelog/).
+20 -659
View File
@@ -1,670 +1,31 @@
---
title: DigitalOcean Deployment
description: Deploy Chatwoot on DigitalOcean with Droplets, App Platform, or Kubernetes
title: DigitalOcean Chatwoot deployment guide
description: Deploy Chatwoot on a single droplet in DigitalOcean
sidebarTitle: DigitalOcean
---
# DigitalOcean Deployment Guide
This guide will deploy chatwoot on a single droplet in DigitalOcean. For a cloud native deployment, go with
our [1-click k8s app on DigitalOcean Marketplace](https://marketplace.digitalocean.com/apps/chatwoot).
Deploy Chatwoot on DigitalOcean using Droplets, App Platform, or DigitalOcean Kubernetes for a scalable, cost-effective solution.
## Create a Droplet (VM)
## Deployment Options
1. Login to DigitalOcean console and choose create droplet.
2. Choose `Ubuntu 20.04` image.
3. Create an instance with a minimum of 4vCPU and 8GB RAM.
4. Make sure to choose the datacenter region you want to deploy.
5. Under authentication, choose your SSH key or create a new one. This is important as you will need
this key to complete the next section.
6. Click create.
<CardGroup cols={3}>
<Card title="Droplets" icon="server" href="#droplets-deployment">
Traditional VPS deployment with full control
</Card>
<Card title="App Platform" icon="cloud" href="#app-platform">
Platform-as-a-Service deployment
</Card>
<Card title="Kubernetes" icon="kubernetes" href="#kubernetes-deployment">
Container orchestration with DOKS
</Card>
</CardGroup>
![do-create-droplet](/self-hosted/images/do.png)
## Droplets Deployment
## Install Chatwoot
### Quick Start with One-Click Install
1. SSH into the droplet created above.
2. Follow the linux VM instructions at https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm.
3. Woot! Woot! Your Chatwoot Instance is ready and can be accessed at `http://<your-droplet-ip>:3000`. Or if you completed the domain setup during the installation, chatwoot should be available at `https://<your-domain>`
DigitalOcean offers a one-click Chatwoot installation from the Marketplace:
## Configure Chatwoot
1. **Navigate to DigitalOcean Marketplace**
2. **Search for "Chatwoot"**
3. **Click "Create Chatwoot Droplet"**
4. **Configure your Droplet:**
- **Plan**: Basic ($12/month minimum recommended)
- **CPU options**: Regular Intel
- **Region**: Choose closest to your users
- **Authentication**: SSH keys (recommended)
- **Hostname**: chatwoot-production
5. **Access your installation:**
```bash
ssh root@your-droplet-ip
```
### Manual Installation
#### Create Droplet
```bash
# Using doctl CLI
doctl compute droplet create chatwoot-prod \
--image ubuntu-20-04-x64 \
--size s-2vcpu-4gb \
--region nyc3 \
--ssh-keys your-ssh-key-id \
--enable-monitoring \
--enable-ipv6
```
#### Install Chatwoot
```bash
# SSH to droplet
ssh root@your-droplet-ip
# Download and run installation script
wget https://get.chatwoot.app/linux/install.sh
chmod +x install.sh
./install.sh --install
```
### Database Setup
#### Managed PostgreSQL
```bash
# Create managed database cluster
doctl databases create chatwoot-db \
--engine postgres \
--version 13 \
--size db-s-1vcpu-1gb \
--region nyc3 \
--num-nodes 1
# Create database
doctl databases db create chatwoot-db-id chatwoot_production
# Create user
doctl databases user create chatwoot-db-id chatwoot
```
#### Managed Redis
```bash
# Create managed Redis cluster
doctl databases create chatwoot-redis \
--engine redis \
--version 6 \
--size db-s-1vcpu-1gb \
--region nyc3 \
--num-nodes 1
```
### Configuration
Update Chatwoot configuration to use managed services:
```bash
# Switch to chatwoot user
sudo -i -u chatwoot
cd chatwoot
# Edit environment file
nano .env
```
Add managed database configuration:
```bash
# Database (from DigitalOcean dashboard)
DATABASE_URL="postgresql://chatwoot:password@chatwoot-db-do-user-123456-0.b.db.ondigitalocean.com:25060/chatwoot_production?sslmode=require"
# Redis (from DigitalOcean dashboard)
REDIS_URL="rediss://default:password@chatwoot-redis-do-user-123456-0.b.db.ondigitalocean.com:25061"
# Frontend URL
FRONTEND_URL="https://chatwoot.yourdomain.com"
FORCE_SSL=true
# Storage (DigitalOcean Spaces)
ACTIVE_STORAGE_SERVICE="amazon"
S3_BUCKET_NAME="your-chatwoot-space"
AWS_ACCESS_KEY_ID="your-spaces-key"
AWS_SECRET_ACCESS_KEY="your-spaces-secret"
AWS_REGION="nyc3"
S3_ENDPOINT="https://nyc3.digitaloceanspaces.com"
```
### Load Balancer Setup
```bash
# Create load balancer
doctl compute load-balancer create \
--name chatwoot-lb \
--forwarding-rules entry_protocol:https,entry_port:443,target_protocol:http,target_port:3000,certificate_id:your-cert-id \
--forwarding-rules entry_protocol:http,entry_port:80,target_protocol:http,target_port:3000 \
--health-check protocol:http,port:3000,path:/api,check_interval_seconds:10,response_timeout_seconds:5,healthy_threshold:3,unhealthy_threshold:3 \
--region nyc3 \
--droplet-ids droplet-id-1,droplet-id-2
```
## App Platform Deployment
### App Spec Configuration
Create `app.yaml`:
```yaml
name: chatwoot-app
services:
- name: web
source_dir: /
github:
repo: your-username/chatwoot-fork
branch: main
run_command: bundle exec rails server -b 0.0.0.0 -p $PORT
environment_slug: ruby
instance_count: 1
instance_size_slug: basic-xxs
envs:
- key: RAILS_ENV
value: production
- key: DATABASE_URL
value: ${chatwoot-db.DATABASE_URL}
- key: REDIS_URL
value: ${chatwoot-redis.REDIS_URL}
- key: FRONTEND_URL
value: ${APP_URL}
- key: FORCE_SSL
value: "true"
http_port: 8080
- name: worker
source_dir: /
github:
repo: your-username/chatwoot-fork
branch: main
run_command: bundle exec sidekiq -C config/sidekiq.yml
environment_slug: ruby
instance_count: 1
instance_size_slug: basic-xxs
envs:
- key: RAILS_ENV
value: production
- key: DATABASE_URL
value: ${chatwoot-db.DATABASE_URL}
- key: REDIS_URL
value: ${chatwoot-redis.REDIS_URL}
databases:
- name: chatwoot-db
engine: PG
version: "13"
size: db-s-dev-database
- name: chatwoot-redis
engine: REDIS
version: "6"
size: db-s-dev-database
static_sites:
- name: assets
source_dir: /public
github:
repo: your-username/chatwoot-fork
branch: main
build_command: bundle exec rails assets:precompile
```
### Deploy with App Platform
```bash
# Deploy using doctl
doctl apps create --spec app.yaml
# Or deploy via DigitalOcean Control Panel
# 1. Go to App Platform
# 2. Create App
# 3. Connect your GitHub repository
# 4. Configure build and run commands
# 5. Add environment variables
# 6. Deploy
```
## Kubernetes Deployment
### Create DOKS Cluster
```bash
# Create Kubernetes cluster
doctl kubernetes cluster create chatwoot-k8s \
--region nyc3 \
--version 1.24.4-do.0 \
--count 3 \
--size s-2vcpu-4gb \
--auto-upgrade=true \
--maintenance-window="saturday=06:00"
# Get kubeconfig
doctl kubernetes cluster kubeconfig save chatwoot-k8s
```
### Helm Deployment
```bash
# Add Chatwoot Helm repository
helm repo add chatwoot https://chatwoot.github.io/charts
helm repo update
# Create namespace
kubectl create namespace chatwoot
# Install with DigitalOcean-specific values
helm install chatwoot chatwoot/chatwoot \
--namespace chatwoot \
--set ingress.enabled=true \
--set ingress.className=nginx \
--set ingress.hosts[0].host=chatwoot.yourdomain.com \
--set postgresql.enabled=false \
--set redis.enabled=false \
--set env.DATABASE_URL="postgresql://..." \
--set env.REDIS_URL="redis://..."
```
### DigitalOcean-Specific Values
Create `do-values.yaml`:
```yaml
# DigitalOcean Kubernetes values
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
kubernetes.digitalocean.com/load-balancer-id: "your-lb-id"
hosts:
- host: chatwoot.yourdomain.com
paths:
- path: /
pathType: Prefix
# Use DigitalOcean managed databases
postgresql:
enabled: false
redis:
enabled: false
# DigitalOcean Spaces for storage
env:
ACTIVE_STORAGE_SERVICE: "amazon"
S3_BUCKET_NAME: "your-chatwoot-space"
AWS_ACCESS_KEY_ID: "your-spaces-key"
AWS_SECRET_ACCESS_KEY: "your-spaces-secret"
AWS_REGION: "nyc3"
S3_ENDPOINT: "https://nyc3.digitaloceanspaces.com"
# Resource limits for DigitalOcean
resources:
limits:
cpu: 1000m
memory: 2Gi
requests:
cpu: 500m
memory: 1Gi
# Storage class for DigitalOcean Block Storage
persistence:
enabled: true
storageClass: "do-block-storage"
size: 20Gi
```
## Storage Configuration
### DigitalOcean Spaces
```bash
# Create Spaces bucket
doctl compute cdn create \
--origin nyc3.digitaloceanspaces.com/your-chatwoot-space \
--ttl 3600
# Configure CORS for Spaces
# Create cors.json:
{
"CORSRules": [
{
"AllowedOrigins": ["https://chatwoot.yourdomain.com"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE"],
"AllowedHeaders": ["*"],
"MaxAgeSeconds": 3000
}
]
}
# Apply CORS configuration
s3cmd setcors cors.json s3://your-chatwoot-space
```
### Block Storage for Droplets
```bash
# Create and attach block storage
doctl compute volume create chatwoot-storage \
--size 100GiB \
--region nyc3
doctl compute volume-action attach chatwoot-storage \
--droplet-id your-droplet-id
# Mount the volume
sudo mkdir /mnt/chatwoot-storage
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_chatwoot-storage /mnt/chatwoot-storage
echo '/dev/disk/by-id/scsi-0DO_Volume_chatwoot-storage /mnt/chatwoot-storage ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
```
## SSL Certificate
### Let's Encrypt with Certbot
```bash
# Install Certbot
sudo apt update
sudo apt install certbot python3-certbot-nginx
# Obtain certificate
sudo certbot --nginx -d chatwoot.yourdomain.com
# Auto-renewal
sudo crontab -e
# Add: 0 12 * * * /usr/bin/certbot renew --quiet
```
### DigitalOcean Load Balancer SSL
```bash
# Upload certificate to DigitalOcean
doctl compute certificate create \
--name chatwoot-cert \
--private-key-path private.key \
--leaf-certificate-path certificate.crt \
--certificate-chain-path ca_bundle.crt
# Update load balancer with certificate
doctl compute load-balancer update your-lb-id \
--forwarding-rules entry_protocol:https,entry_port:443,target_protocol:http,target_port:3000,certificate_id:your-cert-id
```
## Monitoring and Alerting
### DigitalOcean Monitoring
```bash
# Enable monitoring for droplets
doctl compute droplet create chatwoot-prod \
--enable-monitoring \
--enable-ipv6
# Create alert policies
doctl monitoring alert-policy create \
--type v1/insights/droplet/cpu \
--description "High CPU usage" \
--compare GreaterThan \
--value 80 \
--window 5m \
--entities droplet:your-droplet-id
```
### Custom Metrics with Prometheus
```yaml
# prometheus-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
namespace: monitoring
data:
prometheus.yml: |
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'chatwoot'
static_configs:
- targets: ['chatwoot-service:3000']
metrics_path: /metrics
```
## Backup Strategy
### Database Backups
```bash
# Automated backups for managed databases are enabled by default
# Manual backup
doctl databases backups list chatwoot-db-id
# Restore from backup
doctl databases backups restore chatwoot-db-id backup-id
```
### Droplet Snapshots
```bash
# Create snapshot
doctl compute droplet-action snapshot your-droplet-id \
--snapshot-name "chatwoot-backup-$(date +%Y%m%d)"
# Schedule automated snapshots
doctl compute droplet-action enable-backups your-droplet-id
```
### Application Data Backup
```bash
#!/bin/bash
# backup-script.sh
DATE=$(date +%Y%m%d_%H%M%S)
# Database backup (if using managed database)
pg_dump $DATABASE_URL | gzip > "/tmp/chatwoot_db_$DATE.sql.gz"
# Upload to Spaces
s3cmd put "/tmp/chatwoot_db_$DATE.sql.gz" s3://your-backup-space/db/
# File uploads backup
s3cmd sync s3://your-chatwoot-space/ s3://your-backup-space/files/
# Cleanup local backup
rm "/tmp/chatwoot_db_$DATE.sql.gz"
```
## Scaling and Performance
### Horizontal Scaling with Load Balancer
```bash
# Create additional droplets
for i in {2..3}; do
doctl compute droplet create chatwoot-prod-$i \
--image ubuntu-20-04-x64 \
--size s-2vcpu-4gb \
--region nyc3 \
--ssh-keys your-ssh-key-id \
--user-data-file cloud-init.yaml
done
# Add droplets to load balancer
doctl compute load-balancer add-droplets your-lb-id \
--droplet-ids droplet-id-2,droplet-id-3
```
### Vertical Scaling
```bash
# Resize droplet
doctl compute droplet-action resize your-droplet-id \
--size s-4vcpu-8gb \
--resize-disk
```
### Auto-scaling with Kubernetes
```yaml
# hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: chatwoot-hpa
namespace: chatwoot
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: chatwoot
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
```
## Cost Optimization
### Reserved Instances
```bash
# DigitalOcean doesn't offer reserved instances
# But you can optimize costs by:
# 1. Right-sizing droplets
doctl compute size list
# 2. Using appropriate database sizes
doctl databases options sizes
# 3. Implementing auto-scaling to scale down during low usage
```
### Cost Monitoring
```bash
# Check current usage and costs
doctl account get
# Monitor resource usage
doctl monitoring metrics bandwidth droplet:your-droplet-id
doctl monitoring metrics cpu droplet:your-droplet-id
doctl monitoring metrics memory droplet:your-droplet-id
```
## Troubleshooting
### Common Issues
<Accordion title="Droplet connection issues">
Check:
- Firewall rules (ufw status)
- DigitalOcean Cloud Firewalls
- SSH key configuration
- Network connectivity
</Accordion>
<Accordion title="Database connection problems">
Verify:
- Database cluster status
- Connection string format
- SSL requirements for managed databases
- Firewall rules for database access
</Accordion>
<Accordion title="Load balancer health check failures">
Solutions:
- Verify health check path (/api)
- Check application startup time
- Ensure proper port configuration
- Review application logs
</Accordion>
### Diagnostic Commands
```bash
# Check droplet status
doctl compute droplet get your-droplet-id
# View load balancer status
doctl compute load-balancer get your-lb-id
# Check database status
doctl databases get chatwoot-db-id
# Monitor application logs
sudo journalctl -u chatwoot-web.1.service -f
sudo journalctl -u chatwoot-worker.1.service -f
```
### Performance Monitoring
```bash
# System resources
htop
iostat -x 1
free -h
df -h
# Network monitoring
iftop
netstat -tulpn
# Application metrics
curl http://localhost:3000/api
curl http://localhost:3000/metrics
```
## Best Practices
### Security
- Enable DigitalOcean Cloud Firewalls
- Use SSH keys instead of passwords
- Enable automatic security updates
- Implement fail2ban for SSH protection
- Use managed databases for better security
### Performance
- Use DigitalOcean Spaces CDN for static assets
- Implement Redis caching
- Monitor with DigitalOcean Monitoring
- Use SSD-backed droplets
- Place resources in the same region
### Reliability
- Use multiple availability zones
- Implement automated backups
- Set up monitoring and alerting
- Use load balancers for high availability
- Test disaster recovery procedures
### Cost Management
- Right-size your resources
- Use managed services to reduce operational overhead
- Implement monitoring to track usage
- Clean up unused resources regularly
- Consider using Kubernetes for better resource utilization
---
This DigitalOcean deployment guide provides multiple options for hosting Chatwoot on DigitalOcean's infrastructure. Choose the deployment method that best fits your technical requirements and budget constraints.
1. Follow the Chatwoot docs to configure your domain, email and other parameters you need.
https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#configure-the-required-environment-variables
@@ -0,0 +1,16 @@
---
title: Deploying Chatwoot on Easypanel
description: Deploy Chatwoot using Easypanel's modern server control panel
sidebarTitle: Easypanel
---
[Easypanel](https://easypanel.io) it's a modern server control panel. You can use it to deploy Chatwoot on your own server.
[![Deploy to Easypanel](https://easypanel.io/img/deploy-on-easypanel-40.svg)](https://easypanel.io/docs/templates/chatwoot)
## Instructions
1. Create a VM that runs Ubuntu on your cloud provider.
2. Install Easypanel using the instructions from the website.
3. Create a new project.
4. Install Chatwoot using the dedicated template.
@@ -0,0 +1,43 @@
---
title: Elestio Chatwoot fully managed deployment guide
description: Deploy Chatwoot with Elestio's fully managed platform
sidebarTitle: Elestio
---
## Deploy to Elestio with one-click
[![Deploy](https://pub-da36157c854648669813f3f76c526c2b.r2.dev/deploy-on-elestio-black.png)](https://elest.io/open-source/chatwoot)
## Select the providers
- Select cloud service provider of your choice.
- Choose region of your choice
- Select service plan. The smallest one offers 1 CPU, 2 GB RAM etc.
- Confirm the details and hit "Next"
![Elestio Setup](/self-hosted/images/elestio.png)
## Configure
- Select the support level
- Name your application
- Add admin email (You can add email you want to access your application from)
- Click "Create Service"
- Here you also get option to copy your terraform config (Optional)
## Use Chatwoot
- Click on "Display Admin UI"
- Go to Admin Ui link provided
- Add username and password provided on dashboard.
![Elestio Dashboard](/self-hosted/images/elestio-dash.png)
## Update Chatwoot
- Go to Overview section in your Chatwoot service
- Click "Change version" inside Software section
- Choose the latest version or the version of your choice.
- Additionally update the configs or restart the instance with single clink under same section
![Elestio Change version](/self-hosted/images/elestio-version.png)
+20 -733
View File
@@ -1,745 +1,32 @@
---
title: Google Cloud Platform (GCP) Deployment
description: Deploy Chatwoot on Google Cloud Platform with Compute Engine, Cloud Run, or GKE
title: GCP Chatwoot deployment guide
description: Deploy Chatwoot on a single VM in GCP
sidebarTitle: GCP
---
# Google Cloud Platform Deployment Guide
This guide will deploy chatwoot on a single VM in GCP. For a cloud native deployment, use our [helm charts](https://github.com/chatwoot/charts) with Google Kubernetes Engine(GKE).
Deploy Chatwoot on Google Cloud Platform using Compute Engine, Cloud Run, or Google Kubernetes Engine for a scalable, enterprise-ready solution.
<Note>
This guide is a work in progress and your mileage may vary.
</Note>
## Deployment Options
## Create Compute Engine (VM)
<CardGroup cols={3}>
<Card title="Compute Engine" icon="server" href="#compute-engine">
Traditional VM deployment with full control
</Card>
<Card title="Cloud Run" icon="cloud" href="#cloud-run">
Serverless container deployment
</Card>
<Card title="GKE" icon="kubernetes" href="#google-kubernetes-engine">
Managed Kubernetes deployment
</Card>
</CardGroup>
1. Navigate to VM > Compute Engine window.
2. Create an instance with a minimum of 4vCPU and 8GB RAM.(N2 General-Purpose)
3. Make sure to select the correct region you want to deploy.
4. Choose `Ubuntu 20.04` as your OS with a 120GB disk.
5. Click create.
## Compute Engine Deployment
![gcp-create-compute-engine](/self-hosted/images/gcp.png)
### Prerequisites
## Install Chatwoot
```bash
# Install and configure gcloud CLI
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
1. SSH into the instance created.
2. Follow the linux VM instructions at https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm.
3. Woot! Woot! Your Chatwoot Instance is ready and can be accessed at `http://<your-instance-ip>:3000`. Or if you completed the domain setup during the installation, chatwoot should be available at `https://<your-domain>`
# Set project and region
gcloud config set project your-project-id
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a
```
## Configure Chatwoot
### Network Setup
```bash
# Create VPC network
gcloud compute networks create chatwoot-vpc --subnet-mode=custom
# Create subnet
gcloud compute networks subnets create chatwoot-subnet \
--network=chatwoot-vpc \
--range=10.0.1.0/24 \
--region=us-central1
# Create firewall rules
gcloud compute firewall-rules create chatwoot-allow-http \
--network=chatwoot-vpc \
--allow=tcp:80,tcp:443,tcp:3000 \
--source-ranges=0.0.0.0/0 \
--target-tags=chatwoot-server
gcloud compute firewall-rules create chatwoot-allow-ssh \
--network=chatwoot-vpc \
--allow=tcp:22 \
--source-ranges=0.0.0.0/0 \
--target-tags=chatwoot-server
```
### Database Setup
#### Cloud SQL PostgreSQL
```bash
# Create Cloud SQL instance
gcloud sql instances create chatwoot-db \
--database-version=POSTGRES_13 \
--tier=db-g1-small \
--region=us-central1 \
--storage-type=SSD \
--storage-size=100GB \
--storage-auto-increase \
--backup-start-time=03:00 \
--enable-bin-log \
--maintenance-window-day=SUN \
--maintenance-window-hour=04
# Create database
gcloud sql databases create chatwoot_production --instance=chatwoot-db
# Create user
gcloud sql users create chatwoot \
--instance=chatwoot-db \
--password=your-secure-password
# Get connection name
gcloud sql instances describe chatwoot-db --format="value(connectionName)"
```
#### Memorystore Redis
```bash
# Create Redis instance
gcloud redis instances create chatwoot-redis \
--size=1 \
--region=us-central1 \
--redis-version=redis_6_x \
--network=chatwoot-vpc
```
### Storage Setup
```bash
# Create Cloud Storage bucket
gsutil mb -p your-project-id -c STANDARD -l us-central1 gs://your-chatwoot-bucket
# Set bucket permissions
gsutil iam ch allUsers:objectViewer gs://your-chatwoot-bucket
# Enable CORS
cat > cors.json << EOF
[
{
"origin": ["https://chatwoot.yourdomain.com"],
"method": ["GET", "PUT", "POST", "DELETE"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600
}
]
EOF
gsutil cors set cors.json gs://your-chatwoot-bucket
```
### Compute Instance
#### Create Instance Template
```bash
# Create startup script
cat > startup-script.sh << 'EOF'
#!/bin/bash
apt-get update
apt-get install -y wget curl
# Download and install Chatwoot
wget https://get.chatwoot.app/linux/install.sh
chmod +x install.sh
./install.sh --install
# Configure environment
sudo -u chatwoot bash << 'INNER_EOF'
cd /home/chatwoot/chatwoot
cat > .env << 'ENV_EOF'
RAILS_ENV=production
NODE_ENV=production
FRONTEND_URL=https://chatwoot.yourdomain.com
FORCE_SSL=true
# Database
DATABASE_URL=postgresql://chatwoot:password@/chatwoot_production?host=/cloudsql/your-project:us-central1:chatwoot-db
# Redis
REDIS_URL=redis://10.0.0.3:6379/0
# Storage
ACTIVE_STORAGE_SERVICE=google
GCS_PROJECT=your-project-id
GCS_BUCKET=your-chatwoot-bucket
# Email (using SendGrid)
MAILER_SENDER_EMAIL=noreply@yourdomain.com
SMTP_ADDRESS=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=your-sendgrid-api-key
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=true
ENV_EOF
# Prepare database
RAILS_ENV=production bundle exec rake db:chatwoot_prepare
INNER_EOF
# Restart services
systemctl restart chatwoot.target
EOF
# Create instance template
gcloud compute instance-templates create chatwoot-template \
--machine-type=e2-standard-2 \
--network-interface=network=chatwoot-vpc,subnet=chatwoot-subnet \
--boot-disk-size=50GB \
--boot-disk-type=pd-ssd \
--image-family=ubuntu-2004-lts \
--image-project=ubuntu-os-cloud \
--tags=chatwoot-server \
--metadata-from-file startup-script=startup-script.sh \
--service-account=chatwoot-sa@your-project-id.iam.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform
```
#### Create Managed Instance Group
```bash
# Create instance group
gcloud compute instance-groups managed create chatwoot-ig \
--template=chatwoot-template \
--size=2 \
--zone=us-central1-a
# Configure autoscaling
gcloud compute instance-groups managed set-autoscaling chatwoot-ig \
--max-num-replicas=5 \
--min-num-replicas=2 \
--target-cpu-utilization=0.7 \
--zone=us-central1-a
```
### Load Balancer
```bash
# Create health check
gcloud compute health-checks create http chatwoot-health-check \
--port=3000 \
--request-path=/api
# Create backend service
gcloud compute backend-services create chatwoot-backend \
--protocol=HTTP \
--health-checks=chatwoot-health-check \
--global
# Add instance group to backend service
gcloud compute backend-services add-backend chatwoot-backend \
--instance-group=chatwoot-ig \
--instance-group-zone=us-central1-a \
--global
# Create URL map
gcloud compute url-maps create chatwoot-map \
--default-service=chatwoot-backend
# Create SSL certificate
gcloud compute ssl-certificates create chatwoot-ssl \
--domains=chatwoot.yourdomain.com
# Create HTTPS proxy
gcloud compute target-https-proxies create chatwoot-https-proxy \
--url-map=chatwoot-map \
--ssl-certificates=chatwoot-ssl
# Create global forwarding rule
gcloud compute forwarding-rules create chatwoot-https-rule \
--global \
--target-https-proxy=chatwoot-https-proxy \
--ports=443
# Create HTTP to HTTPS redirect
gcloud compute url-maps create chatwoot-redirect \
--default-url-redirect-response-code=301 \
--default-url-redirect-https-redirect
gcloud compute target-http-proxies create chatwoot-http-proxy \
--url-map=chatwoot-redirect
gcloud compute forwarding-rules create chatwoot-http-rule \
--global \
--target-http-proxy=chatwoot-http-proxy \
--ports=80
```
## Cloud Run Deployment
### Containerize Chatwoot
Create `Dockerfile`:
```dockerfile
FROM chatwoot/chatwoot:latest
# Set environment variables
ENV RAILS_ENV=production
ENV NODE_ENV=production
ENV PORT=8080
# Expose port
EXPOSE 8080
# Start command
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0", "-p", "8080"]
```
### Build and Deploy
```bash
# Build container image
gcloud builds submit --tag gcr.io/your-project-id/chatwoot
# Deploy to Cloud Run
gcloud run deploy chatwoot \
--image gcr.io/your-project-id/chatwoot \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--memory 2Gi \
--cpu 2 \
--max-instances 10 \
--set-env-vars RAILS_ENV=production \
--set-env-vars DATABASE_URL="postgresql://..." \
--set-env-vars REDIS_URL="redis://..." \
--set-env-vars FRONTEND_URL="https://chatwoot.yourdomain.com"
# Deploy worker service
gcloud run deploy chatwoot-worker \
--image gcr.io/your-project-id/chatwoot \
--platform managed \
--region us-central1 \
--no-allow-unauthenticated \
--memory 1Gi \
--cpu 1 \
--max-instances 5 \
--command "bundle,exec,sidekiq,-C,config/sidekiq.yml" \
--set-env-vars RAILS_ENV=production \
--set-env-vars DATABASE_URL="postgresql://..." \
--set-env-vars REDIS_URL="redis://..."
```
### Custom Domain
```bash
# Map custom domain
gcloud run domain-mappings create \
--service chatwoot \
--domain chatwoot.yourdomain.com \
--region us-central1
```
## Google Kubernetes Engine (GKE)
### Create GKE Cluster
```bash
# Create GKE cluster
gcloud container clusters create chatwoot-cluster \
--zone us-central1-a \
--num-nodes 3 \
--machine-type e2-standard-2 \
--disk-size 50GB \
--disk-type pd-ssd \
--enable-autoscaling \
--min-nodes 1 \
--max-nodes 5 \
--enable-autorepair \
--enable-autoupgrade \
--network chatwoot-vpc \
--subnetwork chatwoot-subnet
# Get credentials
gcloud container clusters get-credentials chatwoot-cluster --zone us-central1-a
```
### Helm Deployment
```bash
# Add Chatwoot Helm repository
helm repo add chatwoot https://chatwoot.github.io/charts
helm repo update
# Create namespace
kubectl create namespace chatwoot
# Create values file for GCP
cat > gcp-values.yaml << EOF
# GCP-specific values
ingress:
enabled: true
className: gce
annotations:
kubernetes.io/ingress.global-static-ip-name: "chatwoot-ip"
networking.gke.io/managed-certificates: "chatwoot-ssl"
kubernetes.io/ingress.allow-http: "false"
hosts:
- host: chatwoot.yourdomain.com
paths:
- path: /
pathType: Prefix
# Use Cloud SQL and Memorystore
postgresql:
enabled: false
redis:
enabled: false
env:
DATABASE_URL: "postgresql://chatwoot:password@/chatwoot_production?host=/cloudsql/your-project:us-central1:chatwoot-db"
REDIS_URL: "redis://10.0.0.3:6379/0"
ACTIVE_STORAGE_SERVICE: "google"
GCS_PROJECT: "your-project-id"
GCS_BUCKET: "your-chatwoot-bucket"
# Resource limits
resources:
limits:
cpu: 1000m
memory: 2Gi
requests:
cpu: 500m
memory: 1Gi
# Workload Identity
serviceAccount:
create: true
annotations:
iam.gke.io/gcp-service-account: chatwoot-sa@your-project-id.iam.gserviceaccount.com
EOF
# Install Chatwoot
helm install chatwoot chatwoot/chatwoot \
--namespace chatwoot \
--values gcp-values.yaml
```
### SSL Certificate
```yaml
# managed-cert.yaml
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: chatwoot-ssl
namespace: chatwoot
spec:
domains:
- chatwoot.yourdomain.com
```
```bash
kubectl apply -f managed-cert.yaml
```
## Service Account and IAM
### Create Service Account
```bash
# Create service account
gcloud iam service-accounts create chatwoot-sa \
--display-name="Chatwoot Service Account"
# Grant necessary permissions
gcloud projects add-iam-policy-binding your-project-id \
--member="serviceAccount:chatwoot-sa@your-project-id.iam.gserviceaccount.com" \
--role="roles/cloudsql.client"
gcloud projects add-iam-policy-binding your-project-id \
--member="serviceAccount:chatwoot-sa@your-project-id.iam.gserviceaccount.com" \
--role="roles/storage.objectAdmin"
gcloud projects add-iam-policy-binding your-project-id \
--member="serviceAccount:chatwoot-sa@your-project-id.iam.gserviceaccount.com" \
--role="roles/redis.editor"
# Create and download key
gcloud iam service-accounts keys create chatwoot-key.json \
--iam-account=chatwoot-sa@your-project-id.iam.gserviceaccount.com
```
## Monitoring and Logging
### Cloud Monitoring
```bash
# Enable APIs
gcloud services enable monitoring.googleapis.com
gcloud services enable logging.googleapis.com
# Create notification channel
gcloud alpha monitoring channels create \
--display-name="Email Alerts" \
--type=email \
--channel-labels=email_address=admin@yourdomain.com
```
### Custom Metrics
```yaml
# monitoring.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-config
namespace: chatwoot
data:
prometheus.yml: |
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'chatwoot'
static_configs:
- targets: ['chatwoot-service:3000']
metrics_path: /metrics
```
### Alerting Policies
```bash
# Create alerting policy for high CPU
gcloud alpha monitoring policies create \
--policy-from-file=cpu-alert-policy.yaml
# cpu-alert-policy.yaml
cat > cpu-alert-policy.yaml << EOF
displayName: "High CPU Usage"
conditions:
- displayName: "CPU usage above 80%"
conditionThreshold:
filter: 'resource.type="gce_instance"'
comparison: COMPARISON_GREATER_THAN
thresholdValue: 0.8
duration: 300s
combiner: OR
enabled: true
notificationChannels:
- projects/your-project-id/notificationChannels/CHANNEL_ID
EOF
```
## Backup and Disaster Recovery
### Database Backups
```bash
# Cloud SQL automatic backups are enabled by default
# Create on-demand backup
gcloud sql backups create --instance=chatwoot-db
# List backups
gcloud sql backups list --instance=chatwoot-db
# Restore from backup
gcloud sql backups restore BACKUP_ID --restore-instance=chatwoot-db-restore
```
### Application Backups
```bash
#!/bin/bash
# backup-script.sh
DATE=$(date +%Y%m%d_%H%M%S)
# Database backup
gcloud sql export sql chatwoot-db gs://your-backup-bucket/db/chatwoot_$DATE.sql
# File storage backup
gsutil -m rsync -r -d gs://your-chatwoot-bucket gs://your-backup-bucket/files/
# Kubernetes configuration backup
kubectl get all -n chatwoot -o yaml > k8s-backup-$DATE.yaml
gsutil cp k8s-backup-$DATE.yaml gs://your-backup-bucket/k8s/
```
## Security Best Practices
### Network Security
```bash
# Create private cluster
gcloud container clusters create chatwoot-private \
--enable-private-nodes \
--master-ipv4-cidr-block 172.16.0.0/28 \
--enable-ip-alias \
--enable-network-policy
# Create firewall rules for private access
gcloud compute firewall-rules create allow-chatwoot-private \
--network chatwoot-vpc \
--allow tcp:443,tcp:80 \
--source-ranges 10.0.0.0/8
```
### Secret Management
```bash
# Create secrets in Secret Manager
gcloud secrets create database-password --data-file=db-password.txt
gcloud secrets create redis-password --data-file=redis-password.txt
# Grant access to service account
gcloud secrets add-iam-policy-binding database-password \
--member="serviceAccount:chatwoot-sa@your-project-id.iam.gserviceaccount.com" \
--role="roles/secretmanager.secretAccessor"
```
### Binary Authorization
```bash
# Enable Binary Authorization
gcloud container binauthz policy import policy.yaml
# policy.yaml
cat > policy.yaml << EOF
defaultAdmissionRule:
requireAttestationsBy:
- projects/your-project-id/attestors/prod-attestor
enforcementMode: ENFORCED_BLOCK_AND_AUDIT_LOG
globalPolicyEvaluationMode: ENABLE
EOF
```
## Cost Optimization
### Preemptible Instances
```bash
# Create preemptible node pool
gcloud container node-pools create preemptible-pool \
--cluster=chatwoot-cluster \
--zone=us-central1-a \
--machine-type=e2-standard-2 \
--preemptible \
--num-nodes=2 \
--enable-autoscaling \
--min-nodes=0 \
--max-nodes=5
```
### Committed Use Discounts
```bash
# Purchase committed use discount
gcloud compute commitments create chatwoot-commitment \
--plan=12-month \
--region=us-central1 \
--resources=type=VCPU,amount=4 \
--resources=type=MEMORY,amount=16
```
### Resource Optimization
```yaml
# resource-quota.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: chatwoot-quota
namespace: chatwoot
spec:
hard:
requests.cpu: "4"
requests.memory: 8Gi
limits.cpu: "8"
limits.memory: 16Gi
persistentvolumeclaims: "4"
```
## Troubleshooting
### Common Issues
<Accordion title="Cloud SQL connection issues">
Check:
- Cloud SQL Proxy configuration
- Service account permissions
- Network connectivity
- SSL requirements
</Accordion>
<Accordion title="GKE pod startup failures">
Verify:
- Resource quotas and limits
- Image pull permissions
- Service account configuration
- Network policies
</Accordion>
<Accordion title="Load balancer health check failures">
Solutions:
- Verify health check path (/api)
- Check firewall rules
- Ensure proper backend configuration
- Review application startup time
</Accordion>
### Diagnostic Commands
```bash
# Check Compute Engine instances
gcloud compute instances list
# View Cloud Run services
gcloud run services list
# Check GKE cluster status
gcloud container clusters describe chatwoot-cluster --zone us-central1-a
# View logs
gcloud logging read "resource.type=gce_instance" --limit 50
gcloud logging read "resource.type=cloud_run_revision" --limit 50
# Check Cloud SQL status
gcloud sql instances describe chatwoot-db
```
### Performance Monitoring
```bash
# View metrics
gcloud monitoring metrics list --filter="metric.type:compute"
# Create dashboard
gcloud monitoring dashboards create --config-from-file=dashboard.json
```
## Best Practices
### Security
- Use private GKE clusters
- Enable Workload Identity
- Implement Binary Authorization
- Use Secret Manager for sensitive data
- Enable audit logging
### Performance
- Use Cloud CDN for static assets
- Implement Cloud Memorystore for caching
- Use SSD persistent disks
- Enable HTTP/2 and gRPC
- Optimize container images
### Reliability
- Deploy across multiple zones
- Use managed services (Cloud SQL, Memorystore)
- Implement proper health checks
- Set up monitoring and alerting
- Test disaster recovery procedures
### Cost Management
- Use preemptible instances for non-critical workloads
- Implement resource quotas
- Purchase committed use discounts
- Monitor usage with Cloud Billing
- Use Cloud Functions for event-driven tasks
---
This GCP deployment guide provides comprehensive options for hosting Chatwoot on Google Cloud Platform. Choose the deployment method that best aligns with your scalability, security, and operational requirements.
1. Follow the Chatwoot docs to configure your domain, email and other parameters you need.
https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#configure-the-required-environment-variables
+35 -491
View File
@@ -1,505 +1,49 @@
---
title: Heroku Deployment
description: Deploy Chatwoot on Heroku with one-click deployment and managed services
title: Heroku Chatwoot Production Deployment Guide
description: Deploy Chatwoot on Heroku with one-click deployment
sidebarTitle: Heroku
---
# Heroku Deployment Guide
Deploy Chatwoot on Heroku using the one-click deployment option for a quick and managed hosting solution. This guide covers deployment, configuration, and maintenance on Heroku's platform.
# Deploying on Heroku
<Note>
Heroku has discontinued free dynos, postgres and redis. [Chatwoot will use basic/mini plans](https://blog.heroku.com/new-low-cost-plans) for all new Heroku deployments going forward.
</Note>
## Quick Deployment
### One-Click Deploy
The fastest way to get Chatwoot running on Heroku is using the one-click deploy button:
<Card title="Deploy to Heroku" icon="heroku" href="https://heroku.com/deploy?template=https://github.com/chatwoot/chatwoot">
Click here to deploy Chatwoot to Heroku with one click
</Card>
### Deployment Steps
1. **Click the Deploy Button**: Use the one-click deploy button above
2. **Configure App Settings**:
- Choose an app name (or let Heroku generate one)
- Select your region (US or Europe)
- Review the default configuration
3. **Deploy the Application**: Click "Deploy app" and wait for the build to complete
4. **Enable Worker Dynos**:
- Go to the **Resources** tab in your Heroku app dashboard
- Ensure the **worker** dynos are turned on
- This is crucial for background job processing
5. **Configure Environment Variables**:
- Go to **Settings** tab in Heroku app dashboard
- Click **Reveal Config Vars**
- Configure additional variables as needed
6. **Access Your Installation**: Navigate to `yourapp.herokuapp.com`
## Configuration
### Required Environment Variables
Heroku automatically sets up basic configuration, but you'll need to configure additional variables:
#### Email Configuration
```bash
# SMTP Settings (required for notifications)
MAILER_SENDER_EMAIL=noreply@yourdomain.com
SMTP_ADDRESS=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USERNAME=apikey
SMTP_PASSWORD=your-sendgrid-api-key
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=true
```
#### File Storage Configuration
<Warning>
Heroku has an "ephemeral" hard disk. Files uploaded to Chatwoot will not persist after application restarts. You must configure cloud storage.
</Warning>
**Amazon S3 Configuration:**
```bash
ACTIVE_STORAGE_SERVICE=amazon
S3_BUCKET_NAME=your-chatwoot-bucket
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1
```
**Google Cloud Storage Configuration:**
```bash
ACTIVE_STORAGE_SERVICE=google
GCS_PROJECT=your-project-id
GCS_BUCKET=your-chatwoot-bucket
GOOGLE_APPLICATION_CREDENTIALS={"type":"service_account",...}
```
#### Frontend URL
```bash
FRONTEND_URL=https://yourapp.herokuapp.com
FORCE_SSL=true
```
### Setting Environment Variables
#### Via Heroku Dashboard
1. Go to your app's **Settings** tab
2. Click **Reveal Config Vars**
3. Add each variable name and value
4. Click **Add** for each variable
#### Via Heroku CLI
```bash
# Install Heroku CLI
npm install -g heroku
# Login to Heroku
heroku login
# Set environment variables
heroku config:set MAILER_SENDER_EMAIL=noreply@yourdomain.com -a your-app-name
heroku config:set SMTP_ADDRESS=smtp.sendgrid.net -a your-app-name
heroku config:set SMTP_PORT=587 -a your-app-name
# Set storage configuration
heroku config:set ACTIVE_STORAGE_SERVICE=amazon -a your-app-name
heroku config:set S3_BUCKET_NAME=your-bucket -a your-app-name
heroku config:set AWS_ACCESS_KEY_ID=your-key -a your-app-name
heroku config:set AWS_SECRET_ACCESS_KEY=your-secret -a your-app-name
```
## Add-ons and Services
### Database (PostgreSQL)
Heroku automatically provisions a PostgreSQL database:
```bash
# Check database info
heroku pg:info -a your-app-name
# Access database console
heroku pg:psql -a your-app-name
# Create database backup
heroku pg:backups:capture -a your-app-name
# Download backup
heroku pg:backups:download -a your-app-name
```
### Redis
Heroku automatically provisions Redis for caching and background jobs:
```bash
# Check Redis info
heroku redis:info -a your-app-name
# Access Redis CLI
heroku redis:cli -a your-app-name
# Monitor Redis
heroku redis:monitor -a your-app-name
```
### Email Service (SendGrid)
Add SendGrid for email delivery:
```bash
# Add SendGrid add-on
heroku addons:create sendgrid:starter -a your-app-name
# Get SendGrid credentials
heroku config:get SENDGRID_USERNAME -a your-app-name
heroku config:get SENDGRID_PASSWORD -a your-app-name
```
## Updating Your Deployment
### Method 1: GitHub Integration (Recommended)
1. **Connect GitHub Repository**:
- Go to the **Deploy** tab in your Heroku app dashboard
- Choose **GitHub** as the deployment method
- Connect the `chatwoot/chatwoot` repository
2. **Enable Automatic Deploys** (Optional):
- Enable automatic deploys from the `master` branch
- This will automatically deploy when new releases are available
3. **Manual Deploy**:
- Go to **Manual deploy** section
- Choose `master` branch
- Click **Deploy Branch**
### Method 2: Heroku CLI
```bash
# Clone the Chatwoot repository
git clone https://github.com/chatwoot/chatwoot.git
cd chatwoot
# Add Heroku remote
heroku git:remote -a your-app-name
# Deploy latest version
git push heroku master
```
### Method 3: Docker Deployment
```bash
# Login to Heroku Container Registry
heroku container:login
# Build and push Docker image
heroku container:push web -a your-app-name
# Release the image
heroku container:release web -a your-app-name
```
## Scaling and Performance
### Dyno Management
```bash
# Scale web dynos
heroku ps:scale web=2 -a your-app-name
# Scale worker dynos
heroku ps:scale worker=1 -a your-app-name
# Check dyno status
heroku ps -a your-app-name
```
### Performance Monitoring
```bash
# View application metrics
heroku logs --tail -a your-app-name
# Monitor dyno performance
heroku ps:exec -a your-app-name
# Check memory usage
heroku logs --source app --tail -a your-app-name | grep "Memory usage"
```
## Monitoring and Logging
### Application Logs
```bash
# View recent logs
heroku logs -a your-app-name
# Tail logs in real-time
heroku logs --tail -a your-app-name
# Filter logs by source
heroku logs --source app -a your-app-name
heroku logs --source heroku -a your-app-name
```
### Add Monitoring Services
#### Papertrail (Log Management)
```bash
# Add Papertrail
heroku addons:create papertrail:choklad -a your-app-name
# View logs in Papertrail
heroku addons:open papertrail -a your-app-name
```
#### New Relic (Application Monitoring)
```bash
# Add New Relic
heroku addons:create newrelic:wayne -a your-app-name
# Configure New Relic
heroku config:set NEW_RELIC_APP_NAME="Chatwoot Production" -a your-app-name
# Open New Relic dashboard
heroku addons:open newrelic -a your-app-name
```
## Security Configuration
### SSL/TLS
Heroku automatically provides SSL certificates for custom domains:
```bash
# Add custom domain
heroku domains:add chatwoot.yourdomain.com -a your-app-name
# Check SSL certificate status
heroku certs -a your-app-name
# Enable Automated Certificate Management
heroku certs:auto:enable -a your-app-name
```
### Environment Security
```bash
# Rotate database credentials
heroku pg:credentials:rotate -a your-app-name
# Rotate Redis credentials
heroku redis:credentials:rotate -a your-app-name
# Review security settings
heroku config -a your-app-name
```
## Backup and Recovery
### Database Backups
```bash
# Schedule automatic backups
heroku pg:backups:schedule DATABASE_URL --at '02:00 America/Los_Angeles' -a your-app-name
# Create manual backup
heroku pg:backups:capture -a your-app-name
# List all backups
heroku pg:backups -a your-app-name
# Restore from backup
heroku pg:backups:restore b001 DATABASE_URL -a your-app-name
```
### File Storage Backups
Since Heroku has ephemeral storage, ensure your cloud storage has backup policies:
**For S3:**
```bash
# Enable versioning on S3 bucket
aws s3api put-bucket-versioning \
--bucket your-chatwoot-bucket \
--versioning-configuration Status=Enabled
# Set up lifecycle policy for old versions
aws s3api put-bucket-lifecycle-configuration \
--bucket your-chatwoot-bucket \
--lifecycle-configuration file://lifecycle.json
```
## Troubleshooting
### Common Issues
<Accordion title="Application not starting">
**Symptoms**: App crashes on startup, H10 errors
**Solutions**:
- Check that worker dynos are enabled in Resources tab
- Verify all required environment variables are set
- Check application logs: `heroku logs --tail -a your-app-name`
- Ensure database migrations have run: `heroku run rails db:migrate -a your-app-name`
</Accordion>
<Accordion title="File uploads not working">
**Symptoms**: Files upload but disappear after app restart
**Solutions**:
- Configure cloud storage (S3, GCS, etc.)
- Verify storage credentials are correct
- Check CORS settings on your storage bucket
- Test storage configuration: `heroku run rails console -a your-app-name`
</Accordion>
<Accordion title="Email notifications not sending">
**Symptoms**: Users not receiving email notifications
**Solutions**:
- Verify SMTP configuration in config vars
- Check SendGrid add-on status
- Test email configuration: `heroku run rails console -a your-app-name`
- Review email logs in SendGrid dashboard
</Accordion>
<Accordion title="Build version shows as unknown">
**Symptoms**: Settings page shows "unknown" build version
**Solution**:
Enable runtime dyno metadata:
```bash
heroku labs:enable runtime-dyno-metadata -a your-app-name
```
</Accordion>
### Performance Issues
<Accordion title="Slow response times">
**Solutions**:
- Scale up web dynos: `heroku ps:scale web=2 -a your-app-name`
- Upgrade to higher performance dynos
- Monitor database performance with `heroku pg:diagnose -a your-app-name`
- Check Redis performance with `heroku redis:info -a your-app-name`
</Accordion>
<Accordion title="Background jobs not processing">
**Solutions**:
- Ensure worker dynos are running: `heroku ps -a your-app-name`
- Scale worker dynos if needed: `heroku ps:scale worker=1 -a your-app-name`
- Check Sidekiq logs: `heroku logs --source app --tail -a your-app-name | grep sidekiq`
</Accordion>
### Diagnostic Commands
```bash
# Check app status
heroku ps -a your-app-name
# View configuration
heroku config -a your-app-name
# Check add-ons
heroku addons -a your-app-name
# Run Rails console
heroku run rails console -a your-app-name
# Run database migrations
heroku run rails db:migrate -a your-app-name
# Check database status
heroku pg:info -a your-app-name
# Check Redis status
heroku redis:info -a your-app-name
```
Deploy Chatwoot on Heroku through the following steps:
1. Click on the [one click deploy button](https://heroku.com/deploy?template=https://github.com/chatwoot/chatwoot/tree/master) and deploy your app.
2. Go to the **Resources** tab in the Heroku app dashboard and ensure the worker dynos is turned on.
3. Head over to **Settings** tab in Heroku app dashboard and click **Reveal Config Vars**.
4. Configure the environment variables for [mailer](/self-hosted/configuration/environment-variables#configure-emails) and [storage](/self-hosted/deployment/storage/supported-providers) as per the [documentation](/self-hosted/configuration/environment-variables).
5. Head over to `yourapp.herokuapp.com` and enjoy using Chatwoot.
<iframe
frameBorder="0"
scrolling="no"
marginHeight="0"
marginWidth="0"
width="100%"
height="443"
type="text/html"
src="https://www.youtube-nocookie.com/embed/iN2Dl0QkvEg?autoplay=0&fs=0&iv_load_policy=3&showinfo=1&rel=0&cc_load_policy=0&start=0&end=0&origin=https://youtubeembedcode.com">
</iframe>
## Updating the deployment on Heroku
Whenever a new version is out for Chatwoot, you update your Heroku deployment through following steps:
1. In the **Deploy** tab, choose `GitHub` as the deployment option.
2. Connect Chatwoot repo to the app.
3. Head over to the manual deploy option, choose `master` branch and hit **Deploy**.
## Known Limitations
### Platform Limitations
1. **Dyno Sleep**: If you are on a free tier and you don't access the application for a while Heroku will put your dynos to sleep. You can fix this by upgrading the dynos to paid tier.
1. **Ephemeral File System**: Files uploaded to local storage will be lost on dyno restart
2. **Dyno Sleep**: Free tier dynos sleep after 30 minutes of inactivity (upgrade to paid tier to avoid)
3. **Request Timeout**: Heroku has a 30-second request timeout limit
4. **Memory Limits**: Dynos have memory limits based on the plan selected
2. **Ephemeral Storage**: Heroku has an "ephemeral" hard disk. The files uploaded to Chatwoot would not persist after the application is restarted. By default, Chatwoot uses local disk as the upload destination. To overcome this problem, you will have to [configure a cloud storage](/self-hosted/deployment/storage/supported-providers).
### Workarounds
1. **File Storage**: Use cloud storage (S3, GCS) instead of local storage
2. **Dyno Sleep**: Upgrade to paid dynos or use external monitoring to keep app awake
3. **Long Requests**: Implement background job processing for long-running tasks
4. **Memory Usage**: Monitor and optimize application memory usage
## Cost Optimization
### Dyno Sizing
```bash
# Check current dyno usage
heroku ps -a your-app-name
# Optimize dyno allocation
heroku ps:scale web=1:standard-1x worker=1:standard-1x -a your-app-name
```
### Add-on Optimization
- Use appropriate add-on tiers based on usage
- Monitor add-on usage and costs in Heroku dashboard
- Consider consolidating services where possible
## Best Practices
### Security
- Use environment variables for all sensitive configuration
- Enable Automated Certificate Management for SSL
- Regularly rotate database and Redis credentials
- Monitor access logs and set up alerts
### Performance
- Use appropriate dyno types for your workload
- Monitor application performance with New Relic or similar
- Implement caching strategies
- Optimize database queries
### Reliability
- Set up automatic database backups
- Monitor application health with external services
- Implement proper error handling and logging
- Use multiple dynos for high availability
### Cost Management
- Monitor dyno usage and scale appropriately
- Use scheduler add-on for periodic tasks instead of always-on workers
- Review and optimize add-on usage regularly
- Consider reserved capacity for predictable workloads
---
This Heroku deployment guide provides a complete solution for hosting Chatwoot on Heroku's platform. The managed infrastructure and add-on ecosystem make it an excellent choice for teams who want to focus on using Chatwoot rather than managing infrastructure.
For more information, visit the [official Chatwoot Heroku documentation](https://www.chatwoot.com/docs/self-hosted/deployment/heroku).
3. **Build Version**: If the build version is shown as unknown on the settings page, enable the runtime dyno metadata feature. To enable, use:
```bash
heroku labs:enable runtime-dyno-metadata -a <app-name>
```
@@ -0,0 +1,101 @@
---
title: Restack Chatwoot production deployment guide
description: Deploy Chatwoot on AWS with Restack's managed Kubernetes platform
sidebarTitle: AWS with Restack
---
## Getting Started
To deploy Chatwoot with Restack:
- [Sign up for a Restack account](#sign-up-for-a-restack-account).
- [Add AWS credentials with AdministratorAccess](#add-aws-credentials-with-administratoraccess).
- [One-click cluster creation with Restack](#one-click-cluster-creation-with-restack).
- [Deploy Chatwoot on Restack](#deploy-chatwoot-on-restack).
- [Start using Chatwoot](#start-using-chatwoot).
- [Deploy multiple instances of Chatwoot](#deploy-multiple-instances-of-chatwoot).
<Note>
This is a community contributed installation setup. This will only have community support for any issues in future.
</Note>
## Sign up for a Restack account
To Sign up for a Restack account, visit [www.restack.io/signup](https://www.restack.io/signup). You can sign up with your corporate email address or your GitHub profile. You do not need a credit card to sign up.
![restack-signup](/self-hosted/images/restack-sign-up.png)
If you already have an account, go ahead and login to Restack at [www.restack.io/login](https://www.restack.io/login).
## Add AWS credentials with AdministratorAccess
To deploy Chatwoot in your own AWS infrastructure with Restack, you will need to add your credentials as the next step.
Make sure that this account has *AdministratorAccess*. This is how Restack can ensure an end-to-end cluster creation and cluster management process.
1. Navigate to *Clusters* in the left-hand navigation menu.
2. Select the *Credentials* tab.
3. Click *Add credential*.
![add-credentials](/self-hosted/images/Add_credentials.png)
4. Give a suitable title to your credentials for managing them later.
5. Enter your *AWS Access Key ID* and *AWS Secret Access key*.
6. Click *Add credential*.
![add-aws-credentials](/self-hosted/images/Add_AWS_Creds.png)
<Tip>
[How to get your AWS Access key ID and AWS Secret Access Key](https://docs.aws.amazon.com/accounts/latest/reference/root-user-access-key.html)
</Tip>
## One-click cluster creation with Restack
<Tip>
Why do I need a cluster?<br/>
Running your application on a Kubernetes cluster lets you deploy, scale and monitor the application reliably.
</Tip>
Once you have added your credentials,
1. Navigate to the *Clusters* tab on the same page and click on *Create cluster*.
![create-cluster](/self-hosted/images/Create_cluster.png)
2. Give a suitable name to your cluster.
3. Select the region you want to deploy the cluster in.
4. Select the AWS credentials you added in the previous step.
![cluster-details](/self-hosted/images/Cluster_details.png)
The cluster creation process will start automatically. Once the cluster is ready, you will get an email on the email id connected with your account.<br/>Creating a cluster is a one-time process. From here you can add other open source tools or multiple instances of Chatwoot in the same cluster.
![creating-cluster](/self-hosted/images/Creating_cluster.png)
![cluster-created](/self-hosted/images/Cluster_created.png)
Any application you deploy in your cluster will be accessible via a free **restack domain**.<br/>Contact the Restack team via chat to set a custom domain for your Chatwoot instances.
## Deploy Chatwoot on Restack
1. Click *Add application* from the Cluster description or go to the Applications tab in the left hand side navigation.
2. Click *Chatwoot*.
![select-chatwoot](/self-hosted/images/Select_Chatwoot.png)
3. Select the cluster you have already provisioned.
4. Click *Add application*.
## Start using Chatwoot
Chatwoot will be deployed on your cluster and you can access it using the link under the *URL* tab.
![chatwoot-deployed](/self-hosted/images/Chatwoot_deployed.png)
You can also check the workloads and volumes that are deployed within Chatwoot.
![access-chatwoot](/self-hosted/images/Chatwoot_access.png)
## Deploy multiple instances of Chatwoot
Restack makes it easier to deploy multiple instances of Chatwoot on the same or multiple clusters.<br/>So you can test the latest version before upgrading or have a dedicated instance for development and for production.