How to Build an Offsite Backup Strategy for Self-Hosted Applications

The server is gone. Your web application used PostgreSQL, stored customer uploads on disk, and ran background jobs overnight. Yesterday’s backup job reported success. Now someone has to find the database dump, recover the encryption password, and work out which application release belongs with those files. The status email answers none of that.

When planning backups for self-hosted applications, settle those details before choosing storage. If you’re considering PrivateAlps for part of the setup, ask where the backup server would sit relative to production and how you’d access it if the primary account became unavailable.

Define What You Need to Recover

Start with a recovery inventory before renting storage. A storage VPS can hold the database exports, uploads, and configuration needed to rebuild your application. First establish what belongs in that collection. A copy of the web directory alone will usually leave gaps.

Inventory Data, Configuration, and Dependencies

For this PostgreSQL application, record the database, uploaded files, deployment definitions, application version, and required extensions. Include reverse proxy configuration and any scheduled jobs that aren’t defined in the deployment files. Identify external dependencies, such as DNS and email delivery, that need separate access.

Keep necessary secrets under restricted access. Store recovery instructions and a recoverable copy of the backup password outside the production server. Losing one machine mustn’t lock you out of the instructions for replacing it.

Set Recovery Point and Recovery Time Objectives

Recovery point objective (RPO) describes the data loss you can tolerate, measured in time. Recovery time objective (RTO) sets the target for bringing service back.

For an illustrative small internal application, the team might accept 24 hours of lost changes and aim to restore service within four hours. Those are business decisions. An order-processing application could need much tighter limits.

Separate Backups from the Primary Failure Domain

A second directory on the same server disappears with the first. A second server can still share the same storage system, building, administrator account, or billing suspension. List the failures you need to survive, then check whether your proposed destination survives each one.

RAID helps with certain disk failures. Replication maintains another current copy, which may faithfully reproduce accidental deletion. A provider snapshot can make rollback convenient, but its usefulness after account loss depends on where it lives and who controls it. Independent backup history gives you older recovery points; physical and administrative separation help keep that history available.

The familiar 3-2-1 guideline calls for three copies, including production, across two media types, with one copy offsite. Use it to identify missing protection. Two rented VPS instances alone don’t establish that you’ve met it.

For offsite backup, confirm physical separation from production. Then consider account compromise separately: a different building won’t help if stolen credentials can delete both environments. Depending on the risk, another provider, a separate account, or an additional offline copy may be appropriate.

Choose a Remote Backup Destination

Your choice of remote backup storage affects both daily administration and the recovery procedure. Compare options against the amount of work your team can maintain.

DestinationWhat you manage or verifyRecovery considerations
Storage VPSOperating system, patches, accounts, firewall, repository, capacityFile access can be straightforward, but the server and repository remain your responsibility
Object storageBackup-tool compatibility, permissions, lifecycle settings, available protection featuresCheck retrieval charges, request costs, and delays for archive tiers
Managed backupSupported workloads, coverage, retention, credentials, restore procedureConfirm what the service actually restores and who performs each step

For our application, a storage VPS with SFTP access is one possible destination. It needs configuration; renting disk space doesn’t create a working backup service. Object storage may suit a team that prefers managing bucket policies to maintaining another Linux host. A managed service may reduce routine work, provided it covers the database and files together.

Estimate capacity from retained changes as well as today’s dataset. Ask about transfer limits and export options. A cheap monthly storage bill offers little comfort if retrieving a full copy takes longer than your recovery window.

Encrypt Copies and Separate Access

SFTP protects data in transit over SSH. Client-side backup encryption protects the stored backup contents. These address different exposures, so use both where the chosen workflow supports them.

Restic encrypts repository data before sending it to storage. Keep its recovery password in an independently accessible password manager or another controlled recovery system. Test access from a machine that has never connected to production. Include SSH credentials and account recovery requirements in that exercise.

Give the backup job its own account and SSH key. Restrict access to the intended repository and avoid using a production administrator’s general-purpose credentials. Verify the remote host key rather than disabling SSH host verification to make automation work.

An ordinary writable SFTP repository remains vulnerable to deletion by anyone holding its write credentials. Encryption doesn’t prevent that. Where this threat matters, add a separately controlled copy or verified immutability mechanism. Append-only designs also need compatible repository maintenance and permissions; changing an account name doesn’t create deletion protection.

Build a Consistent Backup Workflow

Capture the Database and Application Files Safely

Assume PostgreSQL 18 and a small database suitable for scheduled logical exports. pg_dump can export a consistent view of one database while it is running. It doesn’t coordinate that view with files being uploaded elsewhere. Database roles and other cluster-wide objects also require separate handling.

Use an application-supported maintenance window: pause all writers, including workers and incoming integrations, allow active writes to finish, then export the database and stage the uploads and configuration. Keep writes paused until that recovery set is captured. They can resume while an unchanged staged copy transfers remotely.

Check each stage before continuing. A failed dump mustn’t be followed by a successful upload of yesterday’s export and a reassuring success message. Protect local staging files too, since database exports may contain sensitive information.

For larger databases or tighter RPOs, evaluate PostgreSQL-aware physical backups with WAL archiving and point-in-time recovery. Copying a live database directory with a generic file backup tool isn’t an equivalent procedure.

Send Encrypted Backups to a Remote Repository

Prepare a remote repository directory owned by the backup account. Verify SSH access and initialize the repository once. Back up the staged recovery set with:

restic -r sftp:backup@backup.example:/srv/restic/app \

backup /srv/backup-staging/app

This restic 0.20.0 command is illustrative, not a tested deployment script. It assumes the repository exists and the staged files are complete. For unattended use, supply the password through a controlled secret source or a tightly permissioned password file, rather than a command-line literal. Record the result and snapshot ID.

Set Retention Rules and Monitor Backup Jobs

Capture frequency affects the age of the latest usable recovery point. Failed or incomplete transfers can leave you with an older remote copy. Backup retention determines how far back you can search when someone discovers an old mistake. A nightly copy overwritten each morning provides little history.

For the illustrative 24-hour RPO, schedule captures often enough to leave time for transfer, alerts, and retries. One possible retention policy keeps 14 daily recovery points, eight weekly points, and six monthly points. Adjust it to the cost of losing data and how long errors might remain unnoticed.

Watch the age of the last complete remote backup, exit status, repository capacity, and unexpected changes in backup size. Send alerts somewhere that remains available during a production outage. Alert on missed runs, too: a dead server cannot report its own failure.

In restic, forget removes selected snapshots from history; prune removes data no retained snapshot needs. Preview retention changes with forget –dry-run and review the selection before deletion. Allow maintenance time and storage headroom. Deduplication means deleted snapshots don’t necessarily free the amount of space you expect.

Test a Full Restore on a Clean Server

Start with a fresh, isolated machine and the recovery instructions. If the exercise depends on opening a file on production, the instructions are incomplete.

Retrieve a chosen snapshot into a separate restore directory. Recreate the required PostgreSQL environment, restore the database export with the appropriate tool, and install the recorded application release. Restore uploads, configuration, permissions, and necessary secrets. Account for database roles and extensions rather than assuming the dump includes everything.

Disable real payments, outbound customer email, webhooks, and dangerous scheduled jobs before starting the restored application. Test login, existing records, file downloads, a new upload, and a database write. Check relationships too: can a record that references an attachment actually retrieve it?

Measure the whole exercise, including provisioning, download, restoration, and validation. Compare it with the RTO and record where time went. A monthly drill might suit this example; repeat it after substantial deployment, storage, or database changes.

Repository integrity checks belong in routine maintenance, but they answer a narrower question. restic check checks repository structures; reading stored data requires additional options. Neither proves that your application starts or that its files match its database.

Check the Provider and Document the Recovery Plan

Before committing, confirm physical placement, account separation, support access, data export, and relevant service terms. Verify any deletion protection you depend on. Provider redundancy can help keep storage running, but it doesn’t establish an independently recoverable history for your application.

Keep a short recovery checklist outside production:

  • What: database, uploads, configuration, release, and dependencies.
  • Where: repository location and the required recovery point.
  • Access: credentials, decryption password, and account recovery steps.
  • Owner: the person responsible and someone who can substitute.
  • Validation: functional checks, measured restore time, and known gaps.

A colleague should be able to follow that checklist from a clean machine. The next restore exercise will show which steps still rely on someone’s memory.

Author Profile

Jake Hodges
Jake Hodges
Jake contributes to MarkMeets, creating informative and enjoyable content

Leave a Reply