> For the complete documentation index, see [llms.txt](https://docs.alpha-security.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alpha-security.app/deployment/backups.md).

# Backups

All persistent data lives in PostgreSQL. Back up the database and you've backed up everything that matters.

## Docker Compose

If you're running the production compose file, the database is in the `pgdata` volume. Dump it with:

```bash
docker compose -f docker-compose.prod.yml exec postgres \
  pg_dump -U al alpha > backup_$(date +%Y%m%d).sql
```

To restore:

```bash
docker compose -f docker-compose.prod.yml exec -T postgres \
  psql -U al alpha < backup_20260718.sql
```

## Standalone Postgres

```bash
pg_dump -h localhost -U al alpha > backup_$(date +%Y%m%d).sql
```

## What's covered

The database holds everything: engagements, runs, raw output, parsed entities, the graph, operator accounts, findings, and report data. A database backup is a full backup.

If you're using the S3 object store for large binary artifacts, those are stored outside the database. Back up the S3 bucket (or MinIO data directory) separately.

## Automation

A cron job is the simplest way to automate backups:

```bash
# Daily at 2 AM, keep 30 days
0 2 * * * docker compose -f /path/to/docker-compose.prod.yml exec -T postgres pg_dump -U al alpha | gzip > /backups/alpha_$(date +\%Y\%m\%d).sql.gz
0 3 * * * find /backups -name "alpha_*.sql.gz" -mtime +30 -delete
```

## Testing restores

A backup you've never restored is a backup you don't have. Test it periodically:

```bash
createdb -U al alpha_restore_test
psql -U al alpha_restore_test < backup_20260718.sql
# verify data, then drop it
dropdb -U al alpha_restore_test
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.alpha-security.app/deployment/backups.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
