Skip to content

Commit 0c1d372

Browse files
committed
feat: Add automatic droplet resizing and increase default to 2GB
- Add automatic size detection and resizing in deploy.sh - Change default VPS size from 1GB to 2GB (prevents OOM crashes) - Add comprehensive system requirements section to README - Document memory requirements for MySQL 8.0 + Mautic - Add troubleshooting guide for OOM-related issues - Update action.yml description with minimum size recommendation Breaking: Default VPS size changed from s-1vcpu-1gb to s-1vcpu-2gb This prevents database crashes that occur after a few days on 1GB droplets. Closes: Out of memory issues with MySQL 8.0 on small droplets
1 parent 251e284 commit 0c1d372

3 files changed

Lines changed: 70 additions & 4 deletions

File tree

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A GitHub Action to automatically deploy Mautic (open-source marketing automation
66

77
- 🚀 **One-click deployment** - Deploy Mautic in minutes, not hours
88
- 🖥️ **Automatic VPS creation** - Creates and configures DigitalOcean droplets
9+
- 📏 **Smart resizing** - Automatically resizes droplets when you change vps-size in config
910
- 🔒 **SSL/HTTPS support** - Automatic Let's Encrypt SSL certificates (when domain provided)
1011
- 🐳 **Docker-based** - Reliable, containerized deployment with Apache
1112
- 📧 **Email ready** - Pre-configured for email marketing campaigns
@@ -16,6 +17,27 @@ A GitHub Action to automatically deploy Mautic (open-source marketing automation
1617

1718
## 🚀 Quick Start
1819

20+
## 📋 System Requirements
21+
22+
**Minimum Recommended VPS Size:** `s-1vcpu-2gb` (2GB RAM, $12/month)
23+
24+
⚠️ **Important:** Mautic with MySQL 8.0 requires at least 2GB RAM for stable operation:
25+
- MySQL 8.0 baseline: ~400-500MB RAM
26+
- Mautic application: ~300-400MB RAM
27+
- OS and services: ~200-300MB RAM
28+
- Growth buffer for database and cache: ~500MB
29+
30+
**Using a 1GB droplet will cause crashes** after a few days as:
31+
- Database grows with contacts/campaigns
32+
- Cron jobs increase memory pressure
33+
- MySQL gets OOM-killed, corrupting the database
34+
- System becomes unstable even with swap space
35+
36+
💡 **Recommended sizes by usage:**
37+
- **Small/Testing:** `s-1vcpu-2gb` (up to 5K contacts)
38+
- **Medium:** `s-2vcpu-4gb` (up to 50K contacts)
39+
- **Large:** `s-4vcpu-8gb` (50K+ contacts)
40+
1941
### 1. Prerequisites
2042

2143
- DigitalOcean account with API token (see required permissions below)
@@ -142,7 +164,7 @@ jobs:
142164

143165
| Parameter | Description | Default | Example |
144166
|-----------|-------------|---------|---------|
145-
| `vps-size` | DigitalOcean droplet size | `s-2vcpu-2gb` | `s-4vcpu-8gb` |
167+
| `vps-size` | DigitalOcean droplet size (automatically resizes if changed) | `s-2vcpu-2gb` | `s-4vcpu-8gb` |
146168
| `vps-region` | DigitalOcean region | `nyc1` | `fra1`, `lon1`, `sgp1` |
147169
| `domain` | Custom domain name | _(uses IP)_ | `mautic.example.com` |
148170
| `mautic-version` | Mautic Docker image version | `6.0.5-apache` | `6.0.4-apache` |
@@ -448,7 +470,23 @@ Error: Permission denied (publickey)
448470
- Use an SSH key without a passphrase for automation
449471
- Check the action logs for debugging information about key verification
450472
451-
**3. Domain Not Pointing to Server**
473+
**3. Mautic Site Offline - "Currently offline due to error"**
474+
```
475+
The site is currently offline due to encountering an error.
476+
```
477+
**Common Causes:**
478+
- **Out of Memory (OOM)**: Most common on 1GB droplets after a few days
479+
- MySQL 8.0 requires ~400-500MB baseline memory
480+
- Database growth + cron jobs can exceed available RAM
481+
- **Solution**: Update `vps-size` to `s-1vcpu-2gb` or larger in your workflow YAML and re-run the action
482+
- The action will automatically resize your droplet with minimal downtime
483+
- **Database Corruption**: From repeated OOM kills or power issues
484+
- Check logs: `docker logs mautic_db --tail 50`
485+
- May need to restore from backup or recreate
486+
- **Cache Issues**: Corrupted cache files
487+
- SSH into server: `docker exec mautic_web rm -rf /var/www/html/var/cache/*`
488+
489+
**4. Domain Not Pointing to Server**
452490
```
453491
Error: Domain example.com does not point to VPS IP
454492
```

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ inputs:
4040
required: false
4141
default: 'mautic-vps'
4242
vps-size:
43-
description: 'DigitalOcean droplet size (s-1vcpu-1gb, s-1vcpu-2gb, s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb)'
43+
description: 'DigitalOcean droplet size - Minimum s-1vcpu-2gb recommended for MySQL 8.0 + Mautic (s-1vcpu-2gb, s-2vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb)'
4444
required: false
45-
default: 's-1vcpu-1gb'
45+
default: 's-1vcpu-2gb'
4646
vps-region:
4747
description: 'DigitalOcean region'
4848
required: false

scripts/deploy.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,34 @@ if ! doctl compute droplet list | grep -q "${INPUT_VPS_NAME}"; then
107107
sleep 30
108108
else
109109
echo "✅ VPS '${INPUT_VPS_NAME}' already exists"
110+
111+
# Check if droplet size matches desired size
112+
echo "🔍 Checking if droplet size matches desired configuration..."
113+
CURRENT_SIZE=$(doctl compute droplet get "${INPUT_VPS_NAME}" --format Size --no-header)
114+
115+
if [ "$CURRENT_SIZE" != "${INPUT_VPS_SIZE}" ]; then
116+
echo "⚠️ Droplet size mismatch detected!"
117+
echo " Current size: ${CURRENT_SIZE}"
118+
echo " Desired size: ${INPUT_VPS_SIZE}"
119+
echo "🔄 Resizing droplet to ${INPUT_VPS_SIZE}..."
120+
echo " Note: This will cause a brief downtime (typically 1-2 minutes)"
121+
122+
# Get droplet ID
123+
DROPLET_ID=$(doctl compute droplet get "${INPUT_VPS_NAME}" --format ID --no-header)
124+
125+
# Perform resize with disk scaling
126+
if doctl compute droplet-action resize "$DROPLET_ID" --size "${INPUT_VPS_SIZE}" --wait; then
127+
echo "✅ Droplet resized successfully"
128+
echo "⏳ Waiting for droplet to stabilize..."
129+
sleep 30
130+
else
131+
echo "❌ Error: Failed to resize droplet"
132+
echo " Please resize manually in DigitalOcean console or check droplet status"
133+
exit 1
134+
fi
135+
else
136+
echo "✅ Droplet size is correct: ${CURRENT_SIZE}"
137+
fi
110138
fi
111139

112140
# Get VPS IP

0 commit comments

Comments
 (0)