Skip to content

Commit

Permalink
infra: add prometheus and grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioDMFerreira committed Sep 29, 2023
1 parent 6d24051 commit e806f86
Show file tree
Hide file tree
Showing 409 changed files with 67,984 additions and 27 deletions.
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ test:


build-prod:
docker build -t ffff/rust-users-prod -f ./docker.prod/Dockerfile.users .
docker build -t ffff/rust-news-prod -f ./docker.prod/Dockerfile.news .
docker build -t ffff/rust-news-scrapper-prod -f ./docker.prod/Dockerfile.news-scrapper .
docker build -t ffff/rust-fe-prod -f ./docker.prod/Dockerfile.fe .
docker build -t ffff/rust-users-migrations-prod -f ./docker.prod/Dockerfile.users-migrations .
docker build -t ffff/rust-news-migrations-prod -f ./docker.prod/Dockerfile.news-migrations .
docker build -t ffff/rust-consumer-prod -f ./docker.prod/Dockerfile.consumer .
docker build -t ffff/rust-users-prod -f ./infra/docker.prod/Dockerfile.users .
docker build -t ffff/rust-news-prod -f ./infra/docker.prod/Dockerfile.news .
docker build -t ffff/rust-news-scrapper-prod -f ./infra/docker.prod/Dockerfile.news-scrapper .
docker build -t ffff/rust-fe-prod -f ./infra/docker.prod/Dockerfile.fe .
docker build -t ffff/rust-users-migrations-prod -f ./infra/docker.prod/Dockerfile.users-migrations .
docker build -t ffff/rust-news-migrations-prod -f ./infra/docker.prod/Dockerfile.news-migrations .

deploy-k8s:
helm upgrade --install ingress-nginx ./k8s/ingress-nginx --namespace ingress-nginx --create-namespace
kubectl apply -f ./k8s/postgres.yaml
kubectl apply -f ./k8s/kafka.yaml
kubectl apply -f ./k8s/migrations.yaml
kubectl apply -f ./k8s/deployment.yaml
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm upgrade --install ingress-nginx ./infra/k8s/ingress-nginx --namespace ingress-nginx --create-namespace
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm upgrade --install monitoring ./infra/k8s/kube-prometheus-stack --values=./infra/k8s/kube-prometheus-stack/myvalues.yaml
kubectl apply -f ./infra/k8s/postgres.yaml
kubectl apply -f ./infra/k8s/kafka.yaml
sleep 30
kubectl apply -f ./infra/k8s/migrations.yaml
kubectl apply -f ./infra/k8s/deployment.yaml

reset-k8s:
kubectl delete all --all
8 changes: 6 additions & 2 deletions frontend/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ class API {
}

connectWs(onMessage: (event: MessageEvent<any>) => void) {
const socket = new WebSocket('ws://localhost:8001/connect-ws');
// const socket = new WebSocket(`ws://${window.location.host}/connect-ws`);
let socket: WebSocket;
if (process.env.NODE_ENV === 'development') {
socket = new WebSocket('ws://localhost:8001/connect-ws');
} else {
socket = new WebSocket(`ws://${window.location.host}/connect-ws`);
}

let interval: string | number | NodeJS.Timer | undefined;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 16 additions & 7 deletions k8s/deployment.yaml → infra/k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,49 @@ metadata:
annotations:
nginx.ingress.kubernetes.io/use-regex: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /$1$2
nginx.ingress.kubernetes.io/proxy-read-timeout: '3600'
nginx.ingress.kubernetes.io/proxy-send-timeout: '3600'
spec:
rules:
- host: rust-xp.com
http:
paths:
- path: /api/(feeds)(/|.*)?
- path: /()(connect-ws)
pathType: ImplementationSpecific
backend:
service:
name: news-service
port:
number: 8001
- path: /api/(news)(/|.*)?
- path: /api/(subscriptions)(/|.*)?
pathType: ImplementationSpecific
backend:
service:
name: news-service
port:
number: 8001
- path: /api/(users)(/|.*)?
- path: /api/(feeds)(/|.*)?
pathType: ImplementationSpecific
backend:
service:
name: users-service
name: news-service
port:
number: 8000
- path: /api/(auth)(/.*)
number: 8001
- path: /api/(news)(/|.*)?
pathType: ImplementationSpecific
backend:
service:
name: news-service
port:
number: 8001
- path: /api/(users)(/|.*)?
pathType: ImplementationSpecific
backend:
service:
name: users-service
port:
number: 8000
- path: /()(ws)
- path: /api/(auth)(/.*)
pathType: ImplementationSpecific
backend:
service:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions infra/k8s/kube-prometheus-stack/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
# helm/charts
OWNERS
hack/
ci/
kube-prometheus-*.tgz

unittests/
12 changes: 12 additions & 0 deletions infra/k8s/kube-prometheus-stack/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contributing Guidelines

## How to contribute to this chart

1. Fork this repository, develop and test your Chart.
1. Bump the chart version for every change.
1. Ensure PR title has the prefix `[kube-prometheus-stack]`
1. When making changes to rules or dashboards, see the README.md section on how to sync data from upstream repositories
1. Check the `hack/minikube` folder has scripts to set up minikube and components of this chart that will allow all components to be scraped. You can use this configuration when validating your changes.
1. Check for changes of RBAC rules.
1. Check for changes in CRD specs.
1. PR must pass the linter (`helm lint`)
18 changes: 18 additions & 0 deletions infra/k8s/kube-prometheus-stack/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dependencies:
- name: crds
repository: ""
version: 0.0.0
- name: kube-state-metrics
repository: https://prometheus-community.github.io/helm-charts
version: 5.12.1
- name: prometheus-node-exporter
repository: https://prometheus-community.github.io/helm-charts
version: 4.23.1
- name: grafana
repository: https://grafana.github.io/helm-charts
version: 6.59.5
- name: prometheus-windows-exporter
repository: https://prometheus-community.github.io/helm-charts
version: 0.1.1
digest: sha256:f3fd0c930c37d6774e47b9423b03395c7c6b30e07860908319f7ab9dc2594f85
generated: "2023-09-23T23:28:30.725782537Z"
63 changes: 63 additions & 0 deletions infra/k8s/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
- name: Chart Source
url: https://github.com/prometheus-community/helm-charts
- name: Upstream Project
url: https://github.com/prometheus-operator/kube-prometheus
artifacthub.io/operator: "true"
apiVersion: v2
appVersion: v0.68.0
dependencies:
- condition: crds.enabled
name: crds
repository: ""
version: 0.0.0
- condition: kubeStateMetrics.enabled
name: kube-state-metrics
repository: https://prometheus-community.github.io/helm-charts
version: 5.12.*
- condition: nodeExporter.enabled
name: prometheus-node-exporter
repository: https://prometheus-community.github.io/helm-charts
version: 4.23.*
- condition: grafana.enabled
name: grafana
repository: https://grafana.github.io/helm-charts
version: 6.59.*
- condition: windowsMonitoring.enabled
name: prometheus-windows-exporter
repository: https://prometheus-community.github.io/helm-charts
version: 0.1.*
description: kube-prometheus-stack collects Kubernetes manifests, Grafana dashboards,
and Prometheus rules combined with documentation and scripts to provide easy to
operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus
Operator.
home: https://github.com/prometheus-operator/kube-prometheus
icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png
keywords:
- operator
- prometheus
- kube-prometheus
kubeVersion: '>=1.19.0-0'
maintainers:
- email: [email protected]
name: andrewgkew
- email: [email protected]
name: gianrubio
- email: [email protected]
name: gkarthiks
- email: [email protected]
name: GMartinez-Sisti
- email: [email protected]
name: scottrigby
- email: [email protected]
name: Xtigyro
- email: [email protected]
name: QuentinBisson
name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
type: application
version: 51.2.0
Loading

0 comments on commit e806f86

Please sign in to comment.