Using a CDN to help migrate your sites hosting
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 wanted to add a blog to provide news and updates. The site was flat filed so putting it onto Perch was the obvious way to go — there were plenty of other benefits as well. I wanted to make the transition from the sites US hosting, where it had been for some years, to WESH — a UK based host. I had developed the site locally and was ready to upload it to the new hosting but I wanted to avoid the DNS propagation dance which always annoys me.
This site was already set up on the cloudflare.com, a Content Delivery Network. The domain name then resolves to Cloudflare’s platform and caches your site allowing 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 — Virtual 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 little red light to remind you that it is on — don’t forget to turn off later!
I then logged into Cloudflare and changed the type A settings for the domain to the new IP address. On this site I only have the website going through Cloudflare’s services. FTP, Mail and other stuff is DNS only and avoids the CDN services.
The delivery of the new pages is instant as there is no DNS propagation needed as we have not changed name servers. But there is one more step to smooth things along. I go to Caching in Cloudflare and use the Purge cache process. The ‘Purge Individual Files’ button is a drop down and you can choose Purge Everything. The refreshes the CDN with the files from the uploaded site. This step isn’t necessary if you have moved everything over from the old host. In this case I had rebuilt the site onto Perch so it was a new site and I needed to purge the cache. You could leave the cache priming to the first visitors but I like to give a quick visit to the main pages. This triggers Cloudflare’s caching so following visitors can enjoy the fast pages.
I did not change the IP address for the mail services as I will need to talk the client through that. At the moment mail services are still managed through the old servers. Updating email settings is usually the most time consuming part of the whole process. In this case I can send a file so it reconfigures her email settings automatically. Once done I leave it a few weeks then close the hosting service down.
And that is it. While others are refreshing waiting for the DNS to propagate I am off for a cuppa.