Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ jobs:

- name: Apply Kubernetes manifests
run: |
kubectl apply -f k8s/db_deployment.yaml
kubectl apply -f k8s/db_config.yaml
kubectl apply -f k8s/db_service.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/db_secret.yaml
kubectl apply -f k8s/db_deployment.yaml
kubectl apply -f k8s/security_config.yaml

- name: Deploy to GKE
run: |
Expand Down
7 changes: 7 additions & 0 deletions k8s/db_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: db-config
data:
SPRING_DATASOURCE_URL: "jdbc:postgresql://micropay-db:5432"
SPRING_DATASOURCE_USERNAME: "user"
17 changes: 13 additions & 4 deletions k8s/db_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: micropay-db

spec:
replicas: 1
selector:
Expand All @@ -19,15 +18,25 @@ spec:
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: security_db
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: security-config
name: db-config
key: SPRING_DATASOURCE_USERNAME
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-secret
key: SPRING_DATASOURCE_PASSWORD
command: [ "bash", "-c", "--" ]
args:
- |
set -e
docker-entrypoint.sh postgres &
sleep 5
psql -U "$POSTGRES_USER" -c "CREATE DATABASE security_db;"
psql -U "$POSTGRES_USER" -c "CREATE DATABASE payment_db;"
psql -U "$POSTGRES_USER" -c "CREATE DATABASE wallet_db;"
psql -U "$POSTGRES_USER" -c "CREATE DATABASE transaction_db;"
psql -U "$POSTGRES_USER" -c "CREATE DATABASE notification_db;"
wait
10 changes: 10 additions & 0 deletions k8s/db_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: micropay-db
spec:
selector:
app: micropay-db
ports:
- port: 5432
targetPort: 5432
4 changes: 2 additions & 2 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ spec:
- containerPort: 8150
envFrom:
- configMapRef:
name: security-config
- secretRef:
name: db-config
- configMapRef:
name: db-secret
env:
- name: SECURITY_JWT_SECRET
Expand Down
7 changes: 0 additions & 7 deletions k8s/security_config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ spring:
name: micropay-security

datasource:
url: ${SPRING_DATASOURCE_URL}
url: ${SPRING_DATASOURCE_URL}/security_db
username: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: org.postgresql.Driver
Expand Down
Loading