Backup and restore

IMPORTANT
If you are using an external database, you will need to make additional backups and restores on the side of that database.

The backup and recovery method depends on the data storage type used: bind mount or named volume.

NOTE
The backup and recovery procedure can also be used to migrate ADCM data between storage types — from a bind mount to a named volume or vice versa.

Backup

Bind mount

To perform a backup when using a bind mount, follow these steps:

  1. Stop the ADCM container:

    $ sudo docker stop adcm
  2. Go to the directory on the host used for ADCM data storage (default is /opt/adcm):

    $ cd /opt/adcm
  3. Create a backup of the data directory. The backup will be saved in the current user’s home directory:

    $ sudo tar czvf ~/backup.tar.gz .
  4. Start the ADCM container:

    $ sudo docker start adcm

Named volume

To perform a backup when using a named volume, follow these steps:

  1. Stop the ADCM container:

    $ sudo docker stop adcm
  2. Create a data archive from the volume using a temporary container (the example uses the adcm-data volume):

    $ sudo docker run --rm \
        -v adcm-data:/adcm/data \
        -v ~:/backup \
        alpine \
        tar czvf /backup/backup.tar.gz -C /adcm/data .
  3. Start the ADCM container:

    $ sudo docker start adcm

Restore

Bind mount

To perform a restore when using a bind mount, follow these steps:

  1. Stop the ADCM container:

    $ sudo docker stop adcm
  2. Create a new directory on the host:

    $ sudo mkdir /opt/adcm-restored
  3. Go to the created directory:

    $ cd /opt/adcm-restored
  4. Restore data from the previously created backup:

    $ sudo tar xvf ~/backup.tar.gz
  5. Remove the current ADCM container:

    $ sudo docker container rm adcm
  6. Ensure that the directory containing the restored data is owned by the 10001:10001 user. If necessary, change the owner:

    $ sudo chown -R 10001:10001 /opt/adcm-restored
    NOTE

    If you do not need to reuse the adcm container name, you can skip the current step and use another container name instead of adcm in the next steps.

  7. Create a new ADCM container using the same startup parameters as the original container. Specify the /opt/adcm-restored directory instead of /opt/adcm:

    $ sudo docker create \
        --name adcm \
        -p 8000:8000 \
        -v /opt/adcm-restored:/adcm/data \
        -e DB_HOST="<DATABASE_HOSTNAME_OR_IP_ADDRESS>" \
        -e DB_PORT="<DATABASE_TCP_PORT>" \
        -e DB_USER="<DATABASE_USERNAME>" \
        -e DB_NAME="<DATABASE_NAME>" \
        -e DB_PASS="<DATABASE_USER_PASSWORD>" \
        hub.arenadata.io/adcm/adcm:<version>

    where <version> is the desired ADCM image version. You can use a version number equal to or greater than the ADCM version for which the backup was created. It is not recommended to upgrade ADCM by more than five minor versions. ADCM downgrade is not supported. For more information, see Upgrade.

  8. Start the new ADCM container:

    $ sudo docker start adcm

Named volume

To perform a restore when using a named volume, follow these steps:

  1. Stop the ADCM container:

    $ sudo docker stop adcm
  2. Remove the existing container:

    $ sudo docker container rm adcm
  3. Remove the existing named volume and create a new one to restore the data:

    $ sudo docker volume rm adcm-data
    $ sudo docker volume create adcm-data
  4. Extract the backup archive into the new volume using a temporary container:

    $ sudo docker run --rm \
        -v adcm-data:/adcm/data \
        -v ~:/backup \
        alpine \
        tar xvf /backup/backup.tar.gz -C /adcm/data
  5. Create a new ADCM container with the same startup parameters, specifying the adcm-data volume:

    $ sudo docker create \
        --name adcm \
        -p 8000:8000 \
        -v adcm-data:/adcm/data \
        -e DB_HOST="<DATABASE_HOSTNAME_OR_IP_ADDRESS>" \
        -e DB_PORT="<DATABASE_TCP_PORT>" \
        -e DB_USER="<DATABASE_USERNAME>" \
        -e DB_NAME="<DATABASE_NAME>" \
        -e DB_PASS="<DATABASE_USER_PASSWORD>" \
        hub.arenadata.io/adcm/adcm:<version>

    where <version> is the desired ADCM image version. You can use a version number equal to or greater than the ADCM version for which the backup was created. It is not recommended to upgrade ADCM by more than five minor versions. ADCM downgrade is not supported. For more information, see Upgrade.

  6. Start the new ADCM container:

    $ sudo docker start adcm
Found a mistake? Seleсt text and press Ctrl+Enter to report it