Add new configurations for 'ingestor' in HelmChart/Public/oneuptime/values.yaml and Nginx/Index.ts

This commit is contained in:
Simon Larsen 2024-04-24 18:26:13 +01:00
parent f601e93101
commit 0f86812258
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
4 changed files with 191 additions and 15 deletions

View File

@ -1,8 +1,81 @@
# OneUptime ingestor Deployment # OneUptime ingestor Deployment
{{- $ingestorPorts := dict "port" $.Values.port.ingestor -}}
{{- $ingestorEnv := dict "PORT" $.Values.port.ingestor -}} apiVersion: apps/v1
{{- $ingestorDeploymentArgs :=dict "IsServer" true "ServiceName" "ingestor" "Ports" $ingestorPorts "Release" $.Release "Values" $.Values "Env" $ingestorEnv -}} kind: Deployment
{{- include "oneuptime.deployment" $ingestorDeploymentArgs }} metadata:
name: {{ printf "%s-%s" $.Release.Name "ingestor" }}
namespace: {{ $.Release.Namespace }}
labels:
app: {{ printf "%s-%s" $.Release.Name "ingestor" }}
app.kubernetes.io/part-of: oneuptime
app.kubernetes.io/managed-by: Helm
appname: oneuptime
date: "{{ now | unixEpoch }}"
spec:
selector:
matchLabels:
app: {{ printf "%s-%s" $.Release.Name "ingestor" }}
replicas: {{ $.Values.deployment.replicaCount }}
template:
metadata:
labels:
app: {{ printf "%s-%s" $.Release.Name "ingestor" }}
date: "{{ now | unixEpoch }}"
appname: oneuptime
spec:
volumes:
- name: greenlockrc
emptyDir:
sizeLimit: "1Gi"
{{- if $.Values.podSecurityContext }}
securityContext: {{- $.Values.podSecurityContext | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.affinity }}
affinity: {{- $.Values.affinity | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.tolerations }}
tolerations: {{- $.Values.tolerations | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.nodeSelector }}
nodeSelector: {{- $.Values.nodeSelector | toYaml | nindent 8 }}
{{- end }}
containers:
- image: {{ printf "%s/%s/%s:%s" $.Values.image.registry $.Values.image.repository "ingestor" $.Values.image.tag }}
name: {{ printf "%s-%s" $.Release.Name "ingestor" }}
# Liveness probe
livenessProbe:
httpGet:
path: /status/live
port: {{ $.Values.port.ingestor }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 30
# Readyness Probe
readinessProbe:
httpGet:
path: /status/ready
port: {{ $.Values.port.ingestor }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 30
{{- if $.Values.containerSecurityContext }}
securityContext: {{- $.Values.containerSecurityContext | toYaml | nindent 12 }}
{{- end }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
env:
{{- include "oneuptime.env.common" . | nindent 12 }}
{{- include "oneuptime.env.commonServer" . | nindent 12 }}
{{- include "oneuptime.env.oneuptimeSecret" . | nindent 12 }}
- name: OPENTELEMETRY_EXPORTER_OTLP_HEADERS
value: {{ $.Values.openTelemetryExporter.headers.ingestor }}
- name: PORT
value: {{ $.Values.port.ingestor | quote }}
ports:
- containerPort: {{ $.Values.port.ingestor }}
protocol: TCP
name: http
restartPolicy: {{ $.Values.image.restartPolicy }}
--- ---
# OneUptime ingestor Service # OneUptime ingestor Service

View File

@ -1,13 +1,102 @@
# OneUptime nginx Deployment # OneUptime nginx Deployment
{{- $runDir := dict "SizeLimit" "1Gi" "MountPath" "/var/run" -}} apiVersion: apps/v1
{{- $confDir := dict "SizeLimit" "1Gi" "MountPath" "/etc/nginx/conf.d" -}} kind: Deployment
{{- $cacheDir := dict "SizeLimit" "1Gi" "MountPath" "/var/cache/nginx" -}} metadata:
{{- $statusPageCertsDir := dict "SizeLimit" "1Gi" "MountPath" "/etc/nginx/certs/StatusPageCerts" -}} name: {{ printf "%s-%s" $.Release.Name "nginx" }}
{{- $nginxVolumes := dict "status-page-certs" $statusPageCertsDir "cache" $cacheDir "conf" $confDir "run" $runDir -}} namespace: {{ $.Release.Namespace }}
{{- $nginxPorts := dict "http" "7849" "https" "7850" -}} labels:
{{- $nginxDeploymentArgs :=dict "IsServer" true "Ports" $nginxPorts "ServiceName" "nginx" "Release" $.Release "Values" $.Values "Volumes" $nginxVolumes -}} app: {{ printf "%s-%s" $.Release.Name "nginx" }}
{{- include "oneuptime.deployment" $nginxDeploymentArgs }} app.kubernetes.io/part-of: oneuptime
app.kubernetes.io/managed-by: Helm
appname: oneuptime
date: "{{ now | unixEpoch }}"
spec:
selector:
matchLabels:
app: {{ printf "%s-%s" $.Release.Name "nginx" }}
replicas: {{ $.Values.deployment.replicaCount }}
template:
metadata:
labels:
app: {{ printf "%s-%s" $.Release.Name "nginx" }}
date: "{{ now | unixEpoch }}"
appname: oneuptime
spec:
volumes:
- name: status-page-certs
emptyDir:
sizeLimit: "1Gi"
- name: cache
emptyDir:
sizeLimit: "1Gi"
- name: conf
emptyDir:
sizeLimit: "1Gi"
- name: run
emptyDir:
sizeLimit: "1Gi"
{{- if $.Values.podSecurityContext }}
securityContext: {{- $.Values.podSecurityContext | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.affinity }}
affinity: {{- $.Values.affinity | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.tolerations }}
tolerations: {{- $.Values.tolerations | toYaml | nindent 8 }}
{{- end }}
{{- if $.Values.nodeSelector }}
nodeSelector: {{- $.Values.nodeSelector | toYaml | nindent 8 }}
{{- end }}
containers:
- image: {{ printf "%s/%s/%s:%s" $.Values.image.registry $.Values.image.repository "nginx" $.Values.image.tag }}
name: {{ printf "%s-%s" $.Release.Name "nginx" }}
# Liveness probe
livenessProbe:
httpGet:
path: /status/live
port: 7851
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 30
# Readyness Probe
readinessProbe:
httpGet:
path: /status/ready
port: 7851
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 30
volumeMounts:
- name: status-page-certs
mountPath: /etc/nginx/certs/StatusPageCerts
- name: cache
mountPath: /var/cache/nginx
- name: conf
mountPath: /etc/nginx/conf.d
- name: run
mountPath: /var/run
{{- if $.Values.containerSecurityContext }}
securityContext: {{- $.Values.containerSecurityContext | toYaml | nindent 12 }}
{{- end }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
env:
{{- include "oneuptime.env.common" . | nindent 12 }}
{{- include "oneuptime.env.commonServer" . | nindent 12 }}
{{- include "oneuptime.env.oneuptimeSecret" . | nindent 12 }}
- name: OPENTELEMETRY_EXPORTER_OTLP_HEADERS
value: {{ $.Values.openTelemetryExporter.headers.ingress }}
- name: PORT
value: "7851" # Port for the nodejs server for live and ready status
ports:
- containerPort: 7849
protocol: TCP
name: http
- containerPort: 7850
protocol: TCP
name: https
restartPolicy: {{ $.Values.image.restartPolicy }}
--- ---
apiVersion: v1 apiVersion: v1

View File

@ -178,6 +178,8 @@ openTelemetryExporter:
statusPage: statusPage:
probe: probe:
adminDashboard: adminDashboard:
ingestor:
ingress:
containerSecurityContext: containerSecurityContext:
podSecurityContext: podSecurityContext:

View File

@ -1,21 +1,33 @@
process.env['SERVICE_NAME'] = 'ingress';
import logger from 'CommonServer/Utils/Logger'; import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer'; import App from 'CommonServer/Utils/StartServer';
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase'; import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
import FetchCertificateJobs from './Jobs/FetchCertificates'; import FetchCertificateJobs from './Jobs/FetchCertificates';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes'; import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import InfrastructureStatus from 'CommonServer/Infrastructure/Status';
const APP_NAME: string = 'ingress'; const APP_NAME: string = process.env['SERVICE_NAME'];
const init: PromiseVoidFunction = async (): Promise<void> => { const init: PromiseVoidFunction = async (): Promise<void> => {
try { try {
const statusCheck: PromiseVoidFunction = async (): Promise<void> => {
return await InfrastructureStatus.checkStatus({
checkClickhouseStatus: false,
checkPostgresStatus: true,
checkRedisStatus: false,
});
};
// init the app // init the app
await App.init({ await App.init({
appName: APP_NAME, appName: APP_NAME,
port: undefined, port: undefined,
isFrontendApp: false, isFrontendApp: false,
statusOptions: { statusOptions: {
liveCheck: async () => {}, liveCheck: statusCheck,
readyCheck: async () => {}, readyCheck: statusCheck,
}, },
}); });