Skip to content

Commit 66a7558

Browse files
committed
add pgsql 13
1 parent ccba789 commit 66a7558

File tree

13 files changed

+147
-1
lines changed

13 files changed

+147
-1
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
/docker/data/postgresql/10/*
3737
/docker/data/postgresql/11/*
3838
/docker/data/postgresql/12/*
39+
/docker/data/postgresql/13/*
3940
/docker/data/redis/*
4041
/docker/data/sqlite/3.27/*
4142
!/docker/data/composer_cache/.gitkeep
@@ -63,6 +64,7 @@
6364
!/docker/data/postgresql/10/.gitkeep
6465
!/docker/data/postgresql/11/.gitkeep
6566
!/docker/data/postgresql/12/.gitkeep
67+
!/docker/data/postgresql/13/.gitkeep
6668
!docker/data/redis/.gitkeep
6769
!docker/data/sqlite/3.27/.gitkeep
6870

@@ -94,6 +96,7 @@
9496
/docker/logs/postgresql/10/*
9597
/docker/logs/postgresql/11/*
9698
/docker/logs/postgresql/12/*
99+
/docker/logs/postgresql/13/*
97100
/docker/logs/redis/*
98101
/docker/logs/web/redis/*
99102
/docker/logs/web/nginx/*
@@ -125,6 +128,7 @@
125128
!/docker/logs/postgresql/10/.gitkeep
126129
!/docker/logs/postgresql/11/.gitkeep
127130
!/docker/logs/postgresql/12/.gitkeep
131+
!/docker/logs/postgresql/13/.gitkeep
128132
!/docker/logs/redis/.gitkeep
129133
!/docker/logs/web/nginx/.gitkeep
130134
!/docker/logs/web/php/.gitkeep

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In the meantime, you can try out http://sqlfiddle.com/, https://www.db-fiddle.co
2828
* Mysql: 5.5, 5.6, 5.7, 8.0
2929
* Percona Server for MySQL: 5.6, 5.7, 8.0
3030
* Oracle: 18c (18.4.0) Express Edition
31-
* PostgreSQL: 9.4, 9.5, 9.6, 10, 11, 12
31+
* PostgreSQL: 9.4, 9.5, 9.6, 10, 11, 12, 13
3232
* SQLite: 3.27
3333

3434

doc/WHATSNEW.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Version 0.17
2+
------------
3+
4+
- New: added PostgreSQL 13 to the available databases
5+
6+
- Improved: bumped the application dependencies to Symfony 4.4.16
7+
8+
19
Version 0.16
210
------------
311

docker/.env

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ POSTGRESQL_9_6_VERSION=9.6
8989
POSTGRESQL_10_VERSION=10
9090
POSTGRESQL_11_VERSION=11
9191
POSTGRESQL_12_VERSION=12
92+
POSTGRESQL_13_VERSION=13
9293
MSSQLSERVER_2017_VERSION=2017-latest
9394
MSSQLSERVER_2019_VERSION=2019-latest
9495

docker/compose/postgresql.yml

+21
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,24 @@ services:
141141
- CONTAINER_USER_UID
142142
- CONTAINER_USER_GID
143143
- POSTGRES_PASSWORD
144+
145+
postgresql_13:
146+
build:
147+
context: images/postgresql/13
148+
args:
149+
timezone: "${COMPOSE_TZ}"
150+
do_update_os: "${COMPOSE_DO_UPDATE_OS}"
151+
do_shrink_container: "${COMPOSE_DO_SHRINK_CONTAINERS}"
152+
base_image_version: "${POSTGRESQL_13_VERSION}"
153+
hostname: postgresql_13
154+
container_name: "${COMPOSE_PROJECT_NAME}_postgresql_13"
155+
#ports:
156+
# - "5437:5432"
157+
volumes:
158+
- ./config/postgresql/13/${COMPOSE_DB_SIZE}.conf:/etc/postgresql/conf.d/postgresql.conf
159+
- ./data/postgresql/13:/var/lib/postgresql
160+
- ./logs/postgresql/13:/var/log/postgresql
161+
environment:
162+
- CONTAINER_USER_UID
163+
- CONTAINER_USER_GID
164+
- POSTGRES_PASSWORD

docker/config/app/postgresql.yml

+10
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,13 @@ db3v4l:
6464
#server_version: '12'
6565
vendor: postgresql
6666
version: '12'
67+
postgresql_13:
68+
host: postgresql_13
69+
port: 5432
70+
user: postgres
71+
password: '%env(POSTGRES_PASSWORD)%'
72+
#charset: UTF8
73+
#driver: pdo_pgsql
74+
#server_version: '13'
75+
vendor: postgresql
76+
version: '13'

docker/config/postgresql/13/big.conf

Whitespace-only changes.

docker/config/postgresql/13/small.conf

Whitespace-only changes.

docker/data/postgresql/13/.gitkeep

Whitespace-only changes.
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
ARG base_image_version=13
2+
3+
FROM postgres:${base_image_version}
4+
LABEL postgresql.version=13
5+
6+
ARG timezone=none
7+
ARG do_update_os=true
8+
ARG do_shrink_container=true
9+
10+
# Configure timezone
11+
# -----------------------------------------------------------------------------
12+
RUN if [ "${timezone}" != "none" ]; then echo "${timezone}" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata; fi
13+
14+
# Update preinstalled packages
15+
# -----------------------------------------------------------------------------
16+
RUN if [ "${do_update_os}" != "false" ]; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y upgrade ; fi
17+
18+
# Base packages
19+
# -----------------------------------------------------------------------------
20+
#RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
21+
# procps
22+
23+
# PG config
24+
# -----------------------------------------------------------------------------
25+
RUN mkdir /etc/postgresql/conf.d
26+
COPY initdb.sh /docker-entrypoint-initdb.d/initdb.sh
27+
RUN chmod 755 /docker-entrypoint-initdb.d/initdb.sh
28+
29+
# Clear archives in apt cache folder to slim down the image
30+
# -----------------------------------------------------------------------------
31+
RUN if [ "${do_shrink_container}" != "false" ]; then apt-get clean && rm -rf /var/lib/apt/lists/*; fi
32+
33+
# Set up entrypoint
34+
# -----------------------------------------------------------------------------
35+
COPY bootstrap.sh /root/bootstrap.sh
36+
RUN chmod 755 /root/bootstrap.sh
37+
38+
EXPOSE 5432
39+
40+
ENTRYPOINT ["/root/bootstrap.sh"]
41+
CMD ["postgres", "-c listen_addresses=*"]
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
3+
echo "[$(date)] Bootstrapping PostgreSQL..."
4+
5+
clean_up() {
6+
# Perform program exit housekeeping
7+
echo "[$(date)] Stopping the service..."
8+
pkill -x --signal term postgres
9+
if [ -f /var/run/bootstrap_ok ]; then
10+
rm /var/run/bootstrap_ok
11+
fi
12+
exit
13+
}
14+
15+
# Allow any process to see if bootstrap finished by looking up this file
16+
if [ -f /var/run/bootstrap_ok ]; then
17+
rm /var/run/bootstrap_ok
18+
fi
19+
20+
echo "[$(date)] Fixing postgres user permissions..."
21+
22+
ORIGPASSWD=$(cat /etc/passwd | grep postgres)
23+
ORIG_UID=$(echo "${ORIGPASSWD}" | cut -f3 -d:)
24+
ORIG_GID=$(echo "${ORIGPASSWD}" | cut -f4 -d:)
25+
ORIG_HOME=$(echo "${ORIGPASSWD}" | cut -f6 -d:)
26+
CONTAINER_USER_UID=${CONTAINER_USER_UID:=$ORIG_UID}
27+
CONTAINER_USER_GID=${CONTAINER_USER_GID:=$ORIG_GID}
28+
29+
if [ "${CONTAINER_USER_UID}" != "${ORIG_UID}" -o "${CONTAINER_USER_GID}" != "${ORIG_GID}" ]; then
30+
# note: we allow non-unique user and group ids...
31+
groupmod -o -g "${CONTAINER_USER_GID}" postgres
32+
usermod -o -u "${CONTAINER_USER_UID}" -g "${CONTAINER_USER_GID}" postgres
33+
fi
34+
if [ $(stat -c '%u' "/var/lib/postgresql") != "${CONTAINER_USER_UID}" -o $(stat -c '%g' "/var/lib/postgresql") != "${CONTAINER_USER_GID}" ]; then
35+
# home dir == data dir
36+
chown -R "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "/var/lib/postgresql"
37+
#chown -R "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "/var/log/postgresql"
38+
fi
39+
40+
chown -R postgres:postgres /var/run/postgresql
41+
42+
if [ -d /tmpfs ]; then
43+
chmod 0777 /tmpfs
44+
fi
45+
46+
echo "[$(date)] Handing over control to /entrypoint.sh..."
47+
48+
trap clean_up TERM
49+
50+
/docker-entrypoint.sh $@ &
51+
52+
echo "[$(date)] Bootstrap finished" | tee /var/run/bootstrap_ok
53+
54+
tail -f /dev/null &
55+
child=$!
56+
wait "$child"

docker/images/postgresql/13/initdb.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is kindly executed by the entrypoint shell script provided in the docker postgres base image.
4+
5+
echo "include_dir='/etc/postgresql/conf.d'" >> /var/lib/postgresql/data/postgresql.conf

docker/logs/postgresql/13/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)