Skip to content

Commit 58e463e

Browse files
author
sergey grinko
committed
Добавлены новые версии контейнеров
1 parent 7be47cd commit 58e463e

155 files changed

Lines changed: 8169 additions & 546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

12/backup-service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ services:
2020
EMAIL_SERVER: "mail.company.ru"
2121
EMAIL_HOSTNAME: "noreplay@myhost.ru"
2222
BACKUP_THREADS: "4"
23-
BACKUP_MODE: "page"
23+
BACKUP_MODE: ""
2424
BACKUP_STREAM: "yes"

12/bin/clear_all_docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
# docker system prune -a # чистка всех образов в каталоге /var/lib/docker/overlay2
23
docker stop $(docker ps -q)
34
docker rm -v $(docker ps -aq -f status=exited)
45
docker rmi $(docker image ls -q) -f

12/bin/docker_start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ docker run -p 127.0.0.1:5433:5432/tcp --shm-size 2147483648 \
44
-e POSTGRES_HOST_AUTH_METHOD=trust \
55
-e DEPLOY_PASSWORD=postgres \
66
-e TZ="Etc/UTC" \
7-
grufos/postgres:12.17 \
7+
grufos/postgres:12.18 \
88
-c shared_preload_libraries="plugin_debugger,plpgsql_check,pg_stat_statements,auto_explain,pg_buffercache,pg_cron,shared_ispell,pg_prewarm" \
99
-c shared_ispell.max_size=70MB

12/bin/harbor_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
VERSION=12
33
MINOR=17
4-
VERS_BOUNCER="1.21.0"
4+
VERS_BOUNCER="1.22.0"
55
VERS_PROBACKUP="2.5.13"
66
VERS_MAMONSU="3.5.5"
77
PROJECT=dba_postgres

12/bin/hub_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
VERSION=12
33
MINOR=17
4-
VERS_BOUNCER="1.21.0"
4+
VERS_BOUNCER="1.22.0"
55
VERS_PROBACKUP="2.5.13"
66
VERS_MAMONSU="3.5.5"
77
ACCOUNT=grufos
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
select 'GRANT EXECUTE ON FUNCTION mamonsu.' || proname || '() TO mamonsu;' from pg_proc where pronamespace = 'mamonsu'::regnamespace \gexec
1+
select 'GRANT EXECUTE ON FUNCTION mamonsu.' || oid::regprocedure || ' TO mamonsu;' from pg_proc where pronamespace = 'mamonsu'::regnamespace \gexec

12/docker-mamonsu/metrics.ru.md

Lines changed: 82 additions & 82 deletions
Large diffs are not rendered by default.

12/docker-pgprobackup/backup.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ if [ "$BACKUP_THREADS" = "" ]; then
2525
BACKUP_THREADS=4
2626
fi
2727

28-
if [ "$BACKUP_MODE" = "" ]; then
29-
BACKUP_MODE=page
30-
fi
31-
3228
if [ "$DOW" = "6" ] ; then
3329
# make a full backup once a week (Saturday)
34-
BACKUP_MODE=full
30+
BACKUPMODE=full
31+
else
32+
# make an incremental backup on other days of the week
33+
BACKUPMODE=page
34+
fi
35+
if [ "$BACKUP_MODE" != "" ]; then
36+
# The backup creation mode is given forcibly
37+
BACKUPMODE=$BACKUP_MODE
3538
fi
3639

3740
if [ "$BACKUP_STREAM" = "" ]; then
@@ -70,21 +73,33 @@ if ! [ -f $PGDATA/archive_active.trigger ] ; then
7073
touch $PGDATA/archive_active.trigger
7174
fi
7275

73-
if [[ "$IS_FULL" = "" || $BACKUP_MODE = "full" ]] ; then
76+
if [[ "$IS_FULL" = "" || $BACKUPMODE = "full" ]] ; then
7477
echo "The initial backup must be type FULL ..."
75-
/usr/bin/pg_probackup-$PG_MAJOR backup -d postgres --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal
78+
/usr/bin/pg_probackup-$PG_MAJOR backup -d postgres --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS
7679
else
77-
# Backup type depends on day or input parameter
78-
/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b $BACKUP_MODE $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal
80+
if [[ $BACKUPMODE = "merge" ]]; then
81+
# в этом режиме здесь всегда PAGE
82+
/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b page $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS
83+
else
84+
/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b $BACKUPMODE $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS
85+
fi
7986
STATUS=`/usr/bin/pg_probackup-$PG_MAJOR show --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --format=json | jq -c '.[].backups[0].status'`
8087
LAST_STATE=${STATUS//'"'/''}
8188
if [[ "$LAST_STATE" = "CORRUPT" || "$LAST_STATE" = "ERROR" || "$LAST_STATE" = "ORPHAN" ]] ; then
8289
# You need to run a full backup, as an error occurred with incremental
8390
# Perhaps the loss of the segment at Failover ...
84-
/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal
91+
/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS
8592
fi
8693
fi
8794

95+
if [[ $BACKUPMODE = "merge" ]] ; then
96+
# объединяем старые бэкапы в соответствии с настройками
97+
/usr/bin/pg_probackup-$PG_MAJOR delete --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --delete-expired --delete-wal --merge-expired --no-validate --threads=$BACKUP_THREADS
98+
else
99+
# чистим старые бэкапы в соответствии с настройками
100+
/usr/bin/pg_probackup-$PG_MAJOR delete --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --delete-expired --delete-wal --threads=$BACKUP_THREADS
101+
fi
102+
88103
# collecting statistics on backups
89104
/usr/bin/pg_probackup-$PG_MAJOR show --backup-path=$BACKUP_PATH > ~postgres/backups.txt
90105
/usr/bin/pg_probackup-$PG_MAJOR show --backup-path=$BACKUP_PATH --archive >> ~postgres/backups.txt

12/docker-postgres/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# https://hub.docker.com/r/postgis/postgis
55
# https://github.com/postgis/docker-postgis
66
#
7-
FROM postgres:12.17
7+
FROM postgres:12.18
88

99
LABEL maintainer="Sergey Grinko <sergey.grinko@gmail.com>"
1010

@@ -16,7 +16,7 @@ ENV BACKUP_PATH /mnt/pgbak
1616
ENV POSTGRES_INITDB_ARGS "--locale=ru_RU.UTF8 --data-checksums"
1717
ENV RUM_VERSION 1.3.13
1818

19-
RUN localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8 \
19+
RUN echo ru_RU.UTF-8 UTF-8 >> /etc/locale.gen; locale-gen \
2020
&& apt-get update \
2121
&& apt-get install -y --no-install-recommends ca-certificates jq wget freetds-dev freetds-common git make gcc postgresql-server-dev-$PG_MAJOR libicu-dev sendemail htop mc systemtap-sdt-dev vim \
2222
# подключаем репозитарий архивной утилиты
@@ -64,7 +64,7 @@ RUN localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8
6464
&& make USE_PGXS=1 install \
6565
# ====== pg_variables
6666
&& cd /tmp/build_ext \
67-
&& git clone https://github.com/postgrespro/pg_variables \
67+
&& git clone https://github.com/xinferum/pg_variables \
6868
&& cd pg_variables \
6969
&& make USE_PGXS=1 \
7070
&& make USE_PGXS=1 install \
@@ -102,7 +102,7 @@ RUN localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8
102102
&& cd / \
103103
&& ln -s /usr/share/postgresql/$PG_MAJOR/tsearch_data /usr/share/postgresql/ \
104104
# ====== clean all unused package...
105-
&& apt-get purge -y git* mariadb* make gcc gcc-12 cpp cpp-12 clang* golang* postgresql-server-dev-$PG_MAJOR *-dev *-man \
105+
&& apt-get purge -y make gcc gcc-12 cpp cpp-12 clang* golang* postgresql-server-dev-$PG_MAJOR *-dev *-man \
106106
&& apt-get -f install \
107107
&& apt-get -y autoremove \
108108
&& apt-get -y clean \

12/docker-postgres/backup.sh

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ if [ "$BACKUP_THREADS" = "" ]; then
3030
BACKUP_THREADS=4
3131
fi
3232

33-
if [ "$BACKUP_MODE" = "" ]; then
34-
BACKUP_MODE=page
35-
fi
36-
3733
if [ "$BACKUP_STREAM" = "" ]; then
3834
BACKUP_STREAM="stream"
3935
fi
@@ -51,15 +47,14 @@ fi
5147

5248
if [ "$DOW" = "6" ] ; then
5349
# make a full backup once a week (Saturday)
54-
BACKUP_MODE=full
50+
BACKUPMODE=full
5551
else
5652
# make an incremental backup on other days of the week
57-
BACKUP_MODE=page
53+
BACKUPMODE=page
5854
fi
59-
60-
if [ "$1" != "" ]; then
55+
if [ "$BACKUP_MODE" != "" ]; then
6156
# The backup creation mode is given forcibly
62-
BACKUP_MODE=$1
57+
BACKUPMODE=$BACKUP_MODE
6358
fi
6459

6560
BACKUP_STREAM="--stream"
@@ -75,7 +70,6 @@ if [ "$3" != "" ]; then
7570
BACKUP_THREADS=$3
7671
fi
7772

78-
7973
cd $BACKUP_PATH
8074

8175
COUNT_DIR=`ls -l $BACKUP_PATH | grep "^d" | wc -l`
@@ -98,21 +92,33 @@ if ! [ -f $PGDATA/archive_active.trigger ] ; then
9892
su - postgres -c "touch $PGDATA/archive_active.trigger"
9993
fi
10094

101-
if [[ "$IS_FULL" = "" || $BACKUP_MODE = "full" ]] ; then
95+
if [[ "$IS_FULL" = "" || $BACKUPMODE = "full" ]] ; then
10296
# Full backup needs to be forcibly
103-
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal"
97+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS"
10498
else
10599
# Backup type depends on day or input parameter
106-
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b $BACKUP_MODE $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal"
100+
if [[ $BACKUPMODE = "merge" ]]; then
101+
# в этом режиме здесь всегда PAGE
102+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b page $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS"
103+
else
104+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR --backup-path=$BACKUP_PATH -b $BACKUPMODE $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS"
105+
fi
107106
STATUS=`su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR show --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --format=json | jq -c '.[].backups[0].status'"`
108107
LAST_STATE=${STATUS//'"'/''}
109108
if [[ "$LAST_STATE" = "CORRUPT" || "$LAST_STATE" = "ERROR" || "$LAST_STATE" = "ORPHAN" ]] ; then
110109
# You need to run a full backup, as an error occurred with incremental
111110
# Perhaps the loss of the segment at Failover ...
112-
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS --delete-expired --delete-wal"
111+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR backup --backup-path=$BACKUP_PATH -b full $BACKUP_STREAM --instance=$PG_MAJOR -w --threads=$BACKUP_THREADS"
113112
fi
114113
fi
115114

115+
if [[ $BACKUPMODE = "merge" ]] ; then
116+
# объединяем старые бэкапы в соответствии с настройками
117+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR delete --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --delete-expired --delete-wal --merge-expired --no-validate --threads=$BACKUP_THREADS"
118+
else
119+
# чистим старые бэкапы в соответствии с настройками
120+
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR delete --backup-path=$BACKUP_PATH --instance=$PG_MAJOR --delete-expired --delete-wal --threads=$BACKUP_THREADS"
121+
fi
116122

117123
# collecting statistics on backups
118124
su - postgres -c "/usr/bin/pg_probackup-$PG_MAJOR show --backup-path=$BACKUP_PATH > ~postgres/backups.txt"

0 commit comments

Comments
 (0)