|
| 1 | +# Enhance Control Panel Integration |
| 2 | + |
| 3 | +## Overview |
| 4 | +Enhance is a modern control panel that provides powerful hosting automation and management capabilities. This integration enables automatic domain syncing and SSL certificate management between Ultimate Multisite and Enhance Control Panel. |
| 5 | + |
| 6 | +**Related Discussion:** See [GitHub Discussion #265](https://github.com/Multisite-Ultimate/ultimate-multisite/discussions/265) for community tips and additional information. |
| 7 | + |
| 8 | +## Features |
| 9 | +- Automatic domain syncing when domains are mapped in Ultimate Multisite |
| 10 | +- Automatic SSL certificate provisioning via LetsEncrypt when DNS resolves |
| 11 | +- Subdomain support for networks running in subdomain mode |
| 12 | +- Domain removal when mappings are deleted |
| 13 | +- Connection testing to verify API credentials |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +### System Requirements |
| 18 | +- Enhance Control Panel installed and accessible |
| 19 | +- WordPress Multisite installation hosted on or connected to an Enhance server |
| 20 | +- Apache web server (Enhance currently supports Apache configurations; LiteSpeed Enterprise is available at reduced cost) |
| 21 | + |
| 22 | +### API Access |
| 23 | +You must have administrator access to the Enhance Control Panel to create API tokens. |
| 24 | + |
| 25 | +## Getting Your API Credentials |
| 26 | + |
| 27 | +### 1. Create an API Token |
| 28 | + |
| 29 | +1. Log in to your Enhance Control Panel as an administrator |
| 30 | +2. Click on **Settings** in the navigation menu |
| 31 | +3. Navigate to **Access Tokens** |
| 32 | +4. Click **Create Token** |
| 33 | +5. Give the token a descriptive name (e.g., "Ultimate Multisite Integration") |
| 34 | +6. Assign the **System Administrator** role |
| 35 | +7. For the expiry date: |
| 36 | + - Leave empty if you want the token to never expire |
| 37 | + - Or set a specific expiration date for security purposes |
| 38 | +8. Click **Create** |
| 39 | + |
| 40 | +After creation, your **Access Token** and **Organization ID** will be displayed. **Save these immediately** as the token will only be shown once. |
| 41 | + |
| 42 | +### 2. Get Your Organization ID |
| 43 | + |
| 44 | +The Organization ID is displayed on the Access Tokens page in a blue information box labeled "Org ID: {your_id}". |
| 45 | + |
| 46 | +The Organization ID is a UUID formatted like: `d8554b6d-5d0d-6719-009b-fec1189aa8f3` |
| 47 | + |
| 48 | +You can also find a customer's Organization ID by: |
| 49 | +1. Go to **Customers** page |
| 50 | +2. Click **Manage customer** for the relevant customer |
| 51 | +3. Look at the URL - the Organization ID is the alphanumeric characters after `/customers/` |
| 52 | + |
| 53 | +### 3. Get Your Server ID |
| 54 | + |
| 55 | +To find your Server ID (required for domain operations): |
| 56 | + |
| 57 | +1. In the Enhance Control Panel, navigate to **Servers** |
| 58 | +2. Click on the server where your WordPress installation is running |
| 59 | +3. The Server ID (UUID format) will be visible in the URL or server details |
| 60 | +4. Alternatively, you can use the API to list servers: |
| 61 | + |
| 62 | +```bash |
| 63 | +curl -s -X GET https://your-enhance-panel.com/api/servers \ |
| 64 | + -H "Accept: application/json" \ |
| 65 | + -H "Authorization: Bearer YOUR_TOKEN" | jq |
| 66 | +``` |
| 67 | + |
| 68 | +The server ID follows the UUID format: `00000000-0000-0000-0000-000000000000` |
| 69 | + |
| 70 | +### 4. Get Your API URL |
| 71 | + |
| 72 | +Your API URL is your Enhance Control Panel URL with `/api/` appended: |
| 73 | + |
| 74 | +``` |
| 75 | +https://your-enhance-panel.com/api/ |
| 76 | +``` |
| 77 | + |
| 78 | +**Important:** The `/api/` path is required. Common mistakes include: |
| 79 | +- Using just the domain without `/api/` |
| 80 | +- Using HTTP instead of HTTPS (HTTPS is required for security) |
| 81 | + |
| 82 | +## Configuration |
| 83 | + |
| 84 | +### Required Constants |
| 85 | + |
| 86 | +Add the following constants to your `wp-config.php` file: |
| 87 | + |
| 88 | +```php |
| 89 | +// Enhance Control Panel Integration |
| 90 | +define('WU_ENHANCE_API_TOKEN', 'your-bearer-token-here'); |
| 91 | +define('WU_ENHANCE_API_URL', 'https://your-enhance-panel.com/api/'); |
| 92 | +define('WU_ENHANCE_SERVER_ID', 'your-server-uuid-here'); |
| 93 | +``` |
| 94 | + |
| 95 | +### Setup via Integration Wizard |
| 96 | + |
| 97 | +1. In your WordPress admin, go to **Ultimate Multisite** > **Settings** |
| 98 | +2. Navigate to the **Integrations** tab |
| 99 | +3. Find **Enhance Control Panel Integration** and click **Configuration** |
| 100 | +4. The wizard will guide you through the setup: |
| 101 | + - **Step 1:** Introduction and feature overview |
| 102 | + - **Step 2:** Enter your API credentials (Token, API URL, Server ID) |
| 103 | + - **Step 3:** Test the connection |
| 104 | + - **Step 4:** Review and activate |
| 105 | + |
| 106 | +You can choose to: |
| 107 | +- Let the wizard inject the constants into your `wp-config.php` file automatically |
| 108 | +- Copy the constant definitions and add them manually |
| 109 | + |
| 110 | +## Additional WordPress Configuration |
| 111 | + |
| 112 | +Based on community feedback ([Discussion #265](https://github.com/Multisite-Ultimate/ultimate-multisite/discussions/265)), you may need to configure these additional settings: |
| 113 | + |
| 114 | +### .htaccess Configuration |
| 115 | + |
| 116 | +If you experience issues with domain mapping: |
| 117 | +1. Delete the original Enhance `.htaccess` file |
| 118 | +2. Replace it with the standard WordPress Multisite `.htaccess` file |
| 119 | + |
| 120 | +### Cookie Constants |
| 121 | + |
| 122 | +Add these constants to `wp-config.php` to ensure proper cookie handling across mapped domains: |
| 123 | + |
| 124 | +```php |
| 125 | +define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']); |
| 126 | +define('COOKIEPATH', '/'); |
| 127 | +define('ADMIN_COOKIE_PATH', '/'); |
| 128 | +``` |
| 129 | + |
| 130 | +## How It Works |
| 131 | + |
| 132 | +### When a Domain is Mapped |
| 133 | + |
| 134 | +1. A user maps a custom domain in Ultimate Multisite (or a new site is created in subdomain mode) |
| 135 | +2. The integration sends a POST request to Enhance's API: `/servers/{server_id}/domains` |
| 136 | +3. Enhance adds the domain to your server configuration |
| 137 | +4. When DNS resolves to your server, Enhance automatically provisions an SSL certificate via LetsEncrypt |
| 138 | +5. The domain becomes active with HTTPS |
| 139 | + |
| 140 | +### When a Domain is Removed |
| 141 | + |
| 142 | +1. A domain mapping is deleted in Ultimate Multisite |
| 143 | +2. The integration queries Enhance to find the domain's ID |
| 144 | +3. A DELETE request is sent to: `/servers/{server_id}/domains/{domain_id}` |
| 145 | +4. Enhance removes the domain from your server configuration |
| 146 | + |
| 147 | +### DNS and SSL Checking |
| 148 | + |
| 149 | +Ultimate Multisite includes built-in DNS and SSL checking: |
| 150 | +- You can configure the check interval in **Domain Mapping Settings** (default: 300 seconds/5 minutes) |
| 151 | +- The system will verify DNS propagation before marking a domain as active |
| 152 | +- SSL certificate validity is checked automatically |
| 153 | +- Enhance handles SSL provisioning automatically, so manual SSL configuration is not required |
| 154 | + |
| 155 | +## Verifying Setup |
| 156 | + |
| 157 | +### Test the Connection |
| 158 | + |
| 159 | +1. In the Integration Wizard, use the **Test Connection** step |
| 160 | +2. The plugin will attempt to list domains on your server |
| 161 | +3. A success message confirms: |
| 162 | + - API credentials are correct |
| 163 | + - API URL is accessible |
| 164 | + - Server ID is valid |
| 165 | + - Permissions are properly set |
| 166 | + |
| 167 | +### After Mapping a Domain |
| 168 | + |
| 169 | +1. Map a test domain in Ultimate Multisite |
| 170 | +2. Check the Ultimate Multisite logs (**Ultimate Multisite** > **Logs** > **integration-enhance**) |
| 171 | +3. Verify in Enhance Control Panel that the domain was added: |
| 172 | + - Go to **Servers** > **Your Server** > **Domains** |
| 173 | + - The new domain should appear in the list |
| 174 | +4. Once DNS propagates, verify SSL is provisioned automatically |
| 175 | + |
| 176 | +## Troubleshooting |
| 177 | + |
| 178 | +### API Connection Issues |
| 179 | + |
| 180 | +**Error: "Failed to connect to Enhance API"** |
| 181 | +- Verify `WU_ENHANCE_API_URL` includes `/api/` at the end |
| 182 | +- Ensure you're using HTTPS, not HTTP |
| 183 | +- Check that the Enhance panel is accessible from your WordPress server |
| 184 | +- Verify there are no firewall rules blocking the connection |
| 185 | + |
| 186 | +**Error: "Enhance API Token not found"** |
| 187 | +- Ensure `WU_ENHANCE_API_TOKEN` is defined in `wp-config.php` |
| 188 | +- Verify the token hasn't been deleted or expired in Enhance |
| 189 | +- Check for typos in the token value |
| 190 | + |
| 191 | +**Error: "Server ID is not configured"** |
| 192 | +- Verify `WU_ENHANCE_SERVER_ID` is defined in `wp-config.php` |
| 193 | +- Ensure the Server ID is a valid UUID format |
| 194 | +- Confirm the server exists in your Enhance panel |
| 195 | + |
| 196 | +### Domain Not Added |
| 197 | + |
| 198 | +**Check the logs:** |
| 199 | +1. Go to **Ultimate Multisite** > **Logs** |
| 200 | +2. Filter by **integration-enhance** |
| 201 | +3. Look for error messages indicating the issue |
| 202 | + |
| 203 | +**Common causes:** |
| 204 | +- Invalid domain name format |
| 205 | +- Domain already exists in Enhance |
| 206 | +- Insufficient API permissions (ensure token has System Administrator role) |
| 207 | +- Server ID doesn't match the actual server in Enhance |
| 208 | + |
| 209 | +### SSL Certificate Issues |
| 210 | + |
| 211 | +**SSL not provisioning:** |
| 212 | +- Verify DNS is pointing to your server's IP address |
| 213 | +- Check that the domain resolves correctly: `nslookup yourdomain.com` |
| 214 | +- Enhance requires DNS to resolve before it can provision SSL |
| 215 | +- SSL provisioning typically takes 5-10 minutes after DNS propagation |
| 216 | +- Check Enhance Control Panel logs for SSL-specific errors |
| 217 | + |
| 218 | +**Manual SSL troubleshooting in Enhance:** |
| 219 | +1. Go to **Servers** > **Your Server** > **Domains** |
| 220 | +2. Find your domain and check its SSL status |
| 221 | +3. You can manually trigger SSL provisioning if needed |
| 222 | + |
| 223 | +### DNS Check Interval |
| 224 | + |
| 225 | +If domains or SSL certificates are taking too long to activate: |
| 226 | +1. Go to **Ultimate Multisite** > **Settings** > **Domain Mapping** |
| 227 | +2. Find **DNS Check Interval** setting |
| 228 | +3. Adjust from the default 300 seconds to a lower value (minimum: 10 seconds) |
| 229 | +4. **Note:** Lower intervals mean more frequent checks but higher server load |
| 230 | + |
| 231 | +### Authentication Errors |
| 232 | + |
| 233 | +**HTTP 401/403 errors:** |
| 234 | +- Regenerate your API token in Enhance |
| 235 | +- Verify the token has **System Administrator** role |
| 236 | +- Check that the token hasn't expired |
| 237 | +- Ensure you're using the correct Organization ID (though it's typically not required in the URL) |
| 238 | + |
| 239 | +### Log Analysis |
| 240 | + |
| 241 | +Enable detailed logging: |
| 242 | +```php |
| 243 | +// Add to wp-config.php for enhanced debugging |
| 244 | +define('WP_DEBUG', true); |
| 245 | +define('WP_DEBUG_LOG', true); |
| 246 | +``` |
| 247 | + |
| 248 | +Then check logs at: |
| 249 | +- Ultimate Multisite logs: **Ultimate Multisite** > **Logs** |
| 250 | +- WordPress debug log: `wp-content/debug.log` |
| 251 | +- Enhance panel logs: Available in Enhance's admin interface |
| 252 | + |
| 253 | +## API Reference |
| 254 | + |
| 255 | +### Authentication |
| 256 | +All API requests use Bearer token authentication: |
| 257 | +``` |
| 258 | +Authorization: Bearer YOUR_TOKEN_HERE |
| 259 | +``` |
| 260 | + |
| 261 | +### Common Endpoints Used |
| 262 | + |
| 263 | +**List Servers:** |
| 264 | +``` |
| 265 | +GET /servers |
| 266 | +``` |
| 267 | + |
| 268 | +**List Domains on a Server:** |
| 269 | +``` |
| 270 | +GET /servers/{server_id}/domains |
| 271 | +``` |
| 272 | + |
| 273 | +**Add a Domain:** |
| 274 | +``` |
| 275 | +POST /servers/{server_id}/domains |
| 276 | +Body: {"domain": "example.com"} |
| 277 | +``` |
| 278 | + |
| 279 | +**Delete a Domain:** |
| 280 | +``` |
| 281 | +DELETE /servers/{server_id}/domains/{domain_id} |
| 282 | +``` |
| 283 | + |
| 284 | +### Full API Documentation |
| 285 | +Complete API documentation: [https://apidocs.enhance.com](https://apidocs.enhance.com) |
| 286 | + |
| 287 | +## Best Practices |
| 288 | + |
| 289 | +### Security |
| 290 | +- **Never commit API tokens to version control** |
| 291 | +- Store tokens in `wp-config.php` which should be excluded from Git |
| 292 | +- Use tokens with appropriate permissions (System Administrator for full integration) |
| 293 | +- Set token expiry dates for production environments |
| 294 | +- Rotate tokens periodically |
| 295 | + |
| 296 | +### Performance |
| 297 | +- Use the default DNS check interval (300 seconds) to avoid excessive API calls |
| 298 | +- Monitor Enhance server resources when running large-scale domain operations |
| 299 | +- Consider staggering domain additions if mapping many domains at once |
| 300 | + |
| 301 | +### Monitoring |
| 302 | +- Regularly check Ultimate Multisite logs for integration errors |
| 303 | +- Set up monitoring for failed domain additions |
| 304 | +- Verify SSL certificates are provisioning correctly |
| 305 | +- Keep an eye on Enhance server capacity and domain limits |
| 306 | + |
| 307 | +## Additional Resources |
| 308 | + |
| 309 | +- **Enhance Official Documentation:** [https://enhance.com/docs](https://enhance.com/docs) |
| 310 | +- **Enhance API Documentation:** [https://apidocs.enhance.com](https://apidocs.enhance.com) |
| 311 | +- **Enhance Community Forum:** [https://community.enhance.com](https://community.enhance.com) |
| 312 | +- **GitHub Discussion:** [Issue #265 - Enhance Integration Tips](https://github.com/Multisite-Ultimate/ultimate-multisite/discussions/265) |
| 313 | +- **Ultimate Multisite Domain Mapping Guide:** See wiki page "How to Configure Domain Mapping v2" |
| 314 | + |
| 315 | +## Support |
| 316 | + |
| 317 | +If you encounter issues: |
| 318 | +1. Check the Troubleshooting section above |
| 319 | +2. Review the Ultimate Multisite logs |
| 320 | +3. Consult the [GitHub Discussions](https://github.com/Multisite-Ultimate/ultimate-multisite/discussions) |
| 321 | +4. Contact Enhance support for panel-specific issues |
| 322 | +5. Create a new discussion with detailed error logs for community assistance |
| 323 | + |
| 324 | +## Notes |
| 325 | + |
| 326 | +- This integration handles domain aliases only; Enhance manages SSL automatically |
| 327 | +- The integration supports both custom domain mappings and subdomain-based sites |
| 328 | +- Automatic www subdomain creation can be configured in Domain Mapping settings |
| 329 | +- Enhance currently supports Apache configurations (LiteSpeed Enterprise available) |
| 330 | +- Domain removal from Ultimate Multisite will remove the domain from Enhance but may not delete associated SSL certificates immediately |
0 commit comments