Compare commits
10 Commits
3abbd4a9aa
...
f1115497c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
f1115497c4
|
|||
|
672b4ae893
|
|||
|
58daa46912
|
|||
|
51d9aa09f0
|
|||
|
1b9ab0f9e6
|
|||
|
ae037b8ae9
|
|||
|
f61eb6a79b
|
|||
|
cda843a80e
|
|||
|
885c288283
|
|||
|
112a6eeba6
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -49,6 +49,11 @@ Thumbs.db
|
||||
.env.*.local
|
||||
appsettings.Local.json
|
||||
appsettings.*.Local.json
|
||||
appsettings*.json
|
||||
|
||||
# Project artifacts
|
||||
**/Properties/
|
||||
*.http
|
||||
|
||||
# Helm
|
||||
helm/incidentops/charts/
|
||||
|
||||
63
docker-compose.yml
Normal file
63
docker-compose.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: incidentops
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/IncidentOps.Api/Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- ConnectionStrings__Postgres=Host=postgres;Port=5432;Database=incidentops;Username=postgres;Password=postgres
|
||||
- Redis__ConnectionString=redis:6379
|
||||
- Jwt__SigningKey=your-super-secret-key-that-should-be-at-least-32-characters-long
|
||||
- Jwt__Issuer=incidentops
|
||||
- Jwt__Audience=incidentops
|
||||
- Cors__Origins__0=http://localhost:3000
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/IncidentOps.Worker/Dockerfile
|
||||
environment:
|
||||
- ConnectionStrings__Postgres=Host=postgres;Port=5432;Database=incidentops;Username=postgres;Password=postgres
|
||||
- Redis__ConnectionString=redis:6379
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
16
helm/incidentops/Chart.yaml
Normal file
16
helm/incidentops/Chart.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v2
|
||||
name: incidentops
|
||||
description: IncidentOps - Incident Management Platform
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
version: "14.0.0"
|
||||
repository: "https://charts.bitnami.com/bitnami"
|
||||
condition: postgresql.enabled
|
||||
- name: redis
|
||||
version: "18.0.0"
|
||||
repository: "https://charts.bitnami.com/bitnami"
|
||||
condition: redis.enabled
|
||||
63
helm/incidentops/templates/_helpers.tpl
Normal file
63
helm/incidentops/templates/_helpers.tpl
Normal file
@@ -0,0 +1,63 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "incidentops.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "incidentops.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "incidentops.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "incidentops.labels" -}}
|
||||
helm.sh/chart: {{ include "incidentops.chart" . }}
|
||||
{{ include "incidentops.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "incidentops.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "incidentops.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
PostgreSQL connection string
|
||||
*/}}
|
||||
{{- define "incidentops.postgresConnectionString" -}}
|
||||
Host={{ .Release.Name }}-postgresql;Port=5432;Database={{ .Values.postgresql.auth.database }};Username={{ .Values.postgresql.auth.username }};Password={{ .Values.postgresql.auth.password }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Redis connection string
|
||||
*/}}
|
||||
{{- define "incidentops.redisConnectionString" -}}
|
||||
{{ .Release.Name }}-redis-master:6379
|
||||
{{- end }}
|
||||
61
helm/incidentops/templates/api-deployment.yaml
Normal file
61
helm/incidentops/templates/api-deployment.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
replicas: {{ .Values.api.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: "{{ .Values.api.image }}:{{ .Values.api.tag }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.api.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: ConnectionStrings__Postgres
|
||||
value: {{ include "incidentops.postgresConnectionString" . | quote }}
|
||||
- name: Redis__ConnectionString
|
||||
value: {{ include "incidentops.redisConnectionString" . | quote }}
|
||||
- name: Jwt__Issuer
|
||||
value: {{ .Values.jwt.issuer | quote }}
|
||||
- name: Jwt__Audience
|
||||
value: {{ .Values.jwt.audience | quote }}
|
||||
- name: Jwt__SigningKey
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "incidentops.fullname" . }}-secrets
|
||||
key: jwt-signing-key
|
||||
- name: Jwt__AccessTokenExpirationMinutes
|
||||
value: {{ .Values.jwt.accessTokenExpirationMinutes | quote }}
|
||||
- name: Jwt__RefreshTokenExpirationDays
|
||||
value: {{ .Values.jwt.refreshTokenExpirationDays | quote }}
|
||||
- name: Cors__Origins__0
|
||||
value: "http://{{ .Values.ingress.host }}"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.api.resources | nindent 12 }}
|
||||
17
helm/incidentops/templates/api-service.yaml
Normal file
17
helm/incidentops/templates/api-service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.api.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: api
|
||||
55
helm/incidentops/templates/ingress.yaml
Normal file
55
helm/incidentops/templates/ingress.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
port:
|
||||
number: {{ .Values.api.port }}
|
||||
- path: /v1
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
port:
|
||||
number: {{ .Values.api.port }}
|
||||
- path: /healthz
|
||||
pathType: Exact
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
port:
|
||||
number: {{ .Values.api.port }}
|
||||
- path: /readyz
|
||||
pathType: Exact
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "incidentops.fullname" . }}-api
|
||||
port:
|
||||
number: {{ .Values.api.port }}
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "incidentops.fullname" . }}-web
|
||||
port:
|
||||
number: {{ .Values.web.port }}
|
||||
{{- end }}
|
||||
9
helm/incidentops/templates/secrets.yaml
Normal file
9
helm/incidentops/templates/secrets.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-secrets
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
jwt-signing-key: {{ .Values.jwt.signingKey | quote }}
|
||||
44
helm/incidentops/templates/web-deployment.yaml
Normal file
44
helm/incidentops/templates/web-deployment.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-web
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: web
|
||||
spec:
|
||||
replicas: {{ .Values.web.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: web
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: web
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: "{{ .Values.web.image }}:{{ .Values.web.tag }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.web.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: NEXT_PUBLIC_API_URL
|
||||
value: "http://{{ .Values.ingress.host }}/api"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.web.resources | nindent 12 }}
|
||||
17
helm/incidentops/templates/web-service.yaml
Normal file
17
helm/incidentops/templates/web-service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-web
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: web
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.web.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: web
|
||||
30
helm/incidentops/templates/worker-deployment.yaml
Normal file
30
helm/incidentops/templates/worker-deployment.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "incidentops.fullname" . }}-worker
|
||||
labels:
|
||||
{{- include "incidentops.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
replicas: {{ .Values.worker.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: worker
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "incidentops.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: worker
|
||||
spec:
|
||||
containers:
|
||||
- name: worker
|
||||
image: "{{ .Values.worker.image }}:{{ .Values.worker.tag }}"
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: ConnectionStrings__Postgres
|
||||
value: {{ include "incidentops.postgresConnectionString" . | quote }}
|
||||
- name: Redis__ConnectionString
|
||||
value: {{ include "incidentops.redisConnectionString" . | quote }}
|
||||
resources:
|
||||
{{- toYaml .Values.worker.resources | nindent 12 }}
|
||||
72
helm/incidentops/values.yaml
Normal file
72
helm/incidentops/values.yaml
Normal file
@@ -0,0 +1,72 @@
|
||||
api:
|
||||
image: incidentops-api
|
||||
tag: latest
|
||||
replicas: 1
|
||||
port: 8080
|
||||
resources:
|
||||
limits:
|
||||
memory: 512Mi
|
||||
cpu: 500m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
|
||||
worker:
|
||||
image: incidentops-worker
|
||||
tag: latest
|
||||
replicas: 1
|
||||
resources:
|
||||
limits:
|
||||
memory: 512Mi
|
||||
cpu: 500m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
|
||||
web:
|
||||
image: incidentops-web
|
||||
tag: latest
|
||||
replicas: 1
|
||||
port: 3000
|
||||
resources:
|
||||
limits:
|
||||
memory: 256Mi
|
||||
cpu: 200m
|
||||
requests:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
|
||||
jwt:
|
||||
issuer: incidentops
|
||||
audience: incidentops
|
||||
signingKey: your-super-secret-key-that-should-be-at-least-32-characters-long
|
||||
accessTokenExpirationMinutes: 15
|
||||
refreshTokenExpirationDays: 7
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: nginx
|
||||
host: incidentops.local
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "10m"
|
||||
|
||||
postgresql:
|
||||
enabled: true
|
||||
auth:
|
||||
username: postgres
|
||||
password: postgres
|
||||
database: incidentops
|
||||
primary:
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 1Gi
|
||||
|
||||
redis:
|
||||
enabled: true
|
||||
architecture: standalone
|
||||
auth:
|
||||
enabled: false
|
||||
master:
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 1Gi
|
||||
41
skaffold.yaml
Normal file
41
skaffold.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
apiVersion: skaffold/v4beta6
|
||||
kind: Config
|
||||
metadata:
|
||||
name: incidentops
|
||||
build:
|
||||
artifacts:
|
||||
- image: incidentops-api
|
||||
context: .
|
||||
docker:
|
||||
dockerfile: src/IncidentOps.Api/Dockerfile
|
||||
- image: incidentops-worker
|
||||
context: .
|
||||
docker:
|
||||
dockerfile: src/IncidentOps.Worker/Dockerfile
|
||||
- image: incidentops-web
|
||||
context: web
|
||||
docker:
|
||||
dockerfile: Dockerfile
|
||||
local:
|
||||
push: false
|
||||
useBuildkit: true
|
||||
deploy:
|
||||
helm:
|
||||
releases:
|
||||
- name: incidentops
|
||||
chartPath: helm/incidentops
|
||||
valuesFiles:
|
||||
- helm/incidentops/values.yaml
|
||||
setValues:
|
||||
api.image: incidentops-api
|
||||
worker.image: incidentops-worker
|
||||
web.image: incidentops-web
|
||||
portForward:
|
||||
- resourceType: service
|
||||
resourceName: incidentops-api
|
||||
port: 8080
|
||||
localPort: 8080
|
||||
- resourceType: service
|
||||
resourceName: incidentops-web
|
||||
port: 3000
|
||||
localPort: 3000
|
||||
Reference in New Issue
Block a user