-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM openemr/mysql-xtrabackup:1.0.7 | ||
|
||
RUN rm /root/xbackup-wrapper.sh /root/xrecovery-final.sh | ||
COPY xbackup-wrapper.sh xrecovery-final.sh /root/ | ||
RUN chmod a+x /root/*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
exec > /tmp/xtrabackup-launch.log 2>&1 | ||
|
||
cd /root | ||
|
||
# if you recover into a clean system, initial xbackup.sh init was run back then and should not repeat | ||
if [ -f restore-process-complete ]; then | ||
if [ ! -f xtrabackup.database.txt ]; then | ||
echo openemr > xtrabackup.database.txt | ||
chmod 600 xtrabackup.database.txt | ||
fi | ||
touch allsetup.ok | ||
rm restore-process-complete | ||
fi | ||
|
||
if [ ! -f allsetup.ok ]; then | ||
./xbackup.sh -u openemr -a && ./xbackup.sh -t full && touch allsetup.ok && exit 0 | ||
exit 1 | ||
fi | ||
|
||
if [ -f force-full-backup ]; then | ||
rm force-full-backup | ||
./xbackup.sh -t full | ||
exit $? | ||
fi | ||
|
||
# I don't like forcing it like this, but if the backup fails one day, we need to try it the next | ||
# here's the problem: manual run during an automated run will cause destruction and havoc and woe | ||
if [ $(date +%u) == 7 ]; then | ||
./xbackup.sh -t full -f | ||
else | ||
./xbackup.sh -t incr -f | ||
fi; | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
WORKDIR=/mnt/backups/recovery | ||
|
||
if service mysql status; then | ||
echo xrecovery-final: mysql must not be running, yet it is; aborting | ||
exit 1 | ||
fi | ||
|
||
# Even though MySQL isn't running, I can't just make off with /var/lib/mysql, | ||
# since the container mounts it. | ||
|
||
chown -R mysql:mysql $WORKDIR | ||
rm -rf /mnt/backups/prerecovery-mysql-datadir | ||
echo Copying prerecovery state... | ||
mkdir /mnt/backups/prerecovery-mysql-datadir | ||
mv /var/lib/mysql/* /mnt/backups/prerecovery-mysql-datadir | ||
echo Moving restored database into position... | ||
mv -v $WORKDIR/* /var/lib/mysql | ||
echo Done, continuing... | ||
rm -f /root/pending-restore | ||
touch /root/force-full-backup | ||
touch /root/restore-process-complete | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters