Skip to content

Commit

Permalink
fix: mongodb config issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimanzurrashid committed Oct 16, 2022
1 parent fa8c987 commit f4c9e56
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 28 deletions.
13 changes: 4 additions & 9 deletions k8s/base/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ metadata:
app: api
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
capacity:
storage: 0Mi
storageClassName: standard
hostPath:
path: /data/files
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -22,7 +19,7 @@ metadata:
app: api
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
resources:
requests:
storage: 0Mi
Expand All @@ -47,8 +44,6 @@ spec:
spec:
containers:
- name: api
image: kazirashid/file-server:latest
imagePullPolicy: Always
env:
- name: RATE_LIMIT_PROVIDER
value: redis
Expand All @@ -72,7 +67,7 @@ spec:
name: mongodb
key: MONGODB_DATABASE
- name: MONGODB_URI
value: mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@mongodb:27017/${MONGODB_DATABASE}
value: mongodb://$(MONGODB_USERNAME):$(MONGODB_PASSWORD)@mongodb:27017/$(MONGODB_DATABASE)
- name: STORAGE_TEMP_LOCATION
value: /temp
- name: STORAGE_PROVIDER
Expand Down Expand Up @@ -138,4 +133,4 @@ spec:
ports:
- protocol: TCP
port: 3002
nodePort: 30101
nodePort: 30100
24 changes: 16 additions & 8 deletions k8s/base/mongodb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ metadata:
app: mongodb
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
capacity:
storage: 0Mi
storageClassName: standard
hostPath:
path: /data/mongodb
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -22,7 +19,7 @@ metadata:
app: mongodb
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
resources:
requests:
storage: 0Mi
Expand All @@ -36,6 +33,12 @@ metadata:
app: mongodb
data:
MONGODB_DATABASE: file_share
init-mongodb.js: |
db.createUser({
user: 'admin',
pwd: 'secret',
roles: ['dbOwner']
});
---
apiVersion: v1
kind: Secret
Expand Down Expand Up @@ -63,9 +66,6 @@ spec:
containers:
- name: mongodb
image: mongo:6.0.2-focal
command:
- mongod
- --auth
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
Expand All @@ -92,12 +92,20 @@ spec:
ports:
- containerPort: 27017
volumeMounts:
- name: init-script
mountPath: /docker-entrypoint-initdb.d
- name: mongodb
mountPath: /data/db
volumes:
- name: mongodb
persistentVolumeClaim:
claimName: mongodb
- name: init-script
configMap:
name: mongodb
items:
- key: init-mongodb.js
path: init-mongodb.js
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
Expand Down
7 changes: 2 additions & 5 deletions k8s/base/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ metadata:
app: redis
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
capacity:
storage: 0Mi
storageClassName: standard
hostPath:
path: /data/redis
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -22,7 +19,7 @@ metadata:
app: redis
spec:
accessModes:
- ReadWriteOnce
- ReadWriteMany
resources:
requests:
storage: 0Mi
Expand Down
10 changes: 8 additions & 2 deletions k8s/overlays/development/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ metadata:
name: files
spec:
capacity:
storage: 128Mi
storage: 2Gi
hostPath:
path: /data/files
persistentVolumeReclaimPolicy: Delete
storageClassName: standard
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -14,7 +18,7 @@ metadata:
spec:
resources:
requests:
storage: 128Mi
storage: 2Gi
---
apiVersion: apps/v1
kind: StatefulSet
Expand All @@ -25,6 +29,8 @@ spec:
spec:
containers:
- name: api
image: kazirashid/file-server:latest
imagePullPolicy: Always
resources:
requests:
cpu: 256m
Expand Down
12 changes: 8 additions & 4 deletions k8s/overlays/development/mongodb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
spec:
capacity:
storage: 128Mi
hostPath:
path: /data/mongodb
persistentVolumeReclaimPolicy: Delete
storageClassName: standard
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -27,11 +31,11 @@ spec:
- name: mongodb
resources:
requests:
cpu: 64m
memory: 64Mi
limits:
cpu: 128m
cpu: 256m
memory: 256Mi
limits:
cpu: 512m
memory: 512Mi
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
Expand Down
4 changes: 4 additions & 0 deletions k8s/overlays/development/redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ metadata:
spec:
capacity:
storage: 8Mi
hostPath:
path: /data/redis
persistentVolumeReclaimPolicy: Delete
storageClassName: standard
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand Down

0 comments on commit f4c9e56

Please sign in to comment.