#!/bin/bash
set -e

dir_path="$(dirname $BASH_SOURCE)/../config/dumps"
snapshot_path=$1

if [ -z "$snapshot_path" ]; then
    echo "Set the filename of the snapshot as the only argument" && exit 1
fi

mkdir -p $dir_path
gpg -d $snapshot_path  | tar xfJ - -C $dir_path
docker-compose down -v
docker-compose up -d

exit 0
