-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
e2e800d
commit 2aa22ce
Showing
5 changed files
with
32 additions
and
5 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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
FROM alexbabel/s3backup:0.11.2 | ||
|
||
RUN apk add --no-cache mongodb-tools postgresql-client | ||
RUN apk add --no-cache mongodb-tools postgresql-client mysql-client python3 bash && rm -f /var/cache/apk/* | ||
|
||
COPY mongodb.sh /usr/bin/mongodb.sh | ||
COPY postgresql.sh /usr/bin/postgresql.sh | ||
COPY mysql.sh /usr/bin/mysql.sh | ||
COPY mysql-cmd.py /usr/bin/mysql-cmd.py | ||
|
||
CMD /usr/bin/mongodb.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
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,9 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
from urllib.parse import urlparse | ||
|
||
uri = os.getenv('DATABASE_URL') | ||
result = urlparse(uri) | ||
|
||
print(f"/usr/bin/mysqldump -u {result.username} -p {result.password} -d {(result.path or '').replace('/', '')} {result.hostname}:{result.port if result.port else 3306}") |
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,16 @@ | ||
#!/bin/bash | ||
|
||
# # Backup directory | ||
DEST=/backup | ||
|
||
# Create backup dir (-p to avoid warning if already exists) | ||
/bin/mkdir -p "$DEST" | ||
|
||
# Log | ||
echo "Backing up mysql" | ||
|
||
# Dump from postgresql host into backup directory | ||
eval "$(python3 /usr/bin/mysql-cmd.py)" | ||
|
||
# Run dokku backup script | ||
/usr/bin/backup.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