Skip to content

Commit

Permalink
Persistent Local Development Database (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
plasticviking authored and kuanfandevops committed Dec 11, 2019
1 parent 42e6cac commit 782b70c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ public/
build/
package-lock.json
.env
.DS_Store
7 changes: 7 additions & 0 deletions dockerfiles/envoy/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ static_resources:
virtual_hosts:
- name: local_service
domains: ["*"]
cors:
allow_origin_regex:
- "https?:\\/\\/localhost:\\d+"
allow_methods: GET, PUT, DELETE, POST, PATCH, OPTIONS
allow_headers: authorization,keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web
expose_headers: grpc-status,grpc-message,x-envoy-upstream-service-time
routes:
- match: { prefix: "/" }
route: { cluster: keycloak }
http_filters:
- name: envoy.cors
- name: envoy.router
clusters:
- name: keycloak
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/app/PageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ class PageLayout extends Component {
render() {
return (
<div>
{this.props.keycloak.authenticated && <span>Authenticated</span>}
{this.props.keycloak.authenticated && <>
<span>Authenticated</span>
<strong>Authenticated</strong>
Active Roles
<ul>
{this.props.keycloak.realmAccess.roles.map(role => (<li>{role}</li>))}
</ul>
</>
}
{this.props.keycloak.authenticated || <div>
<span>Not Authenticated</span>
<button onClick={() => this.props.keycloak.login()}>Login</button>
Expand Down
19 changes: 19 additions & 0 deletions k8s-database.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: postgres
Expand All @@ -21,6 +33,10 @@ spec:
labels:
app: postgres
spec:
volumes:
- name: postgres-storage
persistentVolumeClaim:
claimName: postgres-pv-claim
containers:
- name: postgresql
image: postgres:12.0
Expand All @@ -31,6 +47,9 @@ spec:
value: zeva
- name: POSTGRES_PASSWORD
value: zevadev
volumeMounts:
- mountPath: "/var/lib/postgresql/data"
name: postgres-storage
ports:
- containerPort: 5432
readinessProbe:
Expand Down
14 changes: 14 additions & 0 deletions persistent-volume.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: localdev-persistent-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
3 changes: 3 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ build:
context: services/transaction
- image: python-backend
context: services/python-transaction/
sync:
infer:
- '**/*'
- image: frontend
context: frontend
sync:
Expand Down

0 comments on commit 782b70c

Please sign in to comment.