forked from kartoza/docker-pg-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ARCHIVE_FILENAME parameters to specify fixed filename (kartoza#11) * Add ARCHIVE_FILENAME parameters to specify fixed filename * Update travis.yml for latest changes * Edit README.md to reflect the changes * Edit docker-compose.yml for latest update * Add restore script
- Loading branch information
Showing
10 changed files
with
130 additions
and
17 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 @@ | ||
.gitignore |
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,3 @@ | ||
.idea | ||
backups | ||
docker-compose.override.yml |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
FROM kartoza/postgis:10.0-2.4 | ||
MAINTAINER [email protected] | ||
|
||
RUN apt-get install -y postgresql-client | ||
RUN apt-get -y update; apt-get install -y postgresql-client | ||
ADD backups-cron /etc/cron.d/backups-cron | ||
RUN touch /var/log/cron.log | ||
ADD backups.sh /backups.sh | ||
ADD restore.sh /restore.sh | ||
ADD start.sh /start.sh | ||
|
||
|
||
ENTRYPOINT [] | ||
CMD ["/start.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
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,12 @@ | ||
# This is for testing on travis only | ||
# For production we recommend to rather use | ||
# image: kartoza/pg-backup | ||
# in the dbbackup service | ||
dbbackup: | ||
environment: | ||
# Postgres environment variable | ||
# Can be set to execute PG tools directly | ||
- PGHOST=db | ||
- PGUSER=docker | ||
- PGPASSWORD=docker | ||
- PGPORT=5432 |
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,31 @@ | ||
#!/bin/bash | ||
|
||
source /pgenv.sh | ||
|
||
echo "TARGET_DB: ${TARGET_DB}" | ||
echo "WITH_POSTGIS: ${WITH_POSTGIS}" | ||
echo "TARGET_ARCHIVE: ${TARGET_ARCHIVE}" | ||
|
||
if [ -z "${TARGET_ARCHIVE:-}" ] || [ ! -f "${TARGET_ARCHIVE:-}" ]; then | ||
echo "TARGET_ARCHIVE needed." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${TARGET_DB:-}" ]; then | ||
echo "TARGET_DB needed." | ||
exit 1 | ||
fi | ||
|
||
echo "Dropping target DB" | ||
dropdb ${TARGET_DB} | ||
|
||
if [ -z "${WITH_POSTGIS:-}" ]; then | ||
echo "Recreate target DB without POSTGIS" | ||
createdb -O ${PGUSER} ${TARGET_DB} | ||
else | ||
echo "Recreate target DB with POSTGIS" | ||
createdb -O ${PGUSER} -T template_postgis ${TARGET_DB} | ||
fi | ||
|
||
echo "Restoring dump file" | ||
pg_restore ${TARGET_ARCHIVE} | psql -d ${TARGET_DB} |
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