Backup & Restore

Last updated 2 min read
Report issue

Backup and Restore Procedures for GritivaCore#

This document outlines the backup and restore procedures specific to GritivaCore deployments. It is crucial to understand the distinct components that require backup and the methods to restore them effectively.

Backup Types#

GritivaCore deployments require three distinct types of backups:

  1. Hosted Control Plane Data: Managed by Gritiva, this data is stored in Postgres on Hetzner with a 30-day retention policy, encrypted at rest, and backed up daily.
  2. Per-VM Agent State: This includes the configuration file located at /etc/gritiva/agent.toml and the state stored in /var/lib/gritiva/. This data is small and should be backed up using a cron job with rsync.
  3. Scope Contents: This is your application data within each scope's network namespace. It is your responsibility to back this up.

Backup Procedure#

Step 1: Preparation#

  • Ensure you have the necessary permissions and access to the GritivaCore environment.
  • Set up a cron job for backing up the per-VM agent state:
    BASH
    tar czf /root/backups/gritiva-$(date +%Y%m%d).tgz /etc/gritiva /var/lib/gritiva

Step 2: Execution#

  • For scope contents, use the following command pattern:
    BASH
    gritivactl scope exec <scope> -- tar czf ...
  • For databases, prefer using pg_dump or mysqldump over filesystem-level tar.

Restore Procedure#

To restore from a backup, execute the following commands:

BASH
 tar xzf /root/backups/gritiva-2026-05-14.tgz -C /
 sudo systemctl restart gritiva-agent

If you lose an entire VM, install the agent on a new VM, untar the backups, and the agent will re-enroll and recognize the old scope state.

RPO/RTO Targets#

  • Recovery Point Objective (RPO): 24 hours with daily backups.
  • Recovery Time Objective (RTO): 30 minutes, following the documented restore steps.

Disaster Recovery#

For detailed disaster recovery procedures, refer to the Disaster Recovery Documentation.

Troubleshooting#

Common issues may arise during backup and restore processes. Ensure that:

  • The cron job is correctly set up and running.
  • Permissions are correctly configured for accessing backup files.
  • The Gritiva agent is properly restarted after restoration.

Best Practices#

  • Regularly schedule backups to ensure data integrity.
  • Cross-reference with existing documentation on data retention policies.
  • Use clear language and avoid jargon in procedures.

Open Questions

Open Questions
Are there any additional troubleshooting tips or common issues that should be documented?