Skip to content

Commit

Permalink
Add RMQ metrics proxying sevice
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitades committed Oct 22, 2023
1 parent 584c1e6 commit 978616f
Show file tree
Hide file tree
Showing 15 changed files with 595 additions and 9 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/master_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
website: ${{ steps.filter.outputs.website }}
keycloak: ${{ steps.filter.outputs.keycloak }}
k8s: ${{ steps.filter.outputs.k8s }}
rmq-metrics-proxy: ${{ steps.filter.outputs.rmq-metrics-proxy }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
Expand All @@ -30,6 +31,8 @@ jobs:
- apps/keycloak/**
k8s:
- .k8s/prod/**
rmq-metrics-proxy:
- apps/rmq/metrics-proxy/**
test-api:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -167,11 +170,39 @@ jobs:
context: apps/keycloak
platforms: linux/arm64,linux/amd64

build-rmq-metrics-proxy-image:
runs-on: ubuntu-latest
needs: detect-changes
if: ${{ needs.detect-changes.outputs.rmq-metrics-proxy == 'true' }}
timeout-minutes: 5
defaults:
run:
working-directory: apps/rmq/metrics-proxy
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
with:
platforms: linux/arm64,linux/amd64
- uses: docker/login-action@v2
with:
username: nikitades
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
push: true
tags: |
nikitades/carres-rmq-metrics-proxy:latest
nikitades/carres-rmq-metrics-proxy:${{ github.sha }}
cache-from: type=gha,scope=carres-rmq-metrics-proxy
cache-to: type=gha,mode=max,scope=carres-rmq-metrics-proxy
context: apps/rmq/metrics-proxy
platforms: linux/arm64,linux/amd64

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [detect-changes, build-api-image, build-tgn-image, build-website-image, build-keycloak-image]
if: ${{ always() && needs.build-api-image.result != 'failure' && needs.build-tgn-image.result != 'failure' && needs.build-website-image.result != 'failure' && needs.build-keycloak-image.result != 'failure' && (github.event_name == 'pull_request' || needs.detect-changes.outputs.k8s == 'true' || needs.build-api-image.result == 'success' || needs.build-tgn-image.result == 'success' || needs.build-website-image.result == 'success' || needs.build-keycloak-image.result == 'success') }}
needs: [detect-changes, build-api-image, build-tgn-image, build-website-image, build-keycloak-image, build-rmq-metrics-proxy-image]
if: ${{ always() && needs.build-api-image.result != 'failure' && needs.build-tgn-image.result != 'failure' && needs.build-website-image.result != 'failure' && needs.build-keycloak-image.result != 'failure' && needs.build-rmq-metrics-proxy-image.result != 'failure' && (github.event_name == 'pull_request' || needs.detect-changes.outputs.k8s == 'true' || needs.build-api-image.result == 'success' || needs.build-tgn-image.result == 'success' || needs.build-website-image.result == 'success' || needs.build-keycloak-image.result == 'success' || needs.build-rmq-metrics-proxy-image.result == 'success') }}
timeout-minutes: 15
env:
CURRENT_TIME:
Expand Down Expand Up @@ -209,6 +240,12 @@ jobs:
propertyPath: spec.template.metadata.creationTimestamp
value: ${{ steps.get-current-time.outputs.CURRENT_TIME }}
commitChange: false
- uses: fjogeleit/yaml-update-action@main
with:
valueFile: .k8s/prod/carres-rmq-metrics-proxy-deployment.yaml
propertyPath: spec.template.metadata.creationTimestamp
value: ${{ steps.get-current-time.outputs.CURRENT_TIME }}
commitChange: false
- uses: azure/k8s-deploy@v4
with:
namespace: carres
Expand All @@ -217,4 +254,5 @@ jobs:
nikitades/carres-api:latest
nikitades/carres-website:latest
nikitades/carres-keycloak:latest
nikitades/carres-rmq-metrics-proxy:latest
force: true
32 changes: 32 additions & 0 deletions .k8s/local/carres-rmq-metrics-proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: carres-rmq-metrics-proxy-deployment
labels:
app: carres-rmq-metrics-proxy
spec:
replicas: 1
selector:
matchLabels:
app: carres-rmq-metrics-proxy
template:
metadata:
labels:
app: carres-rmq-metrics-proxy
spec:
containers:
- name: carres-rmq-metrics-proxy
image: nikitades/carres-rmq-metrics-proxy:latest
ports:
- containerPort: 8080
env:
- name: RMQ_ADDRESS
valueFrom:
secretKeyRef:
name: carres-rmq-metrics-proxy-secret
key: rmq-address
- name: KEYCLOAK_REALM_ADDRESS
valueFrom:
secretKeyRef:
name: carres-rmq-metrics-proxy-secret
key: keycloak-realm-address
16 changes: 16 additions & 0 deletions .k8s/local/carres-rmq-metrics-proxy-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: carres-rmq-metrics-proxy
spec:
rules:
- host: rmq-metrics.carres.local
http:
paths:
- path: /metrics
pathType: ImplementationSpecific
backend:
service:
name: carres-rmq-metrics-proxy
port:
name: http-head
8 changes: 8 additions & 0 deletions .k8s/local/carres-rmq-metrics-proxy-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: carres-rmq-metrics-proxy-secret
type: Opaque
data:
rmq-address: cm1xLXJhYmJpdG1x
keycloak-realm-address: Y2FycmVzLWtleWNsb2FrOjgwODAvcmVhbG1zL2NhcnJlcw==
14 changes: 14 additions & 0 deletions .k8s/local/carres-rmq-metrics-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: carres-rmq-metrics-proxy
spec:
selector:
app: carres-rmq-metrics-proxy
type: NodePort
ports:
- protocol: TCP
port: 8080
targetPort: 8080
nodePort: 30003
name: http-head
33 changes: 33 additions & 0 deletions .k8s/prod/carres-rmq-metrics-proxy-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: carres-rmq-metrics-proxy-deployment
labels:
app: carres-rmq-metrics-proxy
spec:
replicas: 1
selector:
matchLabels:
app: carres-rmq-metrics-proxy
template:
metadata:
creationTimestamp: 2022-05-15T23:33:38Z
labels:
app: carres-rmq-metrics-proxy
spec:
containers:
- name: carres-rmq-metrics-proxy
image: nikitades/carres-rmq-metrics-proxy:latest
ports:
- containerPort: 8080
env:
- name: RMQ_ADDRESS
valueFrom:
secretKeyRef:
name: carres-rmq-metrics-proxy-secret
key: rmq-address
- name: KEYCLOAK_REALM_ADDRESS
valueFrom:
secretKeyRef:
name: carres-rmq-metrics-proxy-secret
key: keycloak-realm-address
16 changes: 16 additions & 0 deletions .k8s/prod/carres-rmq-metrics-proxy-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: carres-rmq-metrics-proxy
spec:
rules:
- host: cars-reservation-rmq.nikitades.com
http:
paths:
- path: /metrics
pathType: ImplementationSpecific
backend:
service:
name: carres-rmq-metrics-proxy
port:
name: http-head
14 changes: 14 additions & 0 deletions .k8s/prod/carres-rmq-metrics-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: carres-rmq-metrics-proxy
spec:
selector:
app: carres-rmq-metrics-proxy
type: NodePort
ports:
- protocol: TCP
port: 8080
targetPort: 8080
nodePort: 30003
name: http-head
7 changes: 0 additions & 7 deletions .k8s/prod/carres-rmq-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,3 @@ spec:
name: rmq-rabbitmq
port:
name: http-stats
- path: /metrics
pathType: ImplementationSpecific
backend:
service:
name: rmq-rabbitmq
port:
name: http-monitoring
1 change: 1 addition & 0 deletions apps/rmq/metrics-proxy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions apps/rmq/metrics-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 8080
CMD [ "node", "server.js" ]
Loading

0 comments on commit 978616f

Please sign in to comment.