Config Map for HAProxy Ingress Controller

This commit is contained in:
Roger 2024-04-16 23:59:55 +00:00
parent 2ae3286e87
commit be5a69f37c
9 changed files with 58 additions and 20 deletions

View File

@ -2,7 +2,7 @@ FROM golang:1.22@sha256:82e07063a1ac3ee59e6f38b1222e32ce88469e4431ff6496cc40fb9a
WORKDIR /app WORKDIR /app
COPY . . COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o mqtt cmd/mqtt/main.go RUN CGO_ENABLED=0 GOOS=linux go build -o mqtt cmd/mqtt/main.go
CMD pwd
FROM alpine:3.14@sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed FROM alpine:3.14@sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed
COPY --from=builder /app/mqtt / COPY --from=builder /app/mqtt /
ENTRYPOINT ["/mqtt"] ENTRYPOINT ["/mqtt"]

View File

@ -0,0 +1,16 @@
# Oktopus Kubernetes
## Requirements
### Standalone Installation
Node:
* 8 vCPUs
* 8 GB RAM
# Installation
## MongoBD

View File

@ -16,14 +16,14 @@ spec:
spec: spec:
containers: containers:
- name: frontend - name: frontend
image: oktopusp/frontend:latest image: rogersacchelli/frontend:1.0.3
ports: ports:
- containerPort: 3000 - containerPort: 3000
imagePullPolicy: IfNotPresent imagePullPolicy: Always
env: env:
- name: NEXT_PUBLIC_REST_ENPOINT - name: NEXT_PUBLIC_REST_ENDPOINT
value: "192.168.1.130:30003" value: "192.168.1.130:30003"
- name: NEXT_PUBLIC_WS_ENPOINT - name: NEXT_PUBLIC_WS_ENDPOINT
value: "192.168.1.130:30002" value: "192.168.1.130:30002"
--- ---

View File

@ -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"

View File

@ -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

View File

@ -0,0 +1,8 @@
controller:
service:
tcpPorts:
- name: mqtt
port: 1883
targetPort: 1883
extraArgs:
- --configmap-tcp-services=default/haproxy-tcp

View File

@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: mqtt name: mqtt-svc
spec: spec:
selector: selector:
app: mqtt app: mqtt
@ -9,8 +9,7 @@ spec:
- protocol: TCP - protocol: TCP
port: 1883 port: 1883
targetPort: 1883 targetPort: 1883
nodePort: 30000 type: ClusterIP
type: NodePort
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment

View File

@ -1,17 +1,17 @@
# ----------------------------- Local Environment ---------------------------- # # ----------------------------- Local Environment ---------------------------- #
NEXT_PUBLIC_REST_ENPOINT="http://localhost:8000/api" NEXT_PUBLIC_REST_ENDPOINT="http://localhost:8000/api"
NEXT_PUBLIC_WS_ENPOINT="http://localhost:5000/" NEXT_PUBLIC_WS_ENDPOINT="http://localhost:5000/"
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# -------------------------- Production Environment -------------------------- # # -------------------------- Production Environment -------------------------- #
#NEXT_PUBLIC_REST_ENPOINT="https://demo.oktopus.app.br/api" #NEXT_PUBLIC_REST_ENDPOINT="https://demo.oktopus.app.br/api"
#NEXT_PUBLIC_WS_ENPOINT="https://demo.oktopus.app.br/" #NEXT_PUBLIC_WS_ENDPOINT="https://demo.oktopus.app.br/"
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# ---------------------------- Mocked Environment ---------------------------- # # ---------------------------- 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"
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #

View File

@ -3,14 +3,14 @@ set -Ex
function apply_path { function apply_path {
echo "Check that we have NEXT_PUBLIC_REST_ENPOINT vars" echo "Check that we have NEXT_PUBLIC_REST_ENDPOINT vars"
test -n "$NEXT_PUBLIC_REST_ENPOINT" test -n "$NEXT_PUBLIC_REST_ENDPOINT"
echo "Check that we have NEXT_PUBLIC_WS_ENPOINT vars" echo "Check that we have NEXT_PUBLIC_WS_ENDPOINT vars"
test -n "$NEXT_PUBLIC_WS_ENPOINT" 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#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_ENPOINT#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 apply_path