|
| 1 | +# Cloudways Integration |
| 2 | + |
| 3 | +## Overview |
| 4 | +Cloudways is a managed cloud hosting platform that allows you to deploy WordPress sites on various cloud providers like DigitalOcean, AWS, Google Cloud, and more. This integration enables automatic domain syncing and SSL certificate management between WP Multisite WaaS and Cloudways. |
| 5 | + |
| 6 | +## Features |
| 7 | +- Automatic domain syncing |
| 8 | +- SSL certificate management |
| 9 | +- Support for extra domains |
| 10 | +- DNS validation for SSL certificates |
| 11 | + |
| 12 | +## Requirements |
| 13 | +The following constants must be defined in your `wp-config.php` file: |
| 14 | + |
| 15 | +```php |
| 16 | +define('WU_CLOUDWAYS_EMAIL', 'your_cloudways_email'); |
| 17 | +define('WU_CLOUDWAYS_API_KEY', 'your_api_key'); |
| 18 | +define('WU_CLOUDWAYS_SERVER_ID', 'your_server_id'); |
| 19 | +define('WU_CLOUDWAYS_APP_ID', 'your_app_id'); |
| 20 | +``` |
| 21 | + |
| 22 | +Optionally, you can also define: |
| 23 | + |
| 24 | +```php |
| 25 | +define('WU_CLOUDWAYS_EXTRA_DOMAINS', 'comma,separated,list,of,domains'); |
| 26 | +``` |
| 27 | + |
| 28 | +## Setup Instructions |
| 29 | + |
| 30 | +### 1. Get Your Cloudways API Credentials |
| 31 | + |
| 32 | +1. Log in to your Cloudways dashboard |
| 33 | +2. Go to "Account" > "API Keys" |
| 34 | +3. Generate an API key if you don't already have one |
| 35 | +4. Copy your email and API key |
| 36 | + |
| 37 | +### 2. Get Your Server and Application IDs |
| 38 | + |
| 39 | +1. In your Cloudways dashboard, go to "Servers" |
| 40 | +2. Select the server where your WordPress multisite is hosted |
| 41 | +3. The Server ID is visible in the URL: `https://platform.cloudways.com/server/{SERVER_ID}` |
| 42 | +4. Go to "Applications" and select your WordPress application |
| 43 | +5. The App ID is visible in the URL: `https://platform.cloudways.com/server/{SERVER_ID}/application/{APP_ID}` |
| 44 | + |
| 45 | +### 3. Add Constants to wp-config.php |
| 46 | + |
| 47 | +Add the following constants to your `wp-config.php` file: |
| 48 | + |
| 49 | +```php |
| 50 | +define('WU_CLOUDWAYS_EMAIL', 'your_cloudways_email'); |
| 51 | +define('WU_CLOUDWAYS_API_KEY', 'your_api_key'); |
| 52 | +define('WU_CLOUDWAYS_SERVER_ID', 'your_server_id'); |
| 53 | +define('WU_CLOUDWAYS_APP_ID', 'your_app_id'); |
| 54 | +``` |
| 55 | + |
| 56 | +If you have additional domains that should always be included: |
| 57 | + |
| 58 | +```php |
| 59 | +define('WU_CLOUDWAYS_EXTRA_DOMAINS', 'domain1.com,domain2.com,*.wildcard.com'); |
| 60 | +``` |
| 61 | + |
| 62 | +### 4. Enable the Integration |
| 63 | + |
| 64 | +1. In your WordPress admin, go to WP Multisite WaaS > Settings |
| 65 | +2. Navigate to the "Domain Mapping" tab |
| 66 | +3. Scroll down to "Host Integrations" |
| 67 | +4. Enable the Cloudways integration |
| 68 | +5. Click "Save Changes" |
| 69 | + |
| 70 | +## How It Works |
| 71 | + |
| 72 | +### Domain Syncing |
| 73 | + |
| 74 | +When a domain is mapped in WP Multisite WaaS: |
| 75 | + |
| 76 | +1. The integration retrieves all currently mapped domains |
| 77 | +2. It adds the new domain to the list (along with a www version if applicable) |
| 78 | +3. It sends the complete list to Cloudways via the API |
| 79 | +4. Cloudways updates the domain aliases for your application |
| 80 | + |
| 81 | +Note: The Cloudways API requires sending the complete list of domains each time, not just adding or removing individual domains. |
| 82 | + |
| 83 | +### SSL Certificate Management |
| 84 | + |
| 85 | +After domains are synced: |
| 86 | + |
| 87 | +1. The integration checks which domains have valid DNS records pointing to your server |
| 88 | +2. It sends a request to Cloudways to install Let's Encrypt SSL certificates for those domains |
| 89 | +3. Cloudways handles the SSL certificate issuance and installation |
| 90 | + |
| 91 | +## Extra Domains |
| 92 | + |
| 93 | +The `WU_CLOUDWAYS_EXTRA_DOMAINS` constant allows you to specify additional domains that should always be included when syncing with Cloudways. This is useful for: |
| 94 | + |
| 95 | +- Domains that are not managed by WP Multisite WaaS |
| 96 | +- Wildcard domains (e.g., `*.example.com`) |
| 97 | +- Development or staging domains |
| 98 | + |
| 99 | +## Troubleshooting |
| 100 | + |
| 101 | +### API Connection Issues |
| 102 | +- Verify that your email and API key are correct |
| 103 | +- Check that your server and application IDs are correct |
| 104 | +- Ensure that your Cloudways account has the necessary permissions |
| 105 | + |
| 106 | +### SSL Certificate Issues |
| 107 | +- Cloudways requires that domains have valid DNS records pointing to your server before issuing SSL certificates |
| 108 | +- The integration validates DNS records before requesting SSL certificates |
| 109 | +- If SSL certificates are not being issued, check that your domains are properly pointing to your server's IP address |
| 110 | + |
| 111 | +### Domain Not Added |
| 112 | +- Check the WP Multisite WaaS logs for any error messages |
| 113 | +- Verify that the domain is not already added to Cloudways |
| 114 | +- Ensure that your Cloudways plan supports the number of domains you're adding |
0 commit comments