diff --git a/backend/services/mtp/mqtt/build/Dockerfile b/backend/services/mtp/mqtt/build/Dockerfile index 622703d..7025ca2 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 new file mode 100644 index 0000000..bdc26ac --- /dev/null +++ b/deploy/kubernetes/README.md @@ -0,0 +1,16 @@ +# Oktopus Kubernetes + +## Requirements + +### Standalone Installation + +Node: +* 8 vCPUs +* 8 GB RAM + +# Installation + + +## MongoBD + + diff --git a/deploy/kubernetes/frontend.yaml b/deploy/kubernetes/frontend.yaml index 60a21d4..4e61bba 100644 --- a/deploy/kubernetes/frontend.yaml +++ b/deploy/kubernetes/frontend.yaml @@ -16,14 +16,14 @@ spec: spec: containers: - name: frontend - image: oktopusp/frontend:latest + image: rogersacchelli/frontend:1.0.3 ports: - containerPort: 3000 - imagePullPolicy: IfNotPresent + imagePullPolicy: Always env: - - name: NEXT_PUBLIC_REST_ENPOINT + - name: NEXT_PUBLIC_REST_ENDPOINT value: "192.168.1.130:30003" - - name: NEXT_PUBLIC_WS_ENPOINT + - name: NEXT_PUBLIC_WS_ENDPOINT value: "192.168.1.130:30002" --- diff --git a/deploy/kubernetes/haproxy-kubernetes-ingress-cm.yaml b/deploy/kubernetes/haproxy-kubernetes-ingress-cm.yaml new file mode 100644 index 0000000..c4aabd9 --- /dev/null +++ b/deploy/kubernetes/haproxy-kubernetes-ingress-cm.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: haproxy-kubernetes-ingress + namespace: haproxy-controller +data: + syslog-server: "address:stdout, format: raw, facility:daemon" diff --git a/deploy/kubernetes/haproxy-tcp-services-cm.yaml b/deploy/kubernetes/haproxy-tcp-services-cm.yaml new file mode 100644 index 0000000..a4b8f7f --- /dev/null +++ b/deploy/kubernetes/haproxy-tcp-services-cm.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: haproxy-tcp + namespace: default +data: + 1883: # Port where the frontend is going to listen to. + default/mqtt-svc:1883 # Kubernetes service in the format NS/ServiceName:ServicePort diff --git a/deploy/kubernetes/haproxy-tcp-services.yaml b/deploy/kubernetes/haproxy-tcp-services.yaml new file mode 100644 index 0000000..77db1d6 --- /dev/null +++ b/deploy/kubernetes/haproxy-tcp-services.yaml @@ -0,0 +1,8 @@ +controller: + service: + tcpPorts: + - name: mqtt + port: 1883 + targetPort: 1883 + extraArgs: + - --configmap-tcp-services=default/haproxy-tcp diff --git a/deploy/kubernetes/mqtt.yaml b/deploy/kubernetes/mqtt.yaml index b1b9b13..8d78cb6 100644 --- a/deploy/kubernetes/mqtt.yaml +++ b/deploy/kubernetes/mqtt.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: mqtt + name: mqtt-svc spec: selector: app: mqtt @@ -9,8 +9,7 @@ spec: - protocol: TCP port: 1883 targetPort: 1883 - nodePort: 30000 - type: NodePort + type: ClusterIP --- apiVersion: apps/v1 kind: Deployment diff --git a/frontend/.env b/frontend/.env index 32e4aa9..141984e 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1,17 +1,17 @@ # ----------------------------- Local Environment ---------------------------- # -NEXT_PUBLIC_REST_ENPOINT="http://localhost:8000/api" -NEXT_PUBLIC_WS_ENPOINT="http://localhost:5000/" +NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api" +NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/" # ---------------------------------------------------------------------------- # # -------------------------- Production Environment -------------------------- # -#NEXT_PUBLIC_REST_ENPOINT="https://demo.oktopus.app.br/api" -#NEXT_PUBLIC_WS_ENPOINT="https://demo.oktopus.app.br/" +#NEXT_PUBLIC_REST_ENDPOINT="https://demo.oktopus.app.br/api" +#NEXT_PUBLIC_WS_ENDPOINT="https://demo.oktopus.app.br/" # ---------------------------------------------------------------------------- # # ---------------------------- Mocked Environment ---------------------------- # -#NEXT_PUBLIC_REST_ENPOINT="https://d9962fd9-2464-4a30-9a86-a15a04b57ad0.mock.pstmn.io" +#NEXT_PUBLIC_REST_ENDPOINT="https://d9962fd9-2464-4a30-9a86-a15a04b57ad0.mock.pstmn.io" # ---------------------------------------------------------------------------- # diff --git a/frontend/build/entrypoint.sh b/frontend/build/entrypoint.sh index f4abca7..bf43c58 100644 --- a/frontend/build/entrypoint.sh +++ b/frontend/build/entrypoint.sh @@ -3,16 +3,16 @@ set -Ex function apply_path { - echo "Check that we have NEXT_PUBLIC_REST_ENPOINT vars" - test -n "$NEXT_PUBLIC_REST_ENPOINT" + echo "Check that we have NEXT_PUBLIC_REST_ENDPOINT vars" + test -n "$NEXT_PUBLIC_REST_ENDPOINT" - echo "Check that we have NEXT_PUBLIC_WS_ENPOINT vars" - test -n "$NEXT_PUBLIC_WS_ENPOINT" + echo "Check that we have NEXT_PUBLIC_WS_ENDPOINT vars" + test -n "$NEXT_PUBLIC_WS_ENDPOINT" - find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENPOINT#g" - find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$NEXT_PUBLIC_WS_ENPOINT#g" + find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#REST_API_URL#$NEXT_PUBLIC_REST_ENDPOINT#g" + find /app/.next \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s#WS_URL#$NEXT_PUBLIC_WS_ENDPOINT#g" } apply_path echo "Starting Nextjs" -exec "$@" \ No newline at end of file +exec "$@"