Backup Strategy for a Self-Hosted CRM That Survives a Crash

A small server and an external hard drive on a shelf in a tidy office closet.

Written by

in

A backup strategy for a self hosted CRM copies three things (the database, the uploaded files, and your config and keys) to a location off the server, on a schedule set by how much data you can afford to lose. You then restore those copies onto a test machine to prove they work. A snapshot stored on the same server is not a backup, and a backup you have never restored is only a hope.

TL;DR:

  • Back up three things: the database, uploaded files and recordings, and the config and encryption keys. Most people only do the first.
  • Pick your acceptable data loss before you pick a tool. A nightly backup can lose up to 24 hours of customer activity.
  • Never copy a live database directory. Use a dump tool or continuous archiving, and keep at least one copy off the server and out of reach of its credentials.
  • A free setup (cron, a dump command, restic or Borg, cheap object storage) covers most small businesses. Keep scripts in GitHub, never the data.
  • Restore to a scratch machine monthly and time it. Deleted customers reappear after a restore unless you keep a deletion log.

Table of Contents

Backup Strategy for a Self-Hosted CRM: What You Are Protecting

A self-hosted CRM keeps customer data on a server you control, which makes you the only person responsible for its survival. No vendor will restore last Tuesday's data for you.

Every self-hosted CRM stores its state in three places, and a backup plan has to cover all of them:

  • The database. Contacts, deals, tickets, notes, message history and user accounts. Everyone remembers this part.
  • Uploaded files. Attachments, signed documents, call recordings and form uploads. These often sit in a separate folder or object store, and they are usually much larger than the database.
  • Config and secrets. The environment file, license key, API credentials and any encryption key the app uses. Lose the key and an encrypted backup of the database can be unreadable.

If you are still deciding what to run, what you own and what it costs is covered separately. The rest of this article assumes the server is already yours.

Set Your Recovery Targets First: How Much Can You Lose?

Contingency-planning guidance such as NIST SP 800-34 frames the problem with two numbers. The recovery point objective is how much data you can lose, measured in time. The recovery time objective is how long you can be down.

Put real figures on them. If your team logs 15 customer interactions an hour over a nine-hour day, that is about 135 records. With a nightly backup, a crash late in the day can erase most of them.

A nightly backup has a worst-case data loss of almost 24 hours: a crash at 1:59 a.m. wipes out the entire previous day.

For a small business with one to ten users, I would aim for a recovery point of one hour or less and a recovery time of four hours or less. Nobody calls an hourly database dump excessive after a disk failure. If your CRM also stores call recordings and signed contracts, apply the tighter target to the database and a looser one (daily) to the files.

The 3-2-1 Rule, and Why a Server Snapshot Fails It

Two colleagues discussing external hard drives placed on a desk next to a closed laptop.

The 3-2-1 rule means three copies of your data, on two kinds of storage, with one copy offsite. The CISA #StopRansomware Guide adds a point that matters more today: keep backups offline or otherwise out of reach of the systems they protect, encrypt them, and test them.

A hosting-provider snapshot feels like a backup. It usually shares a failure domain with the server: the same account, the same credentials, often the same data center. If an attacker or a billing mistake takes out the server, the snapshots can go with it.

Design the offsite copy so the server cannot delete it:

  • Write-only credentials. The server's backup key can add new files but not remove old ones.
  • Object lock or versioning. Most S3-compatible storage can refuse deletions for a set number of days.
  • A different provider. If your server is at one host, store backups with another.

How to Back Up the Database Without Corrupting It

Copying a live database's data directory with cp or rsync produces files from slightly different moments, and the result may not restore at all. Use the database's own tools.

For PostgreSQL, pg_dump takes a consistent logical backup while the system runs, and continuous archiving with point-in-time recovery lets you replay changes to a chosen minute. For MySQL or MariaDB, the MySQL backup documentation describes mysqldump with --single-transaction, which gives a consistent InnoDB snapshot without locking tables, plus binary logs for point-in-time recovery.

Method Worst-case data loss Restore speed Catch
Nightly logical dump Up to 24 hours Minutes for a small database Simplest option, too coarse for busy teams
Hourly logical dump Up to 1 hour Minutes for a small database More storage and a brief load spike each hour
WAL archiving or binary logs Seconds to minutes Slower, needs log replay Most setup and the most to monitor
Volume snapshot Depends on schedule Fast Crash-consistent only, and usually the same failure domain
Copying live data files Unknown May not restore Do not use this

My pick for a small business is an hourly dump plus a nightly full copy shipped offsite. Add log archiving only when losing an hour of activity would cost you real money. For a database under a few gigabytes, an hourly dump takes seconds and gets you 90 percent of the protection for 10 percent of the effort.

Files, Keys and the Backup Everyone Forgets

Database dumps get all the attention. Then someone restores a CRM and finds every attachment and signed contract missing.

Use a deduplicating tool such as restic or BorgBackup for the file store. Both encrypt data, send only changed chunks after the first run, and keep many restore points in little extra space. A 20 GB folder of recordings might add a few hundred megabytes a day.

Then handle the keys:

  • Config and secrets. Copy the environment file and license details into the same encrypted backup.
  • The backup passphrase. Store it in a password manager or printed in a safe, never only on the server. An encrypted backup without its passphrase is a large file of noise.

If you run several brands out of one install, find out how brand separation is stored. When all brands share one database, you cannot roll back a single brand without rolling back the rest. The practical fix is to restore the whole backup to a scratch instance and export only the affected brand's records.

A Free Backup Strategy for a Self-Hosted CRM, and the GitHub Question

You do not need paid backup software. A working free stack looks like this:

  1. A cron job runs the dump command and writes a compressed file.
  2. restic or Borg pushes the dump and the file store to object storage.
  3. A retention rule prunes old restore points.
  4. A ping to a monitoring service confirms the job finished.

For 50 GB of data, object storage typically costs a few dollars a month at most. That is the cheapest insurance a business owner will buy, and it is one reason cutting CRM costs never has to mean cutting protection.

Searchers often ask about GitHub backups. Use a private GitHub repository for your backup scripts, compose files, cron entries and restore notes. Do not put the dumps or the .env file there. Git history is permanent, and customer data committed once is very hard to remove. GitHub also rejects files over 100 MB, which most database dumps exceed.

Test the Restore: The Drill That Proves It Works

Run a restore drill monthly, on a separate machine or a throwaway virtual server:

  1. Pull the latest offsite backup using only the credentials and passphrase you keep outside the production server.
  2. Restore the database and the file store.
  3. Start the CRM and log in.
  4. Open a customer record you know has an attachment, a note and a recent call, and check all three.
  5. Write down the elapsed time. That is your real recovery time.

The first drill almost always finds a gap, such as a missing config file or a passphrase nobody wrote down. Better to find it on a Saturday than in the middle of an outage.

Pro Tip: Alert on backup size, not just on whether the job ran. A dump that fails halfway can still exit cleanly and leave a file 90 percent smaller than normal. Have your monitoring compare tonight's size to the seven-day average and page you if it drops by more than 30 percent. Also add a "no backup received in 26 hours" alert, since a dead cron job sends no error at all.

Retention and Privacy: Backups Hold Data You Deleted

Under GDPR, Article 32 lists the ability to restore availability of and access to personal data after an incident as part of appropriate security. A tested backup is evidence you meet it. Backups also hold records you have since deleted, which creates a problem most backup guides skip.

If a customer asks for erasure and you restore from a backup taken before the request, their data returns. Keep a simple deletion log (record ID and date) and re-apply it after every restore. Cap retention so old data ages out on a known schedule. A sensible default is 14 daily, 8 weekly and 12 monthly restore points, with nothing kept past 12 months unless a legal duty says otherwise. State that window in your privacy policy.

Get a Self-Hosted CRM You Can Back Up in an Afternoon

Replacrm is a self-hosted CRM sold for a one-time payment, from $1,495, with unlimited users, brands and customers. Chats, tickets, form submissions, email and calls land on one customer record on your server. That leaves one place to protect, your own database and file store, with no per-seat export fees and no monthly bill that doubles as a hostage situation. The setup is covered in our installation guide.

Backups are your job, since the software runs on your server and you hold the keys. Before writing your cron job, check where the install keeps its database, uploads and config, and whether ReplaChat or ReplaTicket run on the same server. If they do, add their data to the same backup.

Frequently Asked Questions

How often should I back up a self-hosted CRM?

Match the schedule to how much data you can afford to lose. For most small teams, an hourly database dump plus a nightly full backup of files works well. If you log few interactions per day, a nightly backup alone may be enough.

Is a server snapshot a good enough backup for my CRM?

No, not by itself. A snapshot usually sits in the same account and data center as the server, so one compromised credential or provider failure can destroy both. Keep at least one encrypted copy with a different provider, using credentials that cannot delete old files.

Can I back up a self-hosted CRM for free?

Yes. Cron, a database dump command, restic or BorgBackup, and a few dollars a month of object storage cover most small businesses. The main cost is an afternoon of setup and a monthly restore test.

Should I store CRM backups on GitHub?

Store the scripts and configuration templates there, in a private repository, but never the data dumps or secrets. Git history is permanent and GitHub rejects files over 100 MB. Send the actual backups to encrypted object storage.

How do I know my CRM backup actually works?

Restore it to a separate machine every month, log in, and check that records, attachments and recent activity are present. Time the process, because that number is your real recovery time. Also set alerts for missing or abnormally small backup files.

Sources

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *