Backup / restore in Docker Swarm

This page describes backup and recovery procedures for OpenIAM in docker swarm. There are several critical components that need to be backed up in order for OpenIAM to function in case of a disaster recovery

  1. Database.
  2. Elasticsearch
  3. Vault (data, certificates, jks file)
  4. Connector data
  5. Workflow files
  6. Groovy files.
  7. Reverse proxy (ssl certificate data)

Backup

Database

If you are using OpenIAM's MariaDB or PostgreSQL database, then you can back them up like so:

MariaDB
cd /var/lib/docker/volumes/openiam-mysql-storage_storage/
tar -cvf /tmp/openiam-mysql-storage_storage.tar *
PostgreSQL
cd /var/lib/docker/volumes/openiam-postgres-storage_storage/
tar -cvf /tmp/openiam-postgres-storage_storage.tar *

If you are using your own hosted database, then it is up to the DBA to figure out a reliable backup strategy

Elasticsearch

cd /var/lib/docker/volumes/openiam-elasticsearch-storage_storage/
tar -cvf /tmp/openiam-elasticsearch-storage_storage.tar *

Vault

cd /var/lib/docker/volumes/etcd_storage/
tar -cvf /tmp/etcd_storage.tar *
cd /var/lib/docker/volumes/vault_client_storage/
tar -cvf /tmp/vault_client_storage.tar *
cd /var/lib/docker/volumes/vault_seal_storage/
tar -cvf /tmp/vault_seal_storage.tar *
cd /var/lib/docker/volumes/vault_server_storage/
tar -cvf /tmp/vault_server_storage.tar *

Connector Data

cd /var/lib/docker/volumes/connector_data_storage/
tar -cvf /tmp/connector_data_storage.tar *

Workflow Data

cd /var/lib/docker/volumes/openiam-activiti-storage_storage/
tar -cvf /tmp/openiam-activiti-storage_storage.tar *

Groovy Files

cd /var/lib/docker/volumes/openiam-iamscripts-storage_storage/
tar -cvf /tmp/openiam-iamscripts-storage_storage.tar *

Restoring Data

If you are using OpenIAM's mariadb or postgres database, then you can restore them using the tar files generated above.

MariaDB
tar -xvf openiam-mysql-storage_storage.tar -C /var/lib/docker/volumes/openiam-mysql-storage_storage/
PostgreSQL
tar -xvf openiam-postgres-storage_storage.tar -C /var/lib/docker/volumes/openiam-postgres-storage_storage/

If you are using your own hosted database, then it is up to the DBA to restore backups

Elasticsearch

tar -xvf openiam-elasticsearch-storage_storage.tar -C /var/lib/docker/volumes/openiam-elasticsearch-storage_storage/

Vault

tar -xvf etcd_storage.tar -C /var/lib/docker/volumes/etcd_storage/
tar -xvf vault_client_storage.tar -C /var/lib/docker/volumes/vault_client_storage/
tar -xvf vault_seal_storage.tar -C /var/lib/docker/volumes/vault_seal_storage/
tar -xvf vault_server_storage.tar -C /var/lib/docker/volumes/vault_server_storage/

Connector Data

tar -xvf connector_data_storage.tar -C /var/lib/docker/volumes/connector_data_storage/

Workflow Data

tar -xvf openiam-activiti-storage_storage.tar -C /var/lib/docker/volumes/openiam-activiti-storage_storage/

Groovy Files

tar -xvf openiam-iamscripts-storage_storage.tar -C /var/lib/docker/volumes/openiam-iamscripts-storage_storage/