This commit is contained in:
parent
505d6d4d44
commit
5f8248d236
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
|||||||
!mysql.sh
|
!mysql.sh
|
||||||
!.dockerignore
|
!.dockerignore
|
||||||
!restore.sh
|
!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
|
RUN mkdir /app && mkdir /config
|
||||||
|
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
COPY setup.sh /app/setup.sh
|
COPY setup.sh /app/setup.sh
|
||||||
COPY backup.sh /app/backup.sh
|
COPY backup.sh /app/backup.sh
|
||||||
COPY interactive.sh /app/interactive.sh
|
COPY interactive.sh /app/interactive.sh
|
||||||
COPY restore.sh /app/restore.sh
|
COPY restore.sh /app/restore.sh
|
||||||
# COPY mysql.sh /app/mysql.sh
|
|
||||||
|
|
||||||
WORKDIR /config
|
WORKDIR /config
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|
||||||
ENTRYPOINT [ "/app/backup.sh" ]
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
|
@ -61,5 +61,6 @@ docker run \
|
|||||||
--network "dbNet" \
|
--network "dbNet" \
|
||||||
-v "/var/docker/backup:/config" \
|
-v "/var/docker/backup:/config" \
|
||||||
$BACKUP_VOL \
|
$BACKUP_VOL \
|
||||||
djeeberjr/backup
|
djeeberjr/backup \
|
||||||
|
backup
|
||||||
```
|
```
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. /app/setup.sh
|
|
||||||
|
|
||||||
mkdir -p /backup/sqlDump
|
mkdir -p /backup/sqlDump
|
||||||
|
|
||||||
for db in $(echo "$MYSQL_DUMP_DB" | sed 's/,/\n/g')
|
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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
. /app/setup.sh
|
|
||||||
|
|
||||||
mkdir -p /restore
|
mkdir -p /restore
|
||||||
|
|
||||||
echo "### Interactive mode ###"
|
echo "### Interactive mode ###"
|
||||||
@ -12,7 +10,7 @@ echo "########################"
|
|||||||
echo "rclone config # edit/add remote"
|
echo "rclone config # edit/add remote"
|
||||||
echo "restic init # create new repo"
|
echo "restic init # create new repo"
|
||||||
echo "restic snapshots # list backups"
|
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 "restic dump latest /backup/sqlDump/dbname.sql # Dump sql dump to console"
|
||||||
echo "/app/backup.sh # Create backup"
|
echo "/app/backup.sh # Create backup"
|
||||||
echo "/app/mysql.sh # Open mysql client"
|
echo "/app/mysql.sh # Open mysql client"
|
||||||
|
10
restore.sh
10
restore.sh
@ -1,7 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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