Skip to content

Commit 170c002

Browse files
icookclaude
andauthored
chore(infra): Upgrade PostgreSQL 17 to 18 (#245)
* chore(infra): Upgrade PostgreSQL 17 to 18 - Update base image from postgres:17 to postgres:18 - Update PATH and PG_CONFIG for PostgreSQL 18 bin directory - Update postgresql-server-dev package to version 18 - Update schema snapshot for PG18's descriptive NOT NULL constraint names - Update trivyignore comments to reference postgres:18 Closes #240 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(kube): Update postgres volume mount for PG18 compatibility PostgreSQL 18 Docker images changed the data directory layout to use major-version-specific subdirectories under /var/lib/postgresql. Mount point must be /var/lib/postgresql (not /data) to allow the container to manage the versioned subdirectory structure. See: docker-library/postgres#1259 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent 9fe8d60 commit 170c002

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

.trivyignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
# in our use case (no tar parsing or x509 error string handling).
1111

1212
# golang: archive/tar: Unbounded allocation when parsing GNU sparse map
13-
# Affects: gosu in postgres:17 base image (Go 1.24.6)
13+
# Affects: gosu in postgres:18 base image (Go 1.24.6)
1414
# Fixed in: Go 1.24.8, 1.25.2
1515
CVE-2025-58183
1616

1717
# crypto/x509: Excessive resource consumption when printing error string
18-
# Affects: gosu in postgres:17 base image (Go 1.24.6)
18+
# Affects: gosu in postgres:18 base image (Go 1.24.6)
1919
# Fixed in: Go 1.24.11, 1.25.5
2020
CVE-2025-61729

dockerfiles/Dockerfile.postgres

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM postgres:17
1+
FROM postgres:18
22

3-
# Ensure pg_config from Postgres 17 is preferred
4-
ENV PATH="/usr/lib/postgresql/17/bin:${PATH}"
5-
ENV PG_CONFIG=/usr/lib/postgresql/17/bin/pg_config
3+
# Ensure pg_config from Postgres 18 is preferred
4+
ENV PATH="/usr/lib/postgresql/18/bin:${PATH}"
5+
ENV PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config
66

77
# Install pgmq extension and required contrib modules, then clean up build deps and apt cache.
88
RUN set -eux; \
9-
buildDeps='build-essential libicu-dev postgresql-server-dev-17 pgxnclient'; \
9+
buildDeps='build-essential libicu-dev postgresql-server-dev-18 pgxnclient'; \
1010
apt-get update; \
1111
apt-get install --no-install-recommends -y $buildDeps postgresql-contrib; \
1212
pgxn install pgmq; \

dockerfiles/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Custom Docker images for the TinyCongress development and CI environment.
66

77
| Dockerfile | Purpose | Base Image |
88
|------------|---------|------------|
9-
| `Dockerfile.postgres` | PostgreSQL with pgmq extension | `postgres:17` |
9+
| `Dockerfile.postgres` | PostgreSQL with pgmq extension | `postgres:18` |
1010

1111
## Dockerfile.postgres
1212

@@ -18,7 +18,7 @@ just build-test-postgres
1818
```
1919

2020
**Key features:**
21-
- PostgreSQL 17
21+
- PostgreSQL 18
2222
- pgmq extension pre-installed
2323
- Default database: `tiny-congress`
2424
- Default credentials: `postgres:postgres`

kube/app/templates/postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
name: postgres
4141
volumeMounts:
4242
- name: postgres-data
43-
mountPath: /var/lib/postgresql/data
43+
mountPath: /var/lib/postgresql
4444
readinessProbe:
4545
exec:
4646
command:

service/tests/snapshots/schema_snapshot__schema_matches_snapshot.snap

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
source: service/tests/schema_snapshot.rs
3-
assertion_line: 135
43
expression: current_schema
54
---
65
-- Schema Snapshot
@@ -40,15 +39,15 @@ CREATE INDEX idx_accounts_username ON public.accounts USING btree (username)
4039
CREATE UNIQUE INDEX test_items_pkey ON public.test_items USING btree (id)
4140

4241
-- Constraints
43-
-- accounts: 2200_16520_1_not_null (CHECK)
44-
-- accounts: 2200_16520_2_not_null (CHECK)
45-
-- accounts: 2200_16520_3_not_null (CHECK)
46-
-- accounts: 2200_16520_4_not_null (CHECK)
47-
-- accounts: 2200_16520_5_not_null (CHECK)
42+
-- accounts: accounts_created_at_not_null (CHECK)
43+
-- accounts: accounts_id_not_null (CHECK)
4844
-- accounts: accounts_pkey (PRIMARY KEY)
4945
-- accounts: accounts_root_kid_key (UNIQUE)
46+
-- accounts: accounts_root_kid_not_null (CHECK)
47+
-- accounts: accounts_root_pubkey_not_null (CHECK)
5048
-- accounts: accounts_username_key (UNIQUE)
51-
-- test_items: 2200_16511_1_not_null (CHECK)
52-
-- test_items: 2200_16511_2_not_null (CHECK)
53-
-- test_items: 2200_16511_3_not_null (CHECK)
49+
-- accounts: accounts_username_not_null (CHECK)
50+
-- test_items: test_items_created_at_not_null (CHECK)
51+
-- test_items: test_items_id_not_null (CHECK)
52+
-- test_items: test_items_name_not_null (CHECK)
5453
-- test_items: test_items_pkey (PRIMARY KEY)

0 commit comments

Comments
 (0)