Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM postgis/postgis:18-master
FROM postgis/postgis:18-3.6

# PostGIS is provided by the base image's init script (10_postgis.sh) on fresh init.
# pgcrypto is enabled via a main DB migration (CREATE EXTENSION IF NOT EXISTS pgcrypto)
Expand Down
8 changes: 8 additions & 0 deletions db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ SELECT pgp_sym_decrypt(pgp_sym_encrypt('ok', 'k'), 'k') = 'ok' AS pgcrypto_works

In non-prod environments, add a new FOM and verify project counts again.

#### Collation Refresh (PostgreSQL Major Upgrade)

When upgrading PostgreSQL major versions or glibc base images, clear the collation version warning:

```sql
ALTER DATABASE fom REFRESH COLLATION VERSION;
```

### 8. Scale Up the API

```bash
Expand Down
9 changes: 7 additions & 2 deletions db/db_transfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ else
echo "Warning: Could not find PVCs for comparison. Proceeding without age check."
fi

# Stream dump directly from old deployment to new deployment
# Stream binary dump directly from old deployment to new deployment, filter TOC, and restore
echo -e "\nDatabase transfer from '${SOURCE_DEPLOYMENT}' to '${TARGET_DEPLOYMENT}' beginning."
oc exec -i deployment/"${SOURCE_DEPLOYMENT}" -- bash -c "pg_dump -U \${POSTGRES_USER} -d \${POSTGRES_DB} -Fc ${DUMP_PARAMETERS}" \
| oc exec -i deployment/"${TARGET_DEPLOYMENT}" -- bash -c "pg_restore -U \${POSTGRES_USER} -d \${POSTGRES_DB} -Fc"
| oc exec -i deployment/"${TARGET_DEPLOYMENT}" -- bash -c "
cat > /tmp/transfer.dump
pg_restore -l /tmp/transfer.dump | grep -v -iE 'postgis_tiger_geocoder|postgis_topology' > /tmp/transfer.list
pg_restore -U \${POSTGRES_USER} -d \${POSTGRES_DB} --no-owner --no-privileges -L /tmp/transfer.list /tmp/transfer.dump
rm -f /tmp/transfer.dump /tmp/transfer.list
"

# Results
echo -e "\nDatabase transfer from '${SOURCE_DEPLOYMENT}' to '${TARGET_DEPLOYMENT}' complete."
13 changes: 9 additions & 4 deletions db/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ parameters:
description: Image tag; e.g. PR number, latest or prod
required: true
- name: DB_VERSION
description: Database version number, e.g. v17
value: "17"
description: Database version number, e.g. v18
value: "18"
- name: PGDATA
description: PostgreSQL data directory path inside volume
value: /var/lib/postgresql/data/pgdata
- name: CRONJOB_RESTORE_TAG
description: Image tag for database restore cronjob; e.g. PR number, latest or prod
value: prod
Expand Down Expand Up @@ -175,6 +178,8 @@ objects:
port: 5432
timeoutSeconds: 1
env:
- name: PGDATA
value: ${PGDATA}
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
Expand All @@ -201,7 +206,7 @@ objects:
memory: ${MEMORY_LIMIT}
volumeMounts:
- name: ${NAME}-${ZONE}-${COMPONENT}
mountPath: /var/lib/postgresql
mountPath: /var/lib/postgresql/data
terminationMessagePath: "/dev/termination-log"
terminationMessagePolicy: File
imagePullPolicy: Always
Expand Down Expand Up @@ -442,4 +447,4 @@ objects:
activeDeadlineSeconds: 1600
dnsPolicy: "ClusterFirst"
serviceAccountName: "${JOB_SERVICE_ACCOUNT}"
serviceAccount: "${JOB_SERVICE_ACCOUNT}"
serviceAccount: "${JOB_SERVICE_ACCOUNT}"
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ services:

db:
container_name: db
# Postgis with extensions (postgis_topology, fuzzystrmatch, postgis_tiger_geocoder)
# Postgis with extensions (postgis_topology, fuzzystrmatch)
# pgcrypto is enabled by a main DB migration on API startup.
image: postgis/postgis:18-master
image: postgis/postgis:18-3.6
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=test
Expand Down
Loading