Skip to content

Commit 6a0960f

Browse files
🚀 [add] pomodoroapp fargate project
1 parent d19796e commit 6a0960f

File tree

23 files changed

+696
-0
lines changed

23 files changed

+696
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: eksctl.io/v1alpha5
2+
kind: ClusterConfig
3+
4+
metadata:
5+
name: eks-fargate-cluster
6+
region: us-east-1
7+
8+
vpc:
9+
id: "vpc-0b7dbb8db6fa33778"
10+
cidr: "10.0.0.0/16"
11+
subnets:
12+
private:
13+
us-east-1a: { id: subnet-058f511c52c8369b9 }
14+
us-east-1b: { id: subnet-083809e97ac49025c }
15+
16+
iam:
17+
withOIDC: true
18+
19+
fargateProfiles:
20+
- name: fp-default
21+
selectors:
22+
- namespace: default
23+
- namespace: kube-system
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: eksctl.io/v1alpha5
2+
kind: ClusterConfig
3+
4+
metadata:
5+
name: eks-fargate-cluster
6+
region: us-east-1
7+
8+
fargateProfiles:
9+
- name: fp-pomodoro
10+
selectors:
11+
- namespace: be-pomodoro
12+
- namespace: fe-pomodoro
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# pomodoro-infra-configs
2+
Infra configs for Promodoro Application
3+
4+
## Commands to deploy helm chart
5+
6+
Make sure you are inside helm-chart directory and deploy helm charts in below order.
7+
8+
### Deploy Database
9+
10+
Modify the values.yaml file with your configuration and run the following command. Especially secret username and password
11+
12+
```bash
13+
helm install pomodoro-db db-pomodoro-app -n db-pomodoro --create-namespace
14+
```
15+
16+
### Deploy Report Backend
17+
18+
Modify the values.yaml file with your configuration and run the following command. Especially the mongourl under configmap template file data. If you change username and password in database, change it here as well.
19+
20+
```bash
21+
helm install pomodoro-report-backend be-report-service -n be-pomodoro --create-namespace
22+
```
23+
24+
### Deploy Backend
25+
26+
Modify the values.yaml file with your configuration and run the following command. Especially the values under configmap template file data.
27+
28+
Even though the frontend is not deployed, you have to give the frontend url. The base url will be your nodeip and nodeport you are going to expose the frontend. Same goes for report service url.
29+
30+
```bash
31+
helm install pomodoro-backend be-pomodoro-app -n be-pomodoro --create-namespace
32+
```
33+
34+
### Deploy Frontend
35+
36+
Modify the values.yaml file with your configuration and run the following command. Especially the values under configmap template file data.
37+
38+
```bash
39+
helm install pomodoro-frontend fe-pomodoro-app -n fe-pomodoro --create-namespace
40+
```
41+
42+
## Commands to deploy helm chart
43+
44+
If you no longer need the setup, run the following command to delete it.
45+
46+
### Frontend
47+
48+
```bash
49+
helm delete pomodoro-frontend -n fe-pomodoro
50+
```
51+
52+
### Backend
53+
```bash
54+
helm delete pomodoro-backend -n be-pomodoro
55+
```
56+
57+
### Report Backend
58+
```bash
59+
helm delete pomodoro-report-backend -n be-pomodoro
60+
```
61+
62+
### Database
63+
```bash
64+
helm delete pomodoro-db -n db-pomodoro
65+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: Pomodoro-Backend
3+
description: A Helm chart for Backend
4+
version: 0.1.0
5+
appVersion: "1.1.0"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
data:
7+
config.js: |
8+
const config = {
9+
server: {
10+
port: "{{ .Values.port }}"
11+
},
12+
database: {
13+
mongoUrl: "{{ .Values.mongourl }}"
14+
},
15+
secrets: {
16+
jwt_key: "{{ .Values.jwt_key }}"
17+
},
18+
session: {
19+
secret: "{{ .Values.session_secret }}"
20+
},
21+
urls: {
22+
baseUrl: "{{ .Values.frontend_url }}",
23+
reportsUrl: "{{ .Values.report_backend_url }}"
24+
},
25+
observability: {
26+
jaeger_trace_url: "{{ .Values.jaeger_trace_url }}"
27+
}
28+
}
29+
30+
module.exports = config;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
spec:
7+
replicas: {{ .Values.replicaCount }}
8+
selector:
9+
matchLabels:
10+
app: backend
11+
template:
12+
metadata:
13+
labels:
14+
app: backend
15+
spec:
16+
containers:
17+
- name: {{ .Release.Name }}
18+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
19+
ports:
20+
- containerPort: {{ .Values.service.port }}
21+
livenessProbe:
22+
httpGet:
23+
path: /live
24+
port: {{ .Values.service.port }}
25+
periodSeconds: 10
26+
timeoutSeconds: 5
27+
successThreshold: 1
28+
failureThreshold: 3
29+
readinessProbe:
30+
httpGet:
31+
path: /ready
32+
port: {{ .Values.service.port }}
33+
periodSeconds: 10
34+
timeoutSeconds: 5
35+
successThreshold: 1
36+
failureThreshold: 3
37+
startupProbe:
38+
httpGet:
39+
path: /health
40+
port: {{ .Values.service.port }}
41+
periodSeconds: 10
42+
initialDelaySeconds: 20
43+
successThreshold: 1
44+
failureThreshold: 3
45+
volumeMounts:
46+
- name: config
47+
mountPath: {{ .Values.configmap.mountpath}}
48+
subPath: {{ .Values.configmap.subpath}}
49+
resources:
50+
requests:
51+
cpu: {{ .Values.resources.requests.cpu }}
52+
memory: {{ .Values.resources.requests.memory }}
53+
limits:
54+
cpu: {{ .Values.resources.limits.cpu }}
55+
memory: {{ .Values.resources.limits.memory }}
56+
volumes:
57+
- name: config
58+
configMap:
59+
name: {{ .Release.Name }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
spec:
7+
podSelector:
8+
matchLabels:
9+
app: backend
10+
app: report-backend
11+
12+
policyTypes:
13+
- Ingress
14+
ingress:
15+
- from:
16+
- namespaceSelector:
17+
matchLabels:
18+
kubernetes.io/metadata.name: {{ .Values.policy.frontend.namespace }}
19+
podSelector:
20+
matchLabels:
21+
app: {{ .Values.policy.frontend.appLabel }}
22+
- from:
23+
- namespaceSelector:
24+
matchLabels:
25+
kubernetes.io/metadata.name: {{ .Values.policy.db.namespace }}
26+
podSelector:
27+
matchLabels:
28+
app: {{ .Values.policy.db.appLabel }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
spec:
7+
type: {{ .Values.service.type }}
8+
selector:
9+
app: backend
10+
ports:
11+
- name: admin
12+
port: {{ .Values.service.port}}
13+
targetPort: {{ .Values.service.port}}
14+
{{- if eq .Values.service.type "NodePort" }}
15+
nodePort: {{ .Values.service.nodeport }}
16+
{{- end }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: techiescamp/pomodoro-backend
5+
tag: "3.0.0"
6+
pullPolicy: IfNotPresent
7+
8+
service:
9+
type: NodePort
10+
port: 7000
11+
nodeport: 30163
12+
13+
configmap:
14+
mountpath: /app/config.js
15+
subpath: config.js
16+
17+
secretName: backend-secrets
18+
19+
resources:
20+
requests:
21+
cpu: 250m
22+
memory: 256Mi
23+
limits:
24+
cpu: 1
25+
memory: 1Gi
26+
27+
## Configmap template file data
28+
port: 7000
29+
mongourl: mongodb://adminuser:password123@pomodoro-db.db-pomodoro.svc.cluster.local:27017/pomodoro?authSource=admin
30+
jwt_key: mysecret
31+
session_secret: supersecret
32+
frontend_url: http://10.0.0.10:32749
33+
report_backend_url: http://10.0.0.10:30170
34+
jaeger_trace_url: http://simplest-collector.observability.svc.cluster.local:14268
35+
36+
## Network Policy
37+
policy:
38+
frontend:
39+
namespace: fr-pomodoro
40+
appLabel: frontend
41+
db:
42+
namespace: db-pomodoro
43+
appLabel: db
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: Pomodoro-Report-Backend
3+
description: A Helm chart for Report Backend
4+
version: 0.0.1
5+
appVersion: "1.1.0"

0 commit comments

Comments
 (0)