SimonCox.com

Version 7.3

Using a CDN to help migrate your sites hosting

by Simon Cox
Simon Cox, Author

Topic
Web

Coach and Horses at a country show
Moving a site to new hosting can be fraught with issues. Here is one technique that I find useful when moving to a website to a new hosting server.

without having that DNS propagation wait

As part of an upgrade to a site we want­ed to add a blog to pro­vide news and updates. The site was flat filed so putting it onto Perch was the obvi­ous way to go — there were plen­ty of oth­er ben­e­fits as well. I want­ed to make the tran­si­tion from the sites US host­ing, where it had been for some years, to WESH — a UK based host. I had devel­oped the site local­ly and was ready to upload it to the new host­ing but I want­ed to avoid the DNS prop­a­ga­tion dance which always annoys me.

This site was already set up on the cloud​flare​.com, a Con­tent Deliv­ery Net­work. The domain name then resolves to Cloudflare’s plat­form and caches your site allow­ing for faster delivery.

The new site was then uploaded (old school FTP) and the mysql file installed on the new host using the IP address.

I checked through the site using a chrome plug in — Vir­tu­al Hosts — that allows you to do a local DNS change. I mapped the sites domain to the new IP address and then could test using the domain name. It has a lit­tle red light to remind you that it is on — don’t for­get to turn off later!

I then logged into Cloud­flare and changed the type A set­tings for the domain to the new IP address. On this site I only have the web­site going through Cloudflare’s ser­vices. FTP, Mail and oth­er stuff is DNS only and avoids the CDN services.

The deliv­ery of the new pages is instant as there is no DNS prop­a­ga­tion need­ed as we have not changed name servers. But there is one more step to smooth things along. I go to Caching in Cloud­flare and use the Purge cache process. The ​‘Purge Indi­vid­ual Files’ but­ton is a drop down and you can choose Purge Every­thing. The refresh­es the CDN with the files from the uploaded site. This step isn’t nec­es­sary if you have moved every­thing over from the old host. In this case I had rebuilt the site onto Perch so it was a new site and I need­ed to purge the cache. You could leave the cache prim­ing to the first vis­i­tors but I like to give a quick vis­it to the main pages. This trig­gers Cloudflare’s caching so fol­low­ing vis­i­tors can enjoy the fast pages.

I did not change the IP address for the mail ser­vices as I will need to talk the client through that. At the moment mail ser­vices are still man­aged through the old servers. Updat­ing email set­tings is usu­al­ly the most time con­sum­ing part of the whole process. In this case I can send a file so it recon­fig­ures her email set­tings auto­mat­i­cal­ly. Once done I leave it a few weeks then close the host­ing ser­vice down.

And that is it. While oth­ers are refresh­ing wait­ing for the DNS to prop­a­gate I am off for a cuppa.


Comments