Skip to content

Commit

Permalink
Postgres 13 and break out database into Dockerfile (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts committed Nov 7, 2022
1 parent c496f92 commit 26bfe7c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 271 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ jobs:
packages: write
strategy:
matrix:
component: [backend, frontend]
component: [backend, database, frontend]
include:
- component: backend
triggers: ('backend/')
- component: database
triggers: ('database/')
- component: frontend
triggers: ('frontend/')
secrets:
Expand Down Expand Up @@ -75,6 +77,7 @@ jobs:
overwrite: false
template_file: database/openshift.deploy.yml
template_vars: -p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/database:${{ github.event.number }}
- component: backend
overwrite: true
template_file: backend/openshift.deploy.yml
Expand Down
252 changes: 0 additions & 252 deletions backend/openshift.backups.yml

This file was deleted.

5 changes: 5 additions & 0 deletions database/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM postgres:13

# Enable extensions using this pattern on startup
#RUN sed -i '/EXISTS postgis_tiger_geocoder;*/a CREATE EXTENSION IF NOT EXISTS pgcrypto;' \
# /docker-entrypoint-initdb.d/10_postgis.sh
37 changes: 19 additions & 18 deletions database/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ parameters:
- name: IMAGE_TAG
description: Image tag to use
value: latest
- description: Volume space available for data, e.g. 512Mi, 2Gi.
- name: PVC_MOUNT_PATH
description: Where to mount the PVC, subpath (e.g. data/)
value: /var/lib/postgresql
- name: DB_PVC_SIZE
description: Volume space available for data, e.g. 512Mi, 2Gi.
displayName: Database Volume Capacity
name: DB_PVC_SIZE
required: true
value: 1Gi
- name: REGISTRY
value: image-registry.openshift-image-registry.svc:5000
description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000)
value: ghcr.io
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: openshift/postgresql:12
required: true
objects:
- kind: PersistentVolumeClaim
apiVersion: v1
Expand All @@ -35,7 +39,7 @@ objects:
- ReadWriteOnce
resources:
requests:
storage: "${DB_PVC_SIZE}"
storage: ${DB_PVC_SIZE}
storageClassName: netapp-file-standard
- kind: ImageStream
apiVersion: v1
Expand Down Expand Up @@ -100,10 +104,9 @@ objects:
command:
- /usr/bin/env
- bash
- "-c"
- >-
psql -q -d
$POSTGRESQL_DATABASE -c 'SELECT 1'
- -c
- psql -q -U $POSTGRES_USER -d $POSTGRES_DB -c 'SELECT 1'

failureThreshold: 5
initialDelaySeconds: 30
periodSeconds: 15
Expand All @@ -113,34 +116,32 @@ objects:
command:
- /usr/bin/env
- bash
- "-c"
- >-
psql -q -d
$POSTGRESQL_DATABASE -c 'SELECT 1'
- -c
- psql -q -U $POSTGRES_USER -d $POSTGRES_DB -c 'SELECT 1'
failureThreshold: 5
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 1
env:
- name: POSTGRESQL_DATABASE
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-name
- name: POSTGRESQL_PASSWORD
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-password
- name: POSTGRESQL_USER
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: database-user
volumeMounts:
- name: ${NAME}-${ZONE}-${COMPONENT}
mountPath: "/var/lib/pgsql/data"
terminationMessagePath: "/dev/termination-log"
mountPath: ${PVC_MOUNT_PATH}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
restartPolicy: Always
Expand Down

0 comments on commit 26bfe7c

Please sign in to comment.