Skip to content

Commit

Permalink
feat(db): set custom entrypoint script that enforces $PG_ENCRYPT_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Oct 25, 2023
1 parent 258c103 commit 0b137cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
7 changes: 6 additions & 1 deletion db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# FROM registry.redhat.io/rhel8/postgresql-15:latest
FROM docker.io/library/postgres:15
COPY ./pgcrypto.sql /docker-entrypoint-initdb.d/

ENTRYPOINT ["/usr/local/bin/cryostat-db-entrypoint.bash"]

COPY ./pgcrypto.sql /docker-entrypoint-initdb.d/pgcrypto.sql
COPY ./entrypoint.bash /usr/local/bin/cryostat-db-entrypoint.bash
12 changes: 12 additions & 0 deletions db/entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

if [ "${DEBUG}" = "true" ]; then
set -xEeo pipefail
fi

if [ -z "${PG_ENCRYPT_KEY}" ]; then
echo "\$PG_ENCRYPT_KEY must be set and non-empty."
exit 1
fi

exec /usr/local/bin/docker-entrypoint.sh postgres -c encrypt.key="${PG_ENCRYPT_KEY}" "$@"
7 changes: 0 additions & 7 deletions smoketest/compose/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ services:
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://db:5432/cryostat3
db:
image: quay.io/cryostat/cryostat3-db:dev
build: ../../db
entrypoint:
- /usr/local/bin/docker-entrypoint.sh
command:
- postgres
- -c
- encrypt.key=REPLACEME
hostname: db
expose:
- "5432"
Expand Down

0 comments on commit 0b137cc

Please sign in to comment.