DEV Community

AriaieBOY
AriaieBOY

Posted on • Edited on • Originally published at ariaieboy.ir

How do I backup my websites, and why should I improve

In the old days, I didn't have any backup plans, and the only time I needed my website backed up, I was lucky that my host provider had an automatic backup system. I could restore my website using those backups, but I lost a week of data because the hosting provider would back up the host weekly.

I do not use a shared host these days, and I manage my servers, so I need to back up my websites personally.

How should I backup?

Determining which data requires backup and the frequency of changes is critical.

To determine the needed data, we can think that our server is gone, and we want to restore our website to its current state.

In my case, I need to know the services that my website needs, for example, the web server, application, database, object storage, and cache services.

Then I need to recreate these services using my website source code and run those on my new server.

After running the services, I first need to restore my databases. And if required, my object storage files.

How am I backing up my websites

I back up my databases to another server at least once daily. And in some cases, multiple times a day based on the application traffic.

I back up my codebases on my local machine and the remote git repository hosted on GitHub or GitLab.

Since I use docker for development, All my websites have a docker-compose file that can recreate all required services for the website.

What is missing?

The big missing part is the object storage part. I need to implement a way to automatically back up my files from my self-hosted object storage into another server.

I must implement the 3-2-1 strategy for all my backups.

I need to document the restoration process for each website.

Implement a way to verify the health of the backup files; the last thing I want is a corrupted backup file.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay