# Backup and Restore

## Backing Up Sherpa Orchestrator (Docker)

Instructions for creating a backup of the configuration and database in the Docker version of Sherpa Orchestrator.

### 1. Preparation

Open a terminal on the server and navigate to the project installation directory.

```
cd /opt/SherpaOrchestrator
```

It is recommended to create a separate folder for the backup with the current date.

```
BACKUP_DIR=./backup_$(date +%Y%m%d_%H%M%S)
mkdir -p "$BACKUP_DIR"
```

### 2. Copying the .env File

Copy the environment variables file.

```
cp ./.env "$BACKUP_DIR"/.env
```

### 3. Copying backend/config Settings

Copy the backend configuration folder.

```
cp -r ./backend/config "$BACKUP_DIR"/backend_config
```

By default, the absolute path to this directory is:

* /opt/SherpaOrchestrator/backend/config

### 4. Copying nginx/config

Copy the nginx configuration.

```
cp -r ./nginx/config "$BACKUP_DIR"/nginx_config
```

### 5. Creating a MariaDB Database Dump

If the MariaDB profile is used, create a dump inside the container and copy it to the host.

```
docker exec orchestrator-db sh -c 'mysqldump -u root --max-allowed-packet=1G --single-transaction orchestrator > /orchestrator_db_dump.sql'
```

If the standard database credentials have been changed, use your own login and password.

```
docker exec -it orchestrator-db sh
mysqldump -u your_login -p --max-allowed-packet=1G --single-transaction orchestrator > /orchestrator_db_dump.sql
exit
```

Copy the dump to the host machine.

```
docker cp orchestrator-db:/orchestrator_db_dump.sql "$BACKUP_DIR"/orchestrator_mariadb_dump.sql
```

### 6. Creating a PostgreSQL Database Dump

If the PostgreSQL profile is used, create a dump inside the container and copy it to the host.

```
docker exec orchestrator-pg sh -c 'PGPASSWORD=$POSTGRES_PASSWORD pg_dump -U postgres -d orchestrator -Fc -f /orchestrator_pg_dump.dump'
```

If different credentials are used, specify your user and the required database.

```
docker exec -it orchestrator-pg sh
export PGPASSWORD=your_password
pg_dump -U your_login -d orchestrator -Fc -f /orchestrator_pg_dump.dump
exit
```

Copy the dump to the host machine.

```
docker cp orchestrator-pg:/orchestrator_pg_dump.dump "$BACKUP_DIR"/orchestrator_postgres_dump.dump
```

### 7. Verifying Backup Contents

Check that the backup directory contains:

* .env file
* backend\_config directory
* nginx\_config directory
* MariaDB dump or PostgreSQL dump (depending on the database profile used)

Example verification:

```
ls -la "$BACKUP_DIR"
```


---

# Agent Instructions: 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:

```
GET https://docs.sherparpa.ru/en/sherpa-rpa/sherpa-orchestrator/rezervnoe-kopirovanie-i-vosstanovlenie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
