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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform.tfvars
terraform.tfstate.backup

# Local .terraform directories
.terraform/
Expand Down
74 changes: 74 additions & 0 deletions k8s/mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion : app/v1
kind: StatefulSet
metadata:
name: mongodb
namespace: issue-tracker
specs:
serviceName: "mongodb"
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
Labels:
app: mongodb
specs:
containers:
- name: mongodb
image: mongo:6-jammy
ports:
- container-ports: 27017
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: Yasindu
- name: MONGO_INITDB_ROOT_PASSWORD
value: yasindu20
volumeMounts:
- name: mongodb-storage
mountPath: /data/db
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
exec:
command:
- mongosh
- --eval
- db.adminCommand('ping')
intialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
exec:
command:
- mongosh
- --eval
- db.adminCommand('ping')
intialDelaySeconds: 5
periodSeconds: 5
volumeClaimTemplates:
- metadata:
name: mongodb-storage
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi

---
apiVersion: v1
kind: service
metadata:
name: mongodb
namespace: issue-tracker
spec:
selector:
app: mongodb
ports:
- port: 27017
targetport: 27017
clusterIP: None
27 changes: 27 additions & 0 deletions k8s/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: namespace
metadata:
name: issue-tracker
labels:
name: issue-tracker

---
apiVersion: v1
kind: ConfigMap
metadata:
name: app-Config
namespace: issue-tracker
data:
NODE_ENV: "production"
REACT_APP_API_URL: "http://localhost:8080/api"

---
apiVersion: v1
kind: secret
metadata:
name: app-secret
namespace: issue-tracker
type: Opaque
stringData:
mongodb-uri: "mongodb+srv://Yasindu:yasindu20@issue-tracker-free.ffoquxf.mongodb.net/?retryWrites=true&w=majority&appName=issue-tracker-free"
jwt-secret: "your-super-secret-jwt-key-here-make-it-long-and-complex"
9 changes: 1 addition & 8 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ resource "aws_security_group" "backend" {
# AWS EC2 Instance for Backend
resource "aws_instance" "backend" {
ami = "ami-0c02fb55956c7d316"
instance_type = "t2.micro"
instance_type = "t3.micro"
subnet_id = aws_subnet.main.id
vpc_security_group_ids = [aws_security_group.backend.id]
key_name = var.aws_key_name
Expand Down Expand Up @@ -161,13 +161,6 @@ resource "mongodbatlas_cluster" "free_cluster" {
backing_provider_name = "AWS"
provider_region_name = "US_EAST_1"
provider_instance_size_name = "M0"

# free tier settings
disk_size_gb = 5

lifecycle {
ignore_changes = [disk_size_gb]
}
}

# vercel frontend Deployment
Expand Down
Binary file modified terraform/plan.tfplan
Binary file not shown.
Loading
Loading