mirror of
https://github.com/Cian-H/iform-invenio.git
synced 2026-08-16 16:32:50 +01:00
migrate db back to postgres:14 and manually add wal-g automated incremental backups
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
FROM postgres:14.13
|
||||
|
||||
RUN apt-get update && apt-get install -y curl cron && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -L "https://github.com/wal-g/wal-g/releases/download/v3.0.8/wal-g-pg-ubuntu-20.04-amd64.tar.gz" | tar -xz && \
|
||||
mv wal-g-pg-ubuntu-20.04-amd64 /usr/local/bin/wal-g && \
|
||||
chmod +x /usr/local/bin/wal-g
|
||||
|
||||
COPY setup-walg.sh /docker-entrypoint-initdb.d/
|
||||
COPY entrypoint-wrapper.sh /usr/local/bin/
|
||||
COPY walg-cron /etc/cron.d/walg-cron
|
||||
|
||||
RUN chmod +x /usr/local/bin/entrypoint-wrapper.sh && \
|
||||
chmod +x /docker-entrypoint-initdb.d/setup-walg.sh && \
|
||||
chmod 0644 /etc/cron.d/walg-cron && \
|
||||
crontab /etc/cron.d/walg-cron
|
||||
|
||||
ENTRYPOINT ["entrypoint-wrapper.sh"]
|
||||
CMD ["postgres"]
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Start the cron service in the background
|
||||
service cron start
|
||||
|
||||
# Pass execution back to the official postgres entrypoint
|
||||
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Configure postgres to archive WAL logs via wal-g
|
||||
echo "archive_mode = on" >> "$PGDATA/postgresql.conf"
|
||||
echo "archive_command = 'wal-g wal-push %p'" >> "$PGDATA/postgresql.conf"
|
||||
echo "archive_timeout = 60" >> "$PGDATA/postgresql.conf"
|
||||
@@ -0,0 +1 @@
|
||||
0 2 * * * postgres /usr/local/bin/wal-g backup-push /var/lib/postgresql/data > /proc/1/fd/1 2>&1
|
||||
Reference in New Issue
Block a user