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

# Maintenance

🧼 Some utilities and good practices to keep your isabl instance data safe

## Database backups&#x20;

The [cookiecutter-api](https://github.com/papaemmelab/cookiecutter-api) comes with some handy utilities to manage postgres backups, that you can inspect in your project code directory (`compose/production/postgres/maintenance`):

**1. To create a backup:**

```bash
docker-compose -f <environment>.yml (exec |run --rm) postgres backup
```

**2. To list/view current backups:**

```bash
docker-compose -f <environment>.yml (exec |run --rm) postgres backups
```

**3. To restore a backup:**

```bash
docker-compose -f <environment>.yml (exec |run --rm) postgres restore
```

{% hint style="warning" %}
It's a good practice to run your `backup` script regularly. For example, adding it to a cron job that runs periodically (i.e. every month, or every week)
{% endhint %}

## Backup to Amazon S3

After this [commit](https://github.com/papaemmelab/cookiecutter-api/commit/c379dab5344491bceaebaa74257352edaec83f70) in `cookiecutter-api`, you can store backups in the cloud in Amazon S3.  \
\
You need to add these 3 environment variables in your `.envs/.production/.django` file:

```bash
export DJANGO_AWS_ACCESS_KEY_ID=
export DJANGO_AWS_SECRET_ACCESS_KEY=
export DJANGO_AWS_STORAGE_BUCKET_NAME=
```

**4. Upload recursively all the database backups to your AWS S3 bucket**

```bash
docker-compose -f production.yml run --rm awscli upload
```

**5. Download a specific backup to your instance docker volume**

```bash
docker-compose -f production.yml run --rm awscli download backup_2018_03_13T09_05_07.sql.gz
```

Learn more at [cookicutter-django docs](#backup-to-amazon-s3).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.isabl.io/maintenance.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
