Skip to content

Commit

Permalink
chore: update dev env with bce prod data (#341)
Browse files Browse the repository at this point in the history
* chore: add pgadmin

* chore: fix key

* chore: missing keys

* chore: typo

* chore: numeric user

* chore: secret

* chore: containerPort

* chore: auth

* chore: probespath

* chore: update dev env with bce prod data

---------

Co-authored-by: Gary van Woerkens <gary.van-woerkens@sg.social.gouv.fr>
Co-authored-by: Matéo Mévollon <m.mevollon@proton.me>
  • Loading branch information
3 people authored Jun 4, 2024
1 parent c3eb0f8 commit 0751788
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .kontinuous/env/dev/templates/server.sealed-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ spec:
API_TOKEN: AgA5TseHibqsLxr1Cvom/JCKKSQNwFl8uWNS3sUf40jMc/bcyYWUyhQqYfsb/BCzzXpPP6O/S6Egy858/XZ2VshfIJ31iYYpoRydEzWZnOln4f9woxLc3U6pG5WP94QRJCpKUrsfTU68pZ+UDU3xnswXvQNwGgjb/F9ZTimwS585qHqdyuuFT6Fexf7kxPQXys1J7eAHUuqXcaUOrl/WDdzSuFjdA1HeKj6f747kNbT3wreEHqFtQTK+lNaSZUVZ5oMEJ5O3aGJd+eEWEHf9dvkKdVO1giGhH/hB42ziGq4bCVGFC4NerMUE/X7HYmtleR0MOiycTlBFzTbYkGugrMhgUEL4KxM/FXyCPfNr4YUbHJLOykUTeWstcclsx9Qhn3uRhdE9yXjabnh1NhLgjxp5ttD1EQGYQ8+floKGCsuXi/AMHvp0ewi1EJMV7WP5pDjx+3ywzDdfSnYolOI7iXkshEuZSkgIjBeU4K/wiqrcWbC3KX4Evgr+SoXO5DAucAu6InSjGdbRqxKfuhJcx1l12ggMOivYHt71CWJ3mFKS/vHLuTXwUOhpmr6Ifl6rxnMRHObmBjZdJmjF7WWWqkkpSxFJ9qWiNoKJYw/DtgNJlRyUQazjt6Qda8jv7XfDHuuO5qdChIjZU2ir2wwkLEd3Gt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LPNHdbjoCdAIPLM8ZAFB/TVCEOLlUyW4y/1m2G2l3pZr+UiXWZLVD8QA==
template:
metadata:
annotations: *a1
Expand Down
16 changes: 16 additions & 0 deletions .kontinuous/env/preprod/templates/pgadmin.sealed-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
annotations:
sealedsecrets.bitnami.com/cluster-wide: 'true'
name: pgadmin
spec:
encryptedData:
PGADMIN_DEFAULT_PASSWORD: AgC4lnwAliiHTu4jrQtioJZRoDhtqytcC+iYSMUfEfbaij5sgwuc0yd4493HZyLRys4b4Hw5WHKNaRKW37bwHYXULuH0D5k6n4M6lWkt1n1EWt+uZHO1GUNMpAf17Fci30MTdXZyw+rgvfzpJns95Y+YCsiR+Xqcj9/C+RmotLgpgTxdXTUgMlQYNxEhCttFW8kqKcpmOkiuNHYig5srzNSUzy9udIkc8X5iuyZItatcN6mi/8GhLjbbWCTrwwB3mu8HlY/aHf8ioXrP77SFpSh/iccto1lNygMluZftomX7pPk/H1fsGL3DgOD4aLqNfxwo4UgMSEaBy73nEkI2V5lXzTQy8E7PKd37zt5JaJSnpvvp7rovytx4F6yZ8O49mx4Rjpaz5U1S3l3JV09K/jcuzvzx9MIIAQ49pNUjY3VrE6psjkkbo0QqA5p3AAdxX2dTatdM7WidkWgevmVixwodkQ+7yW7BonDYVKi8d/ljW1S1fwpZxkKdCfYQ6kc5vS3MpesIi2Qec+LSeffgQshkTgK7v6dm9g8/HIIZArx/Q7SFZH+0zn3x9v31SDTo9rjobYSdl+3ehC7apyZOFQ9PyPS7N0zxZhHY1SaBLs9rOTVSICCyT29WS+8TNUlyYLgqVB0JNQ1T3ZeW243Ia+x2ygtlzvoEyauZs+KYFaolZtkTf9AaKph895ugZvCmVZtdLTJinrxYHAVPx6AT7jzDFa+elw==
PGADMIN_DEFAULT_EMAIL: AgBCLotnM2nZfZMiHUgVN1FeU+RgXaq1J1YVku5XKBSX5p2qGJqaqpZJjYTF4400SGejpWVF9E2O7+eeGEqMfDpI23f0X7Bj0itOr0KsjFre/TV3a3BibaBiqLvFP9ZbGLIn+5mG3GhkYh4xdwzH4NGO1TFp1ub9qJ72LceUSjhOE0fXSwaO+qtMI2L8SwVv3nL4nhw8ZdEeOOZt7W8LLa+D96vJI/8IfHc6Wo2hrWvI7HIU8vWP04Dfhzu20HdhM31WjwxKX9ceMtFlLeTcrVtInxfKzFChwFNWqaDs+kFYQ8/h059eBtWGM7hV5LZHbqARmyllbpm/GQlX1szztUbFIX2Bb45yqL7SLI9o7tz+CNW3vxXVHO2uYmwu0XPIwJ2ZXm3cUq4VAwCkFAX0ZorFIXOaGeEpKiUO9JYX/YVsDCCjzUpcIqPUAHNJ2teV01lD4BTyIpkyUb4m0x7ver+DRli6fTrKfGW5nQNrfu96iNUNmy2fWE+lys0OtPlr73teVqs78aODggmZd/DLyKVUl8Xc9V+3BycYVmGyKlxPWNoHCrCColgw3P0dFDEyCos2Fx8CAVtMTNAL46k3gGVYDia3xG+42yGpYaUIXwyZmIwIFXrDfH9FGw97XLwxK5hrSh84GhcXW7WKNYfTK1cCnZY2+2hqT4DJN17N07W5ONu+0X4sCNKSlBbvCg3AYDycXhtck5UGcbwXhoQrMavmi1b/PiX5VdVWc5LqzOHaMiI=
template:
metadata:
annotations:
sealedsecrets.bitnami.com/cluster-wide: 'true'
name: pgadmin
type: Opaque
96 changes: 96 additions & 0 deletions .kontinuous/env/preprod/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,99 @@ pg-strapi:
cnpg-cluster:
backup:
~tpl~enabled: "false"

pgadmin:
~chart: app
~needs: ["build-pgadmin"]
imagePackage: pgadmin
containerPort: 80
probesPath: /
envFrom:
- secretRef:
name: pgadmin

env:
- name: POSTGRES_DATABASE
valueFrom:
secretKeyRef:
name: pg-app
key: PGDATABASE
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: pg-app
key: PGUSER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pg-app
key: PGPASSWORD
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: pg-app
key: PGHOST
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: pg-app
key: PGPORT
- name: POSTGRES_DATABASE_2
valueFrom:
secretKeyRef:
name: pg-n8n-app
key: PGDATABASE
- name: POSTGRES_USER_2
valueFrom:
secretKeyRef:
name: pg-n8n-app
key: PGUSER
- name: POSTGRES_PASSWORD_2
valueFrom:
secretKeyRef:
name: pg-n8n-app
key: PGPASSWORD
- name: POSTGRES_HOST_2
valueFrom:
secretKeyRef:
name: pg-n8n-app
key: PGHOST
- name: POSTGRES_PORT_2
valueFrom:
secretKeyRef:
name: pg-n8n-app
key: PGPORT
- name: POSTGRES_DATABASE_3
valueFrom:
secretKeyRef:
name: pg-strapi-app
key: PGDATABASE
- name: POSTGRES_USER_3
valueFrom:
secretKeyRef:
name: pg-strapi-app
key: PGUSER
- name: POSTGRES_PASSWORD_3
valueFrom:
secretKeyRef:
name: pg-strapi-app
key: PGPASSWORD
- name: POSTGRES_HOST_3
valueFrom:
secretKeyRef:
name: pg-strapi-app
key: PGHOST
- name: POSTGRES_PORT_3
valueFrom:
secretKeyRef:
name: pg-strapi-app
key: PGPORT

jobs:
~chart: jobs
runs:
build-pgadmin:
use: build
with:
imagePackage: pgadmin
context: src/pgadmin
18 changes: 18 additions & 0 deletions src/pgadmin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ARG BASE_VERSION=8.5
FROM dpage/pgadmin4:${BASE_VERSION}

ENV PGADMIN_CONFIG_SERVER_MODE="True"
ENV PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED="False"

ENV POSTGRES_HOST="postgres"
ENV POSTGRES_PORT="5432"
ENV POSTGRES_DB="*"

USER root
COPY primary_entrypoint.sh /primary_entrypoint.sh
RUN chmod +x /primary_entrypoint.sh && \
touch /pgadmin4/servers.json && \
chown pgadmin:root /pgadmin4/servers.json
USER 5050

ENTRYPOINT /primary_entrypoint.sh
79 changes: 79 additions & 0 deletions src/pgadmin/primary_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env sh

set -e

## Create /var/lib/pgadmin/pgpass
# 1st database
echo "$POSTGRES_HOST:$POSTGRES_PORT:postgres:$POSTGRES_USER:$POSTGRES_PASSWORD" | tee -a "/var/lib/pgadmin/pgpass" >/dev/null
echo "$POSTGRES_HOST:$POSTGRES_PORT:$POSTGRES_DB:$POSTGRES_USER:$POSTGRES_PASSWORD" | tee -a "/var/lib/pgadmin/pgpass" >/dev/null
POSTGRES_HOST_1=$POSTGRES_HOST
POSTGRES_PORT_1=$POSTGRES_PORT
POSTGRES_DB_1=$POSTGRES_DB
POSTGRES_USER_1=$POSTGRES_USER
POSTGRES_PASSWORD_1=$POSTGRES_PASSWORD

## Create servers.json
tee /pgadmin4/servers.json >/dev/null <<EOF
{
"Servers": {
"1": {
"Name": "$POSTGRES_HOST_1",
"Group": "Servers",
"Host": "$POSTGRES_HOST_1",
"Port": $POSTGRES_PORT_1,
"MaintenanceDB": "postgres",
"Username": "$POSTGRES_USER_1",
"SSLMode": "prefer",
"PassFile": "/var/lib/pgadmin/pgpass"
}
EOF

# if there are more than 1 database then
# loop through environment variables and create password files
COUNT=2
while [ ! -z "$(eval echo \"\$POSTGRES_HOST_$COUNT\")" ]; do
POSTGRES_HOST="$(eval echo \"\$POSTGRES_HOST_$COUNT\")"
POSTGRES_PORT="$(eval echo \"\$POSTGRES_PORT_$COUNT\")"

# Set default for the postgres port
if [ -z "$POSTGRES_PORT" ]; then
POSTGRES_PORT="5432"
fi

# if POSTGRES_DB, default is "*"
POSTGRES_DB="$(eval echo \"\$POSTGRES_DB_$COUNT\")"
if [ -z "$POSTGRES_DB" ]; then
POSTGRES_DB="*"
fi
POSTGRES_USER="$(eval echo \"\$POSTGRES_USER_$COUNT\")"
POSTGRES_PASSWORD="$(eval echo \"\$POSTGRES_PASSWORD_$COUNT\")"
echo "$POSTGRES_HOST:$POSTGRES_PORT:postgres:$POSTGRES_USER:$POSTGRES_PASSWORD" | tee -a "/var/lib/pgadmin/pgpass_$COUNT" >/dev/null
echo "$POSTGRES_HOST:$POSTGRES_PORT:$POSTGRES_DB:$POSTGRES_USER:$POSTGRES_PASSWORD" | tee -a "/var/lib/pgadmin/pgpass_$COUNT" >/dev/null

tee -a /pgadmin4/servers.json >/dev/null <<EOF
,"$COUNT": {
"Name": "$POSTGRES_HOST",
"Group": "Servers",
"Host": "$POSTGRES_HOST",
"Port": $POSTGRES_PORT,
"MaintenanceDB": "postgres",
"Username": "$POSTGRES_USER",
"SSLMode": "prefer",
"PassFile": "/var/lib/pgadmin/pgpass_$COUNT"
}
EOF

COUNT=$((COUNT + 1))
done

# close servers.json
tee -a /pgadmin4/servers.json >/dev/null <<EOF
}
}
EOF

chmod 600 $(ls /var/lib/pgadmin/pgpass*)
chown pgadmin:root $(ls /var/lib/pgadmin/pgpass*)
chown pgadmin:root /pgadmin4/servers.json

exec /entrypoint.sh "$@"

0 comments on commit 0751788

Please sign in to comment.