Configuring automatic domain syncing with Cloudways

NOTE: If you are on Cloudways and are getting an error 502 or a “user already exists” during the signup flow, be sure to read this article for a fix.

Since version 1.6.0, network admins hosting their network over Cloudways no longer need to manually add mapped domains to the additional domain list on the Cloudways control panel. This tutorial will go over the necessary steps to configure this integration on your WP Ultimo network install.

Step 1: Getting a Cloudways API Key

Follow the steps 1 and 2 of the official Cloudways tutorial to obtain a API key for your account (Read the tutorial). Copy the API Key as we will need it in the following steps.

Step 2: Get the Server ID

The next piece of information we will need is the server id of the server hosting your WordPress install on Cloudways. To discover the server id, visit the Server Management screen of the server. The server id will be present on the URL of that page after the “/server/” portion of it.

The URL takes the form of https://platform.cloudways.com/server/SERVER_ID_HERE/access_detail

Step 3: Get the App ID

We’ll need to do a similar thing to obtain the App ID for your WordPress installation. Go to Application Management screen of your WordPress app and the App ID will present on the URL, after the /apps/ portion of it.

The same thing happens here: the URL takes the form of https://platform.cloudways.com/apps/YOUR_APP_ID_HERE/access_detail

Step 4: Adding the config to your wp-config.php file

Now, you’ll need to edit your wp-config.php file to include the custom configuration constants WP Ultimo needs to correctly connect to the Cloudways API.

Add the following lines to your wp-config.php file, right above the /* That’s all, stop editing! Happy blogging. */ line. Replace the contents with the information obtained in the prior steps:

Since 1.6.1 – Additional Step – Extra Domains

The Cloudways API is a bit strange in that it doesn’t offer a way to add or remove just one domain, only a way to update the whole domain list. That means that WP Ultimo will replace all domains you might have there with the list of mapped domains of the network every time a new domain is added.

If there are domains you want to keep on the list, use the WU_CLOUDWAYS_EXTRA_DOMAINS as demonstrated below, with a comma-separated list of the domains you wanna keep (this is useful if you need a wildcard setting, for example, that needs to be on that list at all times).

Here’s how it should look on your wp-config.php (fake values used below):

You’re all set!

Now, every time a new domain is mapped in the network (via the Aliases tab by the network admin or via the custom domain meta-box on the user’s Account page) will be added to the Cloudways platform automatically.

The same is true for domain removals. Every time a domain is deleted from the network, that change will be communicated to your Cloudways account instantly!

Was this article helpful?

Related Articles

7 Comments

  1. steve

    Is there any advantage to using this over just adding an “additonal domain” in cloudways?

    *.mydomain.com

    WP Ultimo seems to work fine with Cloudways using this approach. Should I be using the API?

    1. Arindo Duque

      This is only helpful if you plan to allow your clients to map their own domains, Steve. Otherwise, you’ll be fine with the wildcard domain setup on Cloudways.
      Prior to this integration, whenever a client mapped a domain, the network admin would need to manually add that domain to the Cloudways domain list, which is far from optimal. Hope that clarifies it!

  2. Russell

    Arindo,

    Question about the “…EXTRA_DOMAINS” point,
    So every time WP Ultimo adds/deletes a domain, it re-writes the whole domains list, hence the “extra domains” option. I understand that. And I also understand why one would put a wildcard of a main domain in the “extra” list

    But what about all the mapped domains that had been added before? If they are not on the “extra domains” list – will they be deleted?

    1. Arindo Duque

      Hey, Russel. No, they will not be deleted. Every time WP Ultimo “rewrites” the list, it doesn’t just send the newly added mapped domain. It compiles all the mappings created on your Network so far, creates a new list, bundles in the extra domains and sends the final result fo that to Cloudways servers. You don’t need to worry about losing domains added in the past =)

      1. Russell

        Thanks Arindo!

        That was fast 🙂
        So WP Ultimo will add/delete to the “extra domains” list in Cloudways, including the “extra_domains” specified, the primary dimain will stay intact, correct?

        So if I understood correctly, I should only add the wildcard of the main domain to the “extra domains” list, and the WPU will be taking care of all the mapping moving forward automatically

        1. Arindo Duque

          Yep. That’s it!

          If for some reason you change one of the sites URL directly on the site settings (without adding a mapping), you’d also need to add that to the extra domains list, but that’s pretty much the only other case I can think of to add other domains to the extra domain list.

Leave A Comment?