Skip to content

Commit

Permalink
Merge pull request #53 from igh9410/dev
Browse files Browse the repository at this point in the history
Fixed Makefile
  • Loading branch information
igh9410 authored May 19, 2024
2 parents 09b48e7 + bd2287f commit 6496a16
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@
# Run the application
run:
@echo "Setting up the stateful infrastructures..."
# @docker compose -f ./docker-compose-k8s.yml up -d
@echo "Running the Kubernetes cluster..."
@kubectl apply -k ./k8s
shutdown:
@echo "Shutting down the Kubernetes cluster..."

@kubectl scale --replicas=0 deployment blabber-hive
@kubectl scale --replicas=0 deployment broker
@kubectl scale --replicas=0 statefulset broker
@kubectl scale --replicas=0 deployment fastapi
@kubectl scale --replicas=0 deployment grafana
@kubectl scale --replicas=0 deployment nginx
@kubectl scale --replicas=0 deployment postgres
@kubectl scale --replicas=0 statefulset postgres
@kubectl scale --replicas=0 deployment prometheus
@kubectl scale --replicas=0 deployment redis
@kubectl scale --replicas=0 deployment zookeeper

# @echo "Shutting down the stateful infrastructures..."
# @docker compose -f ./docker-compose-k8s.yml down
# @docker compose -f ./docker-compose-k8s.yml down

clean:
@echo "Deleting all Kubernetes resources..."
@kubectl delete all --all

stop-cluster:
@echo "Disabling Kubernetes in Docker Desktop..."
@osascript -e 'tell application "Docker" to set kubernetes enabled to false'
2 changes: 1 addition & 1 deletion backend/cmd/blabber-hive/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {

kafkaClient, err := kafka.NewKafkaClient()
if err != nil {
log.Printf("Failed to initialize Kafka cluster connection")
log.Fatalf("Failed to initialize Kafka cluster connection: %s", err)
}
defer kafkaClient.Close()

Expand Down
9 changes: 0 additions & 9 deletions backend/create-kafka-topics.sh

This file was deleted.

1 change: 0 additions & 1 deletion k8s/blabber-hive/blabber-hive-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,5 @@ spec:
name: blabber-hive
ports:
- containerPort: 8080

protocol: TCP
restartPolicy: Always
5 changes: 2 additions & 3 deletions k8s/kafka/broker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
annotations:
kompose.cmd: kompose convert
Expand All @@ -8,12 +8,11 @@ metadata:
io.kompose.service: broker
name: broker
spec:
serviceName: broker
replicas: 1
selector:
matchLabels:
io.kompose.service: broker
strategy:
type: Recreate
template:
metadata:
annotations:
Expand Down
1 change: 1 addition & 0 deletions k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resources:
- kafka/broker-claim0-persistentvolumeclaim.yaml
- kafka/broker-deployment.yaml
- kafka/broker-service.yaml
#- kafka/broker-jobs.yaml
- kafka/zookeeper-deployment.yaml
- nginx/nginx-cm0-configmap.yaml
- nginx/nginx-deployment.yaml
Expand Down
13 changes: 10 additions & 3 deletions k8s/postgres/postgres-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ spec:
ports:
- port: 5432
targetPort: 5432
nodePort: 32222
selector:
app: blabber-hive
tier: postgres
Expand All @@ -20,6 +21,7 @@ metadata:
kompose.version: 1.33.0 (HEAD)
labels:
app: blabber-hive
tier: postgres
io.kompose.service: postgres
name: postgres
spec:
Expand All @@ -31,7 +33,7 @@ spec:
# Do not use this clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
annotations:
kompose.cmd: kompose convert
Expand All @@ -40,12 +42,15 @@ metadata:
io.kompose.service: postgres
name: postgres
spec:
serviceName: postgres
replicas: 1
selector:
matchLabels:
io.kompose.service: postgres
strategy:
type: Recreate
app: blabber-hive
tier: postgres
# strategy: # Not need to specify the strategy for StatefulSet
# type: Recreate
template:
metadata:
annotations:
Expand All @@ -54,6 +59,8 @@ spec:
labels:
io.kompose.network/blabber-hive-blabber-hive: "true"
io.kompose.service: postgres
app: blabber-hive
tier: postgres
spec:
containers:
- env:
Expand Down

0 comments on commit 6496a16

Please sign in to comment.