A Postscript on Server Migrations (redirecting network traffic to a new IP)

During the break between Christmas and New Year’s I migrated a server from Linode to Digital Ocean. We have just a handful left, and most of those should be gone this year. This migration was pretty straightforward, no WordPress portal or WHMCS instance, just a straight-up cPanel server. The plan was to run our handy dandy server deploy script which gets about 95% of a new cPanel server setup in about 30 minutes, which is amazing given this use to be a day-long process. Once that server is setup we need to copy all data between the two servers using IP addresses given we want to keep the same hostname, i.e., universityx.reclaimhosting.com. This is easily done with the the Transfer tool in cPanel, and migrating over 500 cPanel accounts took about an hour and a half. 

Once all the accounts are migrated over cleanly, we need to point the DNS records in AWS’s Route 53 to the new IP address of the new server on Digital Ocean. If all went well that should be all set, the one mistake I made on this recent migration was not copying over the existing SSL certificate from the old server—it’s always something. So, after that’s done another trick Tim showed me that has come in useful was redirecting all traffic to the old IP to the new IP server-wide. This post spells it out very well, and it ensures that any lingering traffic that may be going to old server for all kinds of DNS reasons would be pushed to the new server right away. 

https://www.debuntu.org/how-to-redirecting-network-traffic-to-a-new-ip-using-iptables/

Anyway, just putting this here in the event I need this again so I don’t have to dig through Slack again to find the link, not to mention to remind myself of the mistakes I made the last time so I can avoid them next time ?