https://github.com/mondata-dev/postgres-db-init
Simple docker container that can be used to initialize a postgresql database for a kubernetes service.
https://github.com/mondata-dev/postgres-db-init
docker initializer kubernetes postgresql
Last synced: 3 months ago
JSON representation
Simple docker container that can be used to initialize a postgresql database for a kubernetes service.
- Host: GitHub
- URL: https://github.com/mondata-dev/postgres-db-init
- Owner: mondata-dev
- Created: 2020-11-25T20:27:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-25T16:38:07.000Z (about 2 years ago)
- Last Synced: 2025-02-03T23:44:05.062Z (about 1 year ago)
- Topics: docker, initializer, kubernetes, postgresql
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# postgres-db-init
Simple docker container that can be used to initialize a postgresql database for a kubernetes service.
## Example Usage
```yaml
initContainers:
- name: init-db
image: mondata/postgres-db-init
imagePullPolicy: Always
envFrom:
- configMapRef:
name: db-configmap
env:
- name: PGADMINPASSWORD
valueFrom:
secretKeyRef:
name: postgresql-secret
key: postgresql-password
- name: PGUSER
value: newuser
- name: PGPASSWORD
value: newsecret
- name: PGDATABASE
value: yourdb
```
This assumes the following kubernetes resources:
```yaml
apiVersion: v1
kind: Secret
metadata:
name: postgresql-secret
type: Opaque
stringData:
postgresql-password: geheim
---
apiVersion: v1
kind: ConfigMap
metadata:
name: db-configmap
data:
PGADMINUSER: postgres
PGHOST: example.com
PGPORT: 5432
```
## Build & Deploy
```bash
docker build -t mondata/postgres-db-init:VERSION .
docker push mondata/postgres-db-init:VERSION
git tag -a VERSION
git push --follow-tags
```