This commit is contained in:
parent
505d6d4d44
commit
5f8248d236
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
||||
!mysql.sh
|
||||
!.dockerignore
|
||||
!restore.sh
|
||||
!entrypoint.sh
|
||||
|
@ -4,14 +4,14 @@ RUN apk add --no-cache mysql-client rclone bash fuse postgresql-client
|
||||
|
||||
RUN mkdir /app && mkdir /config
|
||||
|
||||
COPY entrypoint.sh /app/entrypoint.sh
|
||||
COPY setup.sh /app/setup.sh
|
||||
COPY backup.sh /app/backup.sh
|
||||
COPY interactive.sh /app/interactive.sh
|
||||
COPY restore.sh /app/restore.sh
|
||||
# COPY mysql.sh /app/mysql.sh
|
||||
|
||||
WORKDIR /config
|
||||
|
||||
VOLUME /config
|
||||
|
||||
ENTRYPOINT [ "/app/backup.sh" ]
|
||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
|
@ -61,5 +61,6 @@ docker run \
|
||||
--network "dbNet" \
|
||||
-v "/var/docker/backup:/config" \
|
||||
$BACKUP_VOL \
|
||||
djeeberjr/backup
|
||||
djeeberjr/backup \
|
||||
backup
|
||||
```
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
. /app/setup.sh
|
||||
|
||||
mkdir -p /backup/sqlDump
|
||||
|
||||
for db in $(echo "$MYSQL_DUMP_DB" | sed 's/,/\n/g')
|
||||
|
42
entrypoint.sh
Executable file
42
entrypoint.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
COMMAND="$1"
|
||||
|
||||
# print usage if no command is given
|
||||
if [ -z "$COMMAND" ]; then
|
||||
echo "Usage: $0 <command>"
|
||||
echo "Available commands:"
|
||||
echo " backup"
|
||||
echo " restore"
|
||||
echo " init TODO"
|
||||
echo " interactive"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. /app/setup.sh
|
||||
|
||||
case "$COMMAND" in
|
||||
backup)
|
||||
# backup
|
||||
/app/backup.sh
|
||||
;;
|
||||
restore)
|
||||
# restore
|
||||
/app/restore.sh
|
||||
;;
|
||||
init)
|
||||
# init
|
||||
# TODO: implement
|
||||
/app/init.sh
|
||||
;;
|
||||
interactive)
|
||||
# interactive
|
||||
/app/interactive.sh
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: $COMMAND"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /app/setup.sh
|
||||
|
||||
mkdir -p /restore
|
||||
|
||||
echo "### Interactive mode ###"
|
||||
@ -12,7 +10,7 @@ echo "########################"
|
||||
echo "rclone config # edit/add remote"
|
||||
echo "restic init # create new repo"
|
||||
echo "restic snapshots # list backups"
|
||||
echo "restic -restore latest --target /restore # restore latest backup to /restore"
|
||||
echo "restic restore latest --target /restore # restore latest backup to /restore"
|
||||
echo "restic dump latest /backup/sqlDump/dbname.sql # Dump sql dump to console"
|
||||
echo "/app/backup.sh # Create backup"
|
||||
echo "/app/mysql.sh # Open mysql client"
|
||||
|
10
restore.sh
10
restore.sh
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /app/setup.sh
|
||||
VOLUMES=$(find /backup -maxdepth 1 -type d -printf '%f\n' | tail -n +2)
|
||||
|
||||
#loop volumes
|
||||
for VOLUME in $VOLUMES; do
|
||||
echo "Restoring $VOLUME"
|
||||
restic -v restore latest --include "/backup/$VOLUME"
|
||||
done
|
||||
|
||||
# find . -maxdepth 1 -type d -printf '%f\n' | tail -n +2
|
||||
|
||||
restic restore latest
|
||||
|
Loading…
Reference in New Issue
Block a user