27 lines
543 B
Bash
Executable File
27 lines
543 B
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Run this script as root inside a service directory.
|
|
# The backup have to be in the same directory.
|
|
#
|
|
|
|
# Extract the archive into volumes directory
|
|
BACKUP=${PWD##*/}.tar.zst
|
|
if [ -d "volumes" ]; then
|
|
rm -r volumes
|
|
fi
|
|
mkdir volumes
|
|
tar --zstd --same-owner -xvf $BACKUP -C volumes
|
|
|
|
# Start the service and populate db from sql file if needed
|
|
if [ -f "compose.db-restore.yml" ]
|
|
then
|
|
docker compose -f compose.yml -f compose.db-restore.yml up -d
|
|
else
|
|
docker compose up -d
|
|
fi
|
|
|
|
# Clean backup files
|
|
rm $BACKUP
|
|
rm volumes/*.sql
|