From d89ec816a0a4b8e2b74a24e7a8dad6e6d48a3ed2 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Fri, 27 Feb 2026 14:42:27 +0100 Subject: [PATCH] feat(infra): replace RabbitMQ with LavinMQ --- k8s/app/secrets-store.yaml | 2 +- k8s/infra/kustomization.yaml | 2 +- k8s/infra/lavinmq.yaml | 100 +++++++++++++++++++++ k8s/infra/rabbitmq.yaml | 166 ----------------------------------- 4 files changed, 102 insertions(+), 168 deletions(-) create mode 100644 k8s/infra/lavinmq.yaml delete mode 100644 k8s/infra/rabbitmq.yaml diff --git a/k8s/app/secrets-store.yaml b/k8s/app/secrets-store.yaml index 0af8b1e..363ebcf 100644 --- a/k8s/app/secrets-store.yaml +++ b/k8s/app/secrets-store.yaml @@ -33,6 +33,6 @@ spec: - key: "rds/postgres/prod-psql" value: '{"POSTGRES_URL": "postgres://postgres:postgres@postgres:5432/postgres?sslmode=disable", "DB_HOST": "postgres", "DB_NAME": "postgres", "DB_PASSWORD": "postgres", "DB_PORT": "5432", "DB_USERNAME": "postgres"}' - key: "mq/rabbit/prod" - value: '{"AMQP_URL": "amqp://user:password@rabbitmq:5672/"}' + value: '{"AMQP_URL": "amqp://guest:guest@lavinmq:5672/"}' - key: "services/schemas" value: '{"ISSUER": "auth0", "STRICT_SSL": "false"}' diff --git a/k8s/infra/kustomization.yaml b/k8s/infra/kustomization.yaml index 1d2cf4f..6f578e2 100644 --- a/k8s/infra/kustomization.yaml +++ b/k8s/infra/kustomization.yaml @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - postgres.yaml -- rabbitmq.yaml +- lavinmq.yaml - namespaces.yaml helmCharts: - name: external-secrets diff --git a/k8s/infra/lavinmq.yaml b/k8s/infra/lavinmq.yaml new file mode 100644 index 0000000..c36d18b --- /dev/null +++ b/k8s/infra/lavinmq.yaml @@ -0,0 +1,100 @@ +apiVersion: v1 +kind: Secret +metadata: + name: lavinmq +stringData: + AMQP_URL: "amqp://guest:guest@lavinmq:5672/" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: lavinmq + release: lavinmq + name: lavinmq +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: lavinmq + strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app.kubernetes.io/name: lavinmq + spec: + containers: + - image: cloudamqp/lavinmq:2.6.8 + imagePullPolicy: Always + livenessProbe: + tcpSocket: + port: 5672 + failureThreshold: 6 + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: lavinmq + ports: + - containerPort: 5672 + name: amqp + protocol: TCP + - containerPort: 15672 + name: stats + protocol: TCP + readinessProbe: + httpGet: + port: 15672 + path: /api/whoami + httpHeaders: + - name: "Authorization" + value: "Basic Z3Vlc3Q6Z3Vlc3Q=" + failureThreshold: 3 + initialDelaySeconds: 10 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 3 + resources: + requests: + cpu: 100m + memory: 256Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - name: data + mountPath: /var/lib/lavinmq + volumes: + - name: data + hostPath: + path: /data/lavinmq + dnsPolicy: ClusterFirst + restartPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: lavinmq + release: lavinmq + name: lavinmq +spec: + externalTrafficPolicy: Cluster + ports: + - name: amqp + nodePort: 5672 + port: 5672 + protocol: TCP + targetPort: amqp + - name: stats + nodePort: 15672 + port: 15672 + protocol: TCP + targetPort: stats + selector: + app.kubernetes.io/name: lavinmq + sessionAffinity: None + type: NodePort diff --git a/k8s/infra/rabbitmq.yaml b/k8s/infra/rabbitmq.yaml deleted file mode 100644 index 91dec65..0000000 --- a/k8s/infra/rabbitmq.yaml +++ /dev/null @@ -1,166 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: shared-rabbitmq -data: - RABBITMQ_SERVERS: rabbitmq - RABBITMQ_VHOST: / - RABBITMQ_USERNAME: user ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: rabbitmq-env-config -data: - memory.conf: |- - total_memory_available_override_value = 1GB ---- -apiVersion: v1 -kind: Secret -metadata: - name: rabbitmq -stringData: - AMQP_URL: "amqp://user:password@rabbitmq:5672/" ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/name: rabbitmq - release: rabbitmq - name: rabbitmq -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: rabbitmq - strategy: - rollingUpdate: - maxSurge: 1 - maxUnavailable: 1 - type: RollingUpdate - template: - metadata: - labels: - app.kubernetes.io/name: rabbitmq - spec: - securityContext: - fsGroup: 999 - runAsUser: 999 - runAsGroup: 999 - containers: - - env: - - name: RABBITMQ_DEFAULT_USER - value: user - - name: RABBITMQ_DEFAULT_PASS - value: password - - name: RABBITMQ_NODE_PORT_NUMBER - value: "5672" - - name: RABBITMQ_NODE_TYPE - value: stats - - name: RABBITMQ_NODENAME - value: rabbit@localhost - - name: RABBITMQ_CLUSTER_NODE_NAME - - name: RABBITMQ_DEFAULT_VHOST - value: / - - name: RABBITMQ_MANAGER_PORT_NUMBER - value: "15672" - - name: RABBITMQ_DISK_FREE_LIMIT - value: '"8GiB"' - - name: RABBITMQ_CONFIG_FILES - value: /etc/rabbitmq/conf.d - image: rabbitmq:4.2.4-management@sha256:d998227fec258fb149db2675028dd74c4fbdfcce7d6ee1eab9ec7ac9eea6a067 - imagePullPolicy: Always - livenessProbe: - exec: - command: - - rabbitmqctl - - status - failureThreshold: 6 - initialDelaySeconds: 120 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 - name: rabbitmq - ports: - - containerPort: 4369 - name: epmd - protocol: TCP - - containerPort: 5672 - name: amqp - protocol: TCP - - containerPort: 25672 - name: dist - protocol: TCP - - containerPort: 15672 - name: stats - protocol: TCP - readinessProbe: - httpGet: - port: 15672 - path: /api/aliveness-test/%2F - httpHeaders: - - name: "Authorization" - value: "Basic dXNlcjpwYXNzd29yZA==" - failureThreshold: 3 - initialDelaySeconds: 10 - periodSeconds: 5 - successThreshold: 1 - timeoutSeconds: 3 - resources: - requests: - cpu: 100m - memory: 256Mi - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - volumeMounts: - - name: data - mountPath: /var/lib/rabbitmq - - name: config - mountPath: /etc/rabbitmq/conf.d/20-memory.conf - subPath: memory.conf - readOnly: true - volumes: - - name: data - hostPath: - path: /data/rabbitmq - - name: config - configMap: - name: rabbitmq-env-config - dnsPolicy: ClusterFirst - restartPolicy: Always ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/name: rabbitmq - release: rabbitmq - name: rabbitmq -spec: - externalTrafficPolicy: Cluster - ports: - - name: epmd - nodePort: 31799 - port: 4369 - protocol: TCP - targetPort: epmd - - name: amqp - nodePort: 5672 - port: 5672 - protocol: TCP - targetPort: amqp - - name: dist - nodePort: 32687 - port: 25672 - protocol: TCP - targetPort: dist - - name: stats - nodePort: 15672 - port: 15672 - protocol: TCP - targetPort: stats - selector: - app.kubernetes.io/name: rabbitmq - sessionAffinity: None - type: NodePort