diff --git a/backend/services/mtp/mqtt/build/Dockerfile b/backend/services/mtp/mqtt/build/Dockerfile
index cb80675..5ea1214 100644
--- a/backend/services/mtp/mqtt/build/Dockerfile
+++ b/backend/services/mtp/mqtt/build/Dockerfile
@@ -2,7 +2,7 @@ FROM golang:1.22@sha256:82e07063a1ac3ee59e6f38b1222e32ce88469e4431ff6496cc40fb9a
WORKDIR /app
COPY ../ ./
RUN CGO_ENABLED=0 GOOS=linux go build -o mqtt cmd/mqtt/main.go
-CMD pwd
+
FROM alpine:3.14@sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed
COPY --from=builder /app/mqtt /
ENTRYPOINT ["/mqtt"]
diff --git a/deploy/kubernetes/README.md b/deploy/kubernetes/README.md
index bdc26ac..9ef30ea 100644
--- a/deploy/kubernetes/README.md
+++ b/deploy/kubernetes/README.md
@@ -2,15 +2,90 @@
## Requirements
+Kubernetes 1.28+
+
### Standalone Installation
-Node:
+Single Node:
* 8 vCPUs
* 8 GB RAM
# Installation
+## Download Files
+
+```shell
+git clone https://github.com/OktopUSP/oktopus
+export DEPLOYMENT_PATH=oktopus/deploy/kubernetes
+```
+
## MongoBD
+```shell
+# Mongo DB Operator at mongodb namespace
+helm repo add mongodb https://mongodb.github.io/helm-charts
+
+helm install community-operator mongodb/community-operator --namespace mongodb --create-namespace
+
+# Mongo DB ReplicaSet
+export DEPLOYMENT_PATH=oktopus/deploy/kubernetes
+
+kubectl apply -f $DEPLOYMENT_PATH/mongodb.yaml -n mongodb
+
+# Check Installation
+kubectl get pods -n mongodb
+```
+
+## NATS Server
+
+```shell
+# Download the NATS charts
+helm repo add nats https://nats-io.github.io/k8s/helm/charts/
+
+# Install NATS with Jetstream Enabled
+helm install nats nats/nats --set config.jetstream.enabled=true
+```
+## Oktopus
+
+
+Node Ports
+
+For this deployment, we are not using a load balancer and kubernetes is deployed on-premises so we are using Nodeports to insource the client traffic into cluster. below the ports set on deployment files:
+
+1. MQTT broker service (mqtt-svc): 30000
+2. Frontend (frontend-svc): 30001
+3. SocketIO: (socketio-svc): 30002
+4. Controller (controller-svc): 30003
+5. WebSocket (ws-svc): 30005
+
+Before deploying the files, edit the frontend.yaml file to set the correct enviroment variables:
+
+```yaml
+env:
+ - name: NEXT_PUBLIC_REST_ENDPOINT
+ value: ":30003"
+ - name: NEXT_PUBLIC_WS_ENDPOINT
+ value: ":30005"
+```
+
+```shell
+kubectl apply -f $DEPLOYMENT_PATH/mqtt.yaml
+kubectl apply -f $DEPLOYMENT_PATH/mqtt-adapter.yaml
+kubectl apply -f $DEPLOYMENT_PATH/adapter.yaml
+kubectl apply -f $DEPLOYMENT_PATH/controller.yaml
+kubectl apply -f $DEPLOYMENT_PATH/socketio.yaml
+kubectl apply -f $DEPLOYMENT_PATH/frontend.yaml
+kubectl apply -f $DEPLOYMENT_PATH/ws.yaml
+kubectl apply -f $DEPLOYMENT_PATH/ws-adapter.yaml
+```
+
+### Checking cluster status:
+
+```shell
+
+kubectl get pods
+kubectl get svc
+
+```
\ No newline at end of file
diff --git a/deploy/kubernetes/backend.yaml b/deploy/kubernetes/backend.yaml
deleted file mode 100644
index 10a45db..0000000
--- a/deploy/kubernetes/backend.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: backend
- labels:
- app: backend
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: backend
- template:
- metadata:
- labels:
- app: backend
- spec:
- containers:
- - name: backend
- image: backend:latest
- ports:
- - containerPort: 8080
\ No newline at end of file
diff --git a/deploy/kubernetes/frontend.yaml b/deploy/kubernetes/frontend.yaml
index 4e61bba..6731899 100644
--- a/deploy/kubernetes/frontend.yaml
+++ b/deploy/kubernetes/frontend.yaml
@@ -8,7 +8,7 @@ spec:
matchLabels:
app: frontend
strategy:
- type: Recreate # Specify the Recreate strategy
+ type: Recreate # Specify the Recreate strategy
template:
metadata:
labels:
@@ -16,16 +16,22 @@ spec:
spec:
containers:
- name: frontend
- image: rogersacchelli/frontend:1.0.3
- ports:
+ image: oktopusp/frontend:latest
+ resources:
+ requests:
+ memory: 64Mi
+ cpu: 100m
+ limits:
+ memory: 256Mi
+ cpu: 200m
+ ports:
- containerPort: 3000
- imagePullPolicy: Always
+ imagePullPolicy: IfNotPresent
env:
- name: NEXT_PUBLIC_REST_ENDPOINT
value: "192.168.1.130:30003"
- name: NEXT_PUBLIC_WS_ENDPOINT
- value: "192.168.1.130:30002"
-
+ value: "192.168.1.130:30005"
---
apiVersion: v1
kind: Service
diff --git a/deploy/kubernetes/mqtt.yaml b/deploy/kubernetes/mqtt.yaml
index 8d78cb6..0d705ee 100644
--- a/deploy/kubernetes/mqtt.yaml
+++ b/deploy/kubernetes/mqtt.yaml
@@ -9,7 +9,8 @@ spec:
- protocol: TCP
port: 1883
targetPort: 1883
- type: ClusterIP
+ nodePort: 30000
+ type: NodePort
---
apiVersion: apps/v1
kind: Deployment
@@ -33,10 +34,10 @@ spec:
resources:
requests:
memory: 64Mi
- cpu: 0.1
+ cpu: 100m
limits:
memory: 256Mi
- cpu: 0.2
+ cpu: 200m
imagePullPolicy: IfNotPresent
env:
- name: MQTT_PORT
diff --git a/deploy/kubernetes/ws.yaml b/deploy/kubernetes/ws.yaml
index df38bc3..f53f334 100644
--- a/deploy/kubernetes/ws.yaml
+++ b/deploy/kubernetes/ws.yaml
@@ -31,13 +31,13 @@ spec:
image: oktopusp/ws:latest
ports:
- containerPort: 8080
- #resources:
- #requests:
- #memory: 64Mi
- #cpu: 0.1
- #limits:
- #memory: 256Mi
- #cpu: 0.2
+ resources:
+ requests:
+ memory: 64Mi
+ cpu: 100m
+ limits:
+ memory: 256Mi
+ cpu: 200m
imagePullPolicy: IfNotPresent
env:
- name: SERVER_PORT
diff --git a/frontend/build/Dockerfile b/frontend/build/Dockerfile
index 8a9893e..f7512cb 100644
--- a/frontend/build/Dockerfile
+++ b/frontend/build/Dockerfile
@@ -6,7 +6,7 @@ COPY ./ ./
RUN npm install
-RUN NEXT_PUBLIC_REST_ENPOINT=REST_API_URL NEXT_PUBLIC_WS_ENPOINT=WS_URL npm run build
+RUN NEXT_PUBLIC_REST_ENDPOINT=REST_API_URL NEXT_PUBLIC_WS_ENDPOINT=WS_URL npm run build
RUN ls -la && echo "Listing directory contents done"