GitHub Download

How to avoid losing data on your website?

Though truly catastrophic hosting datacenter issues rarely occur, if/when they do, it can be, to put it mildly, rather inconvenient for their users. Without adequate measures in place, such critical situations can lead to people and companies losing valuable data, and if they don't have a recovery solution prepared their site may be left a shadow of its regular self for an extensive period. 

Illustration by unDraw

So how can we protect ourselves? In this article, we cover some good practice habits for backing up your data that will, if the situation ever arise, leave you prepared for the worst.

If you're not backing up, you're asking for trouble

It's a basic point, but one that should be reiterated. Make backups. One would assume that anyone working with a website would know the importance of keeping a backup handy, but once in a while I'll meet someone who doesn't learn just how critical this step is until it's too late. This also applies with people that have gone a long time without any major issues; if everything has been working fine for a while it can be easy to keep putting off making a backup because of how time-consuming it is, but as the saying goes, "expect the best, but prepare for the worst". 

Backups are the basic building block of our site's security, so make sure it's one of your priorities.

A backup should be performed regularly…

We've got our backup, and all's right with the world. But is it up-to-date? I think everyone has experienced that sinking feeling when they realise that the article they've been working on the for the last few hours has been lost completely (I expect a few people had a painful flashback to their college years while reading that sentence). If we're making frequent additions or changes to our site, then we need to make sure that we adjust our backup schedule to guarantee that we always have a fresh copy of the latest changes ready to go should the worst happen.

In some cases, backups may even have to be taken multiple times a day; for example, If we have an online shop that handles several hundred purchases daily, backing up once a day will not be a sufficiently-effective solution. If the timing of the failure is particularly bad, the full day's worth of transaction data could be lost.

Thus, its crucial that we plan our backup schedule appropriately to mitigate the impact of data loss. But that's not all; making backups is important, but we also have to consider where those backups will be stored.

… and stored in a safe place

Hosting companies are certainly more well-versed and experienced in creating and managing backups than the average website owner, and so relying on them to some degree for backing up your content isn't wrong, per se. However, we shouldn't blindly trust that the service provider will be able to protect your data entirely. Though we can reasonably expect that these providers will have some contingencies to safeguard backups, there's still a risk that some extreme situation, such as a fire or other unmanageable issue will render the backup data unreachable or damage it beyond repair.

For this reason, your plan of action when it comes to site backups should include diverse solutions in addition to those used by the service provider; your own copies, stored locally or in the cloud, provides a failsafe should some unpredictable situation arise.

How frequently we do this can depend on the method our service provider utilises when creating a storing backups; it's worth taking some time to analyse their storage solutions to ascertain the amount of risk our data is under. For example, if the backup files are stored on the same machine as our live site data, there's a much greater risk of catastrophic failure than when the data is kept on a separate machine to the live site. 

With larger sites using more complex solutions, the ideal situation is that the backups are stored in datacenters entirely separate from the location where the live site data is; the chances of, say, a fire occurring at two locations at the same time wiping out all our data is statistically-insignificant.

With that said, even if we're taking regular backups and storing them safely with multiple redundancies to prevent full data loss, there's still some extra steps we should be taking.

Verify your backups

Having backups readily-available will surely have a calming effect, helping us rest easier. However, it is essential that we remember that the backup operation itself may be faulty and can cause issues down the road. If there's a defect in the backup process, the ZIP package might not be able to extract or its files or will be incorrectly saved. So we should take time to extract a backup every so often to verify that (almost) sure that all's well. 

In larger operations that take more backups, this issue is less of a concern as the likelihood that a specific file will be corrupted across all instances of the backup are fairly small, but we shouldn't rely on faith alone when it comes to verifying our backup integrity.

With all that we've covered above, it's clear that it's worthwhile developing a habit of creating and verifying backups on a regular basis. Only by having regular and redundant backups that have been verified can we rest easy, even if our site runs into a major problem. 

Still, even if we take and verify backups religiously, storing multiple copies across multiple machines and verifying them often, we still can't say that we will never run into a problem with 100% certainty; the best we can do is make it far less likely to happen. 

What about static websites?

Static sites offer a unique perspective on backups. If you use Publii CMS, the backup of your website is usually stored locally on your computer, so you've got a copy of your site external to your provider's storage right off the bat. By making regular backups of your computer (which I hope you're already doing; you never know when your hard drive will decide to give up the ghost) you've already got multiple copies of your site in multiple locations. 

What's important to bear in mind with regards to static sites is that only the compiled HTML files of your site are stored on the server; if your site is particularly build, rebuilding it from your computer might be quite the time-consuming task. If getting your site back online as quickly as possible is important to you, then you should make a habit of backing up the compiled site files as well as the standard backup, to help you get back on your feet if your site goes offline. 

Another thing to keep in mind is that static sites, far more often than dynamic sites, will rely on external services to perform some functions. Let's look at a newsletter service as an example. Many companies offer services that allow you to manage sign-up lists and send out newsletters to your subscribers, but if the newsletter is an important part of the site's business, then we should make sure when choosing a provider that they have adequate data-protection solutions in place. And even if there are such solutions in place, I would personally still consider performing a regular personal backup/copy of the user base, to make us less dependent on the provider to protect our data should a critical situation occur.

Recreating/reopening website

In the end, one little interesting fact/curiosity – how to prepare yourself for quick website reopening.

What to do if there's a major failure at the server room?

If our site goes offline for an extended period of time due to server issues that can't be resolved quickly (e.g. if there's a fire at the server's location, we can expect that the server won't be available again for a long time) and we have to restore a backup of our site to a new server, this throws up another factor that we have to take into account; the time for the propagation of our new site to the DNS. Even if we have backups and can quickly find a server from another service provider to reopen our site on, we will also have to refer to our domain on this server. And here's where the problems begin; some internet users might not be able to see this change even 48 hours after the event. 

If this kind of a delay is too much for us, it's worth considering making use of Cloudflare, which allows for virtual traffic to be redirected to another server without waiting for the DNS to catch-up

In summary

Backups should be made regularly, and be redundant and verified. As well as having accurate, correctly-run backups of your site, it is also vital to consider backups from critical service providers that manage other areas of your site, such as newsletters. Additionally, it's a good idea to have a plan of action to implement should your website become unavailable. This kind of plan will allow you to minimise the amount of time that your site is offline and unreachable by your users. 

And finally, when considering all of the above, we need to create a plan that's appropriate to the scale and importance of our online site; a business site that generates heavy traffic, manages a large amount of transactions or receives frequent updates will need a more robust plan than a simple informational site that doesn't have any active elements and doesn't have new content posted regularly.

Subscribe

Get the latest Publii news, updates and more delivered directly to your email inbox

You can change your mind at any time by clicking the unsubscribe link in the footer of any email you receive from us, or by contacting us at contact@tidycustoms.net. By clicking below, you agree that we may process your information in accordance with our Privacy Policy.