mirror of
https://git.koehn.com/docker/postgres-wal-g.git
synced 2026-11-25 09:43:20 -06:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdb7f1c6bf | ||
|
|
6e75b71775 | ||
|
|
80706a20c7 | ||
|
|
1ca880cf44 | ||
|
|
b66f2886bb | ||
|
|
55b02b6caa | ||
|
|
3160eaf1b6 | ||
|
|
ae5912f70f | ||
|
|
f648887066 | ||
|
|
4a4d87ba5d | ||
|
|
7fa04795a8 | ||
|
|
89f76bb78b | ||
|
|
642632c60c | ||
|
|
f301fad22e | ||
|
|
365ef7da9f | ||
|
|
ceb542e680 | ||
|
|
83459c3eee | ||
|
|
e3cee34644 | ||
|
|
6ce0b371be | ||
|
|
f92168528e | ||
|
|
10af957331 | ||
|
|
d8e1e1f39b | ||
|
|
56aa0e2ca2 | ||
|
|
30f3363b8e | ||
|
|
72c13d458e | ||
|
|
6f6dd9bca6 | ||
|
|
fc6bb76110 | ||
|
|
d3feaff8e1 | ||
|
|
e779a43c2f | ||
|
|
cc2096c4b9 | ||
|
|
a554117ba1 | ||
|
|
a08e138569 | ||
|
|
18b0d9b0ee | ||
|
|
5b59617f84 |
No files matched your search
+17
-15
@@ -1,25 +1,27 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
build-9.6:
|
||||
build:
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
name: gcr.io/kaniko-project/executor:v1.5.2-debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo "{\"auths\":{\"index.docker.io\":{\"username\":\"$DOCKER_LOGIN\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination koehn/postgres-wal-g:9.6-$CI_COMMIT_TAG --build-arg BASE=9.6
|
||||
only:
|
||||
- tags
|
||||
|
||||
build-11.1:
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo "{\"auths\":{\"index.docker.io\":{\"username\":\"$DOCKER_LOGIN\",\"password\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination koehn/postgres-wal-g:11.1-$CI_COMMIT_TAG --build-arg BASE=11.1
|
||||
- |
|
||||
cat > /kaniko/.docker/config.json <<EOF
|
||||
{
|
||||
"auths": {
|
||||
"https://index.docker.io/v1/": {
|
||||
"auth":"${DOCKER_AUTH}"
|
||||
},
|
||||
"${CI_REGISTRY}": {
|
||||
"username": "${CI_REGISTRY_USER}",
|
||||
"password": "${CI_REGISTRY_PASSWORD}"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination koehn/postgres-wal-g:13.3-$CI_COMMIT_TAG --build-arg BASE=13.3 --build-arg WALG_RELEASE=$(echo $CI_COMMIT_TAG | awk -F '-' '{print $1}')
|
||||
only:
|
||||
- tags
|
||||
|
||||
+4
-2
@@ -2,9 +2,11 @@ ARG BASE
|
||||
|
||||
FROM postgres:$BASE
|
||||
|
||||
ARG WALG_RELEASE=v1.0
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||
apt-get update -qq && \
|
||||
apt-get install -qqy curl ca-certificates vim && \
|
||||
cd /usr/local/bin && curl -L https://github.com/wal-g/wal-g/releases/download/v0.2.2/wal-g.linux-amd64.tar.gz | tar xzf -
|
||||
apt-get install -qqy curl ca-certificates libsodium23 vim && \
|
||||
cd /usr/local/bin && curl -L https://github.com/wal-g/wal-g/releases/download/$WALG_RELEASE/wal-g.linux-amd64.tar.gz | tar xzf -
|
||||
|
||||
COPY wal-g /wal-g
|
||||
@@ -44,5 +44,5 @@ If you start your recovered backup, be sure to turn `archive_mode = off` to avoi
|
||||
pushing additional WAL files to S3!
|
||||
|
||||
## Postgres Versions
|
||||
Currently I build for Postgres 9.6 and Postgres 11. Be advised that 9.6 is the
|
||||
Currently I build for Postgres 13, but you can build for whatever version you'd like. Be advised that 9.6 is the
|
||||
earliest version that WAL-G supports.
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A simple script to push a backup of your database.
|
||||
|
||||
if [ -z ${PGDATA+x} ]; then
|
||||
export PGDATA=/var/lib/postgresql/data/pgsql
|
||||
fi
|
||||
|
||||
@@ -10,6 +10,7 @@ export PG_VERSION=$(ls /usr/lib/postgresql/)
|
||||
|
||||
# disable recovery mode, re-enable remote connections and archive mode
|
||||
mv $PGDATA/pg_hba.conf.orig $PGDATA/pg_hba.conf
|
||||
mv $PGDATA/postgresql.conf.orig $PGDATA/postgresql.conf
|
||||
sed -i -e 's/^archive_mode = off/archive_mode = on/' $PGDATA/postgresql.conf
|
||||
|
||||
cat <<EOF
|
||||
|
||||
+15
-1
@@ -1,5 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Recovery script:
|
||||
# * Calls wal-g to recover the latest database
|
||||
# * Configures postgres to enter recovery mode by:
|
||||
# * 1. Setting signal
|
||||
# * 2. Appending wal-g recovery commands onto postgresql.conf
|
||||
# * 3. Configuring postgres to only allow connections from localhost, preventing concurrent updates
|
||||
# * 4. Disabling archive mode so as not to corrupt S3 backups
|
||||
# * Starts postgres
|
||||
#
|
||||
# When recovery is done, hit ^C and start database using `/docker-entrypoint.sh postgres` and you should be able to connect to the database and verify backups are OK.
|
||||
# If you get an error message, DON'T PANIC! Just read the message and do what it tells you to do.
|
||||
|
||||
if [ $(id -u) == "0" ] ; then
|
||||
echo "this command must be run as the postgres user."
|
||||
exit 1
|
||||
@@ -15,7 +27,9 @@ fi
|
||||
wal-g backup-fetch $PGDATA LATEST
|
||||
|
||||
# enable recovery mode, disable remote connections and archive mode
|
||||
cp /wal-g/recovery.conf $PGDATA/
|
||||
touch $PGDATA/recovery.signal
|
||||
cp $PGDATA/postgresql.conf $PGDATA/postgresql.conf.orig
|
||||
cat /wal-g/recovery.conf >> $PGDATA/postgresql.conf
|
||||
mv $PGDATA/pg_hba.conf $PGDATA/pg_hba.conf.orig
|
||||
cp /wal-g/pg_hba.conf $PGDATA/pg_hba.conf
|
||||
sed -i -e 's/^archive_mode = on/archive_mode = off/' $PGDATA/postgresql.conf
|
||||
|
||||
Reference in new issue
Block a user