Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ commitlint.config.json
dist
build
reports
local.json
9 changes: 9 additions & 0 deletions .swcrc
Comment thread
razbroc marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://swc.rs/schema.json",
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true
}
}
}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apk add dumb-init

ENV NODE_ENV=production
ENV SERVER_PORT=8080
ENV CONFIG_OFFLINE_MODE=true


WORKDIR /usr/src/app
Expand All @@ -29,4 +30,4 @@ COPY --chown=node:node ./config ./config

USER node
EXPOSE 8080
CMD ["dumb-init", "node", "--require", "./common/tracing.js", "./index.js"]
CMD ["dumb-init", "node", "--import", "./instrumentation.mjs", "./index.js"]
21 changes: 15 additions & 6 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@
"prettyPrint": {
"__name": "LOG_PRETTY_PRINT_ENABLED",
"__format": "boolean"
},
"opentelemetryOptions": {
"enabled": {
"__name": "OPENTELEMETRY_LOGGING_ENABLED",
"__format": "boolean"
},
"url": "OPENTELEMETRY_LOGGING_URL",
"resourceAttributes": {
"__name": "OPENTELEMETRY_RESOURCE_ATTRIBUTES",
"__format": "json"
}
}
},
"tracing": {
"enabled": "TELEMETRY_TRACING_ENABLED",
"isEnabled": {
"__name": "TELEMETRY_TRACING_ENABLED",
"__format": "boolean"
},
"url": "TELEMETRY_TRACING_URL"
},
"metrics": {
"enabled": "TELEMETRY_METRICS_ENABLED",
"url": "TELEMETRY_METRICS_URL",
"interval": "TELEMETRY_METRICS_INTERVAL"
}
},
"server": {
Expand Down
11 changes: 9 additions & 2 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
"telemetry": {
"logger": {
"level": "info",
"prettyPrint": false
"prettyPrint": false,
"opentelemetryOptions": {
"enabled": false
}
},
"shared": {},
Comment thread
razbroc marked this conversation as resolved.
"tracing": {
"isEnabled": false
}
},
"server": {
"port": "8080",
"port": 8080,
"request": {
"payload": {
"limit": "1mb"
Expand Down
13 changes: 13 additions & 0 deletions eslint.config.mjs
Comment thread
shimoncohen marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import tsBaseConfig from '@map-colonies/eslint-config/ts-base';
import jestConfig from '@map-colonies/eslint-config/jest';
import jestPlugin from 'eslint-plugin-jest';
import { defineConfig } from 'eslint/config';

export default defineConfig(jestConfig, tsBaseConfig, {
Comment thread
razbroc marked this conversation as resolved.
files: ['**/*.spec.ts', '**/*.test.ts'],
plugins: { jest: jestPlugin },
rules: {
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
});
4 changes: 2 additions & 2 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Custom definitions
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.tracing .Values.global.tracing ) "context" . ) }}
{{- end -}}

{{- define "common.metrics.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics .Values.global.metrics ) "context" . ) }}
{{- define "common.openTelemetryOptions.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.env.openTelemetryOptions .Values.global.openTelemetryOptions ) "context" . ) }}
{{- end -}}

{{/*
Expand Down
19 changes: 14 additions & 5 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }}
{{- $queue := .Values.env.queue }}
{{- $tracing := (include "common.tracing.merged" .) | fromYaml }}
{{- $metrics := (include "common.metrics.merged" .) | fromYaml }}
{{- $openTelemetryOptions := (include "common.openTelemetryOptions.merged" .) | fromYaml }}
{{- if .Values.enabled -}}
apiVersion: v1
kind: ConfigMap
Expand All @@ -15,14 +15,17 @@ data:
RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }}
LOG_LEVEL: {{ .Values.env.logLevel | quote }}
LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.logPrettyPrintEnabled | quote }}
{{- with $openTelemetryOptions }}
OPENTELEMETRY_LOGGING_ENABLED: {{ .enabled | quote }}
{{ if .enabled }}
OPENTELEMETRY_LOGGING_URL: {{ .url | quote }}
OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }}
{{- end }}
{{- end }}
{{ if $tracing.enabled }}
TELEMETRY_TRACING_ENABLED: 'true'
TELEMETRY_TRACING_URL: {{ $tracing.url }}
{{ end }}
{{ if $metrics.enabled }}
TELEMETRY_METRICS_ENABLED: 'true'
TELEMETRY_METRICS_URL: {{ $metrics.url }}
{{ end }}
npm_config_cache: /tmp/
JOB_MANAGER_BASE_URL: {{ $serviceUrls.jobManager | quote }}
JOB_DEFINITIONS_JOB_NEW: {{ $jobDefinitions.jobs.new.type | quote }}
Expand All @@ -43,4 +46,10 @@ data:
INGESTION_TASKS_FLOW: {{ .Values.taskFlowManager.ingestionTasksFlow | toJson | quote }}
EXPORT_TASKS_FLOW: {{ .Values.taskFlowManager.exportTasksFlow | toJson | quote }}
SEED_TASKS_FLOW: {{ .Values.taskFlowManager.seedTasksFlow | toJson | quote }}
{{- with .Values.configManagement }}
Comment thread
razbroc marked this conversation as resolved.
CONFIG_NAME: {{ .name | quote }}
CONFIG_VERSION: {{ .version | quote }}
CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }}
CONFIG_SERVER_URL: {{ .serverUrl | quote }}
{{- end -}}
{{- end }}
9 changes: 4 additions & 5 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{{- $cloudProviderDockerRegistryUrl := include "job-tracker.cloudProviderDockerRegistryUrl" . -}}
{{- $cloudProviderImagePullSecretName := include "job-tracker.cloudProviderImagePullSecretName" . -}}
{{- $imageTag := include "job-tracker.tag" . -}}
{{- $metrics := (include "common.metrics.merged" .) | fromYaml }}
{{- if .Values.enabled -}}
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -38,10 +37,6 @@ spec:
{{- if .Values.resetOnConfigChange }}
checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{ if $metrics.enabled }}
prometheus.io/port: {{ $metrics.prometheus.port | quote }}
prometheus.io/scrape: {{ $metrics.prometheus.scrape | quote }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -77,6 +72,10 @@ spec:
env:
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
{{- if .Values.global.ca.secretNameName }}
- name: REQUESTS_CA_BUNDLE
value: {{ printf "%s/%s" .Values.global.ca.path .Values.global.ca.key | quote }}
Expand Down
17 changes: 10 additions & 7 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
global:
cloudProvider: {}
tracing: {}
metrics: {}
environment: ''
jobDefinitions: {}
serviceUrls: {}
openTelemetryOptions: {}
ca:
secretName: ''
path: '/usr/local/share/ca-certificates'
Expand Down Expand Up @@ -68,12 +68,11 @@ tracing:
enabled: false
url: ''

metrics:
enabled: false
url: ''
prometheus:
scrape: false
port: 8080
configManagement:
offlineMode: false
name: 'job-tracker'
version: 'latest'
serverUrl: 'http://localhost:8080/api'

image:
repository: job-tracker
Expand Down Expand Up @@ -137,6 +136,10 @@ env:
protocol: TCP
logLevel: info
logPrettyPrintEnabled: false
openTelemetryOptions:
enabled: false
url: ''
resourceAttributes: {}
responseCompressionEnabled: true
requestPayloadLimit: 1mb
queue:
Expand Down
Loading
Loading