mirror of
https://git.koehn.com/docker/postgres-wal-g.git
synced 2026-11-25 17:43:20 -06:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b3cd141cb | ||
|
|
2f6dc3a509 | ||
|
|
21c53dc4dd | ||
|
|
f2ef1c9d00 | ||
|
|
4b02d05230 | ||
|
|
2d1dea3953 | ||
|
|
7936f2a660 | ||
|
|
f884fca8d3 | ||
|
|
808d390383 | ||
|
|
888a8e06bf | ||
|
|
8e6481be9b | ||
|
|
bd622797b1 | ||
|
|
d18b5088ad | ||
|
|
c030b76a4c | ||
|
|
ed3f8308bc | ||
|
|
e5067b4257 | ||
|
|
e34430fd7e | ||
|
|
67f8f0cb65 | ||
|
|
a7020c5d4e | ||
|
|
a8028d9962 | ||
|
|
99ef19d076 | ||
|
|
a4118b3a0f | ||
|
|
21f3485321 | ||
|
|
0b977ac06b | ||
|
|
0043e3f3a4 | ||
|
|
b5dbec4366 | ||
|
|
8af3605145 | ||
|
|
fdb7f1c6bf | ||
|
|
6e75b71775 | ||
|
|
80706a20c7 | ||
|
|
1ca880cf44 | ||
|
|
b66f2886bb | ||
|
|
55b02b6caa | ||
|
|
3160eaf1b6 | ||
|
|
ae5912f70f | ||
|
|
f648887066 | ||
|
|
4a4d87ba5d | ||
|
|
7fa04795a8 | ||
|
|
89f76bb78b | ||
|
|
642632c60c | ||
|
|
f301fad22e |
No files matched your search
+5
-3
@@ -3,12 +3,14 @@ stages:
|
||||
|
||||
build:
|
||||
stage: build
|
||||
timeout: 3h
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug-v0.16.0
|
||||
name: moby/buildkit:latest
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- |
|
||||
cat > /kaniko/.docker/config.json <<EOF
|
||||
mkdir /root/.docker
|
||||
cat > /root/.docker/config.json <<EOF
|
||||
{
|
||||
"auths": {
|
||||
"https://index.docker.io/v1/": {
|
||||
@@ -21,7 +23,7 @@ build:
|
||||
}
|
||||
}
|
||||
EOF
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination koehn/postgres-wal-g:12.2-$CI_COMMIT_TAG --build-arg BASE=12.2 --build-arg WALG_RELEASE=$(echo $CI_COMMIT_TAG | awk -F '-' '{print $1}')
|
||||
- buildctl-daemonless.sh build --frontend=dockerfile.v0 --local context=$CI_PROJECT_DIR --local dockerfile=$CI_PROJECT_DIR --output type=image,name=docker.io/koehn/postgres-wal-g:14.2-$CI_COMMIT_TAG,push=true --opt build-arg:BASE=14.2 --opt build-arg:WALG_RELEASE=$(echo $CI_COMMIT_TAG | awk -F '-' '{print $1}') --opt platform=linux/amd64
|
||||
only:
|
||||
- tags
|
||||
|
||||
+14
-3
@@ -1,12 +1,23 @@
|
||||
ARG BASE
|
||||
|
||||
FROM golang:1.15 as build
|
||||
|
||||
ARG WALG_RELEASE=v1.0
|
||||
|
||||
RUN apt-get update -qq && apt-get install -qqy --no-install-recommends --no-install-suggests cmake liblzo2-dev libsodium23 && \
|
||||
cd /go/src/ && \
|
||||
git clone -b $WALG_RELEASE --recurse-submodules https://github.com/wal-g/wal-g.git && \
|
||||
cd wal-g && \
|
||||
GOBIN=/go/bin USE_LIBSODIUM=1 USE_LZO=1 make install_and_build_pg
|
||||
|
||||
|
||||
FROM postgres:$BASE
|
||||
|
||||
ARG WALG_RELEASE=v0.2.14
|
||||
|
||||
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||
apt-get update -qq && \
|
||||
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 -
|
||||
apt-get install -qqy curl ca-certificates libsodium23 vim
|
||||
|
||||
COPY --from=build /go/src/wal-g/main/pg/wal-g /usr/local/bin/wal-g
|
||||
|
||||
COPY wal-g /wal-g
|
||||
@@ -14,10 +14,11 @@ to your bucket
|
||||
* `AWS_ENDPOINT` (et al) to tell WAL-G where to archive (see
|
||||
[WAL-G documentation](https://github.com/wal-g/wal-g) for details)
|
||||
* `WALG_S3_PREFIX` to tell WAL-G which bucket and prefix you'd like to use
|
||||
* `WALG_LIBSODIUM_KEY` to encrypt the files stored in S3
|
||||
|
||||
## Configuration
|
||||
In your `/varlib/postgresql/data/pgsql/postgresql.conf` file, set your [archive
|
||||
settings](https://www.postgresql.org/docs/9.1/continuous-archiving.html).
|
||||
In your `/var/lib/postgresql/data/pgsql/postgresql.conf` file, set your [archive
|
||||
settings](https://www.postgresql.org/docs/current/continuous-archiving.html).
|
||||
Importantly, you should set `archive_mode = on` and
|
||||
`archive_command = 'wal-g wal-push %p'`. This will
|
||||
tell Postgres to have WAL-G send WAL files to S3.
|
||||
@@ -44,5 +45,4 @@ 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 12. Be advised that 9.6 is the
|
||||
earliest version that WAL-G supports.
|
||||
Currently I build for Postgres 14, but you can build for whatever 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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user