# Backup & Recover of the Akamas Server

### Akamas server backup <a href="#backup-and-recoveroftheakamasserver-akamasserverbackup" id="backup-and-recoveroftheakamasserver-akamasserverbackup"></a>

The process of backing up an Akamas server can be divided in two parts: **system backup** and **user data backup**. Backup can be performed in any way you see fit: they're just regular files so you can use any backup tool.

#### System backup <a href="#backup-and-recoveroftheakamasserver-systembackup" id="backup-and-recoveroftheakamasserver-systembackup"></a>

System services are hosted on AWS ECR repo so the only thing that fully defines a working Akamas application is the docker-compose.yml file. Performing a backup of the Akamas application is as simple as copying this single file to your backup location. you may schedule any script that performs this weekly or at any frequency you see fit

#### User data backup <a href="#backup-and-recoveroftheakamasserver-userdatabackup" id="backup-and-recoveroftheakamasserver-userdatabackup"></a>

You may list all existing Akamas studies via the Akamas CLI command:

```bash
akamas list study
```

Then you can export all existing studies one by one via the CLI command

```bash
akamas export study <UUID>
```

where UUID is the UUID of a single study. This command exports into a single archive file (tar.gz). These archive files can be backed up to your favorite backup folder.

### Akamas server recovery <a href="#backup-and-recoveroftheakamasserver-akamasserverrecovery" id="backup-and-recoveroftheakamasserver-akamasserverrecovery"></a>

Akamas server recovery involves recovering the system backup, restarting the Akamas service then re-importing the studies.

#### System Restore <a href="#backup-and-recoveroftheakamasserver-systemrestore" id="backup-and-recoveroftheakamasserver-systemrestore"></a>

To restore the system you must recover the original `docker-compose.yml` then launch the command

```bash
docker compose up &
```

from the folder where you placed this YAML file and then wait for the system to come up, by checking it with the command

```bash
akamas status -d
```

#### User data restore <a href="#backup-and-recoveroftheakamasserver-userdatarestore" id="backup-and-recoveroftheakamasserver-userdatarestore"></a>

All studies can be re-imported singularly with the CLI command (referring to the correct pathname of the archive):

```bash
akamas import study archive.tgz
```
