Question

You have added a new nameserver to CloudBlue Commerce. It is automatically used for new domains that are added to CloudBlue Commerce. But for existing domains it is not. How to update existing CloudBlue Commerce domains to use this new nameserver?

Answer

Change DNS hosting for existing domains from Internal to External and then back from External to Internal:

  1. PCP > Services > Domains > customer1.com > DNS > Click Change DNS Hosting to External > Submit.

  2. PCP > Services > Domains > customer1.com > DNS > Click Change DNS Hosting to Internal > Choose correct DNS hosting assigned to the domain > Submit

Another way to do the same would be through the following API method pem.syncNameServers:

<?xml version="1.0"?>
<methodCall>
<methodName>pem.syncNameServers</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>domain_name</name>
<value>
<string>DOMAIN_NAME</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>

The following script will help to do that in automated way

NOTE: Replace FQDN with your CloudBlue Commerce database host name (OR) IP Address.

#!/bin/bash
# Script to Transfer Existing Zone files to Newly Deployed Name Servers

# Get the list of domains hosted in CloudBlue Commerce
psql -U plesk -d plesk -h<FQDN> -c "SELECT name FROM domains" > domain.list

# Remove the Headers
H2=`head -2 domain.list`

# Filter Spaces and Unwanted strings
egrep -v "$H2|[0-9]*rows|^$" domain.list > domain_final.list

# Sync the zone files to newly deployed name servers.
for i in `cat domain_final.list`
do
cp -av pem.syncNameServers.xml pem.syncNameServers_act.xml;
sed -i 's/DOMAIN_NAME/'$i'/' pem.syncNameServers_act.xml;
curl -d@pem.syncNameServers_act.xml http://localhost:8440/RPC2 >> /var/log/pem_syncNameServers.log 2>> /var/log/pem_syncNameServers_error.log;
rm -vf pem.syncNameServers_act.xml;
sleep 10;
done

Internal content