From 73721f81ba57a3d129eba16529e6379f493761a5 Mon Sep 17 00:00:00 2001 From: EnigmaCurry Date: Thu, 21 Nov 2024 01:34:46 +0000 Subject: [PATCH] Upgrade to PostgreSQL 17 --- postgresql/.env-dist | 2 +- postgresql/Dockerfile | 2 +- postgresql/Makefile | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/postgresql/.env-dist b/postgresql/.env-dist index 471c96e0..ef1a5ce2 100644 --- a/postgresql/.env-dist +++ b/postgresql/.env-dist @@ -3,7 +3,7 @@ POSTGRES_TRAEFIK_HOST=postgres.example.com ## The docker tag for the postgres image: -POSTGRES_VERSION=14 +POSTGRES_VERSION=17 ## The postgres image creates the POSTGRES_USER as a Super User and with POSTGRES_PASSWORD. ## We will rename these here as POSTGRES_ADMIN_USER and POSTGRES_ADMIN_PASSWORD diff --git a/postgresql/Dockerfile b/postgresql/Dockerfile index 4eeeb102..b7667355 100644 --- a/postgresql/Dockerfile +++ b/postgresql/Dockerfile @@ -1,4 +1,4 @@ -ARG POSTGRES_VERSION=14 +ARG POSTGRES_VERSION=17 FROM postgres:${POSTGRES_VERSION} ARG PGRATIONAL_VERSION=v0.0.2 diff --git a/postgresql/Makefile b/postgresql/Makefile index 68783795..880012f1 100644 --- a/postgresql/Makefile +++ b/postgresql/Makefile @@ -10,18 +10,18 @@ config-hook: .PHONY: psql # Open psql shell psql: - @docker-compose --env-file ${ENV_FILE} exec --user postgres postgres /usr/bin/psql + @docker compose --env-file ${ENV_FILE} exec --user postgres postgres /usr/bin/psql .PHONY: shell shell: - @make --no-print-directory docker-compose-shell SERVICE=psotgres + @make --no-print-directory docker compose-shell SERVICE=psotgres .PHONY: client # Get client certificate and private key files client: - @docker-compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/root_ca.crt > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_ca.crt && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_ca.crt" - @docker-compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.crt > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).crt && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).crt" - @docker-compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.key > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).key && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).key" - @docker-compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.pk8.key > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).pk8.key && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).pk8.key" + @docker compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/root_ca.crt > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_ca.crt && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_ca.crt" + @docker compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.crt > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).crt && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).crt" + @docker compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.key > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).key && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).key" + @docker compose --env-file ${ENV_FILE} exec --user postgres postgres cat /etc/postgresql/client.pk8.key > $$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).pk8.key && echo "Wrote ./$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_TRAEFIK_HOST)_$$(${BIN}/dotenv -f ${ENV_FILE} get POSTGRES_DB).pk8.key" @chmod 0600 *.crt *.key @echo @make --no-print-directory connection-variables @@ -40,8 +40,8 @@ diagram: .PHONY: certificates # Make new certificates (overwriting the old ones) certificates: build @${BIN}/confirm no "This will destroy the existing CA, server, and client certificates and create new ones." - @docker-compose --env-file=${ENV_FILE} run -e FORCE_NEW_CERTIFICATES=true config - @docker-compose --env-file=${ENV_FILE} restart postgres + @docker compose --env-file=${ENV_FILE} run -e FORCE_NEW_CERTIFICATES=true config + @docker compose --env-file=${ENV_FILE} restart postgres .PHONY: connection-string connection-string: @@ -66,7 +66,7 @@ localdb: client .PHONY: chinook # Import Chinook sample database chinook: - docker-compose --env-file=${ENV_FILE} exec postgres /bin/sh -c 'createdb chinook && psql -c "create role chinook; grant chinook to $${POSTGRES_DB};" && PGUSER=$${POSTGRES_DB} pgloader https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite_AutoIncrementPKs.sqlite pgsql:///chinook' + docker compose --env-file=${ENV_FILE} exec postgres /bin/sh -c 'createdb chinook && psql -c "create role chinook; grant chinook to $${POSTGRES_DB};" && PGUSER=$${POSTGRES_DB} pgloader https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite_AutoIncrementPKs.sqlite pgsql:///chinook' .PHONY: psql-alias # Get the psql alias with baked connection string psql-alias: