> For the complete documentation index, see [llms.txt](https://docs.hivel.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hivel.ai/archive/generic/hivel-on-premises-deployment-guide-generic/12.-backup-and-restore.md).

# 12. Backup and Restore

**What must be backed up:** the PostgreSQL "insightly" database - this is where all Hivel data lives; there is no separate object store to back up.

**Recommended approach:**

If you're using a managed PostgreSQL service (RDS, Azure Database for PostgreSQL, Cloud SQL), you can rely on your provider's native automated backup/snapshot feature as an alternative to manual dumps - check your provider's default retention and confirm it meets your requirements. If you're self-hosting PostgreSQL, pg\_dump/pg\_restore is the universal, cloud-agnostic baseline:

```
# Daily dump (cron)
pg_dump -h $DB_HOST -U <root-or-privileged-user> -d insightly -F c -f 
/backups/insightly_$(date +%Y-%m-%d).dump
```

**Recommended cadence:** take a daily backup and retain it for 7 days. This is a starting-point recommendation, not a hard requirement - adjust the frequency and retention window to match your own compliance and operational needs.

**Is it safe to back up a live database?** Yes. pg\_dump takes a transactionally consistent snapshot, so it is safe to run against the live "insightly" database without stopping services or pausing integration polling first.

**Restore sequence:**

1. Stop services that write to the database: `./deploy.sh --stop`
2. Restore: pg\_restore -h $DB\_HOST -U \<root-or-privileged-user> -d insightly -c /backups/insightly\_\<date>.dump
3. Restart services: ./deploy.sh --start
4. Re-run the permissions reevaluation endpoint so permissions are re-derived against the restored data - substitute \<base-url> with your deployment's actual API base URL:

```
curl --location --request DELETE '<base-url>/hivelapi/v1/permissions/reevaluate?orgId=1'
```

5. Validate using the Validation Checklist in Verification and Access.

Next step: [Upgrade and Rollback](/archive/generic/hivel-on-premises-deployment-guide-generic/13.-upgrade-and-rollback.md), or back to [Support and Summary](/self-managed-hivel-deployment/virtual-private-cloud/aws/hivel-on-premises-deployment-guide-aws/support-and-summary.md) if you're closing out a routine operation.

<br>

{% columns %}
{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/11.-troubleshooting.md" class="button primary" data-icon="backward">Troubleshooting</a>
{% endcolumn %}

{% column %}

{% endcolumn %}

{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/13.-upgrade-and-rollback.md" class="button primary" data-icon="forward">Upgrade and Rollback</a>
{% endcolumn %}
{% endcolumns %}
