Skip to content
Open
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
38 changes: 22 additions & 16 deletions .redocly.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
lint:
plugins:
# This section is where you can import local plugins.
# We don't support community plugins.
# You don't need to import our built-in plugins and rules.
# Omit this section if you don't have custom plugins.
# - './local-plugin.js'
plugins: []
# This section is where you can import local plugins.
# We don't support community plugins.
# You don't need to import our built-in plugins and rules.
# Omit this section if you don't have custom plugins.
# - './local-plugin.js'

extends:
# This section is where you choose the base configurations.
# You may override specific settings in the subsequent sections.
- recommended # This is the default (and built in) configuration. If it is too strict, try `minimal`.

resolve:
# Use this when you have external links in your definition that are not publicly accessible.
# Not required for Redocly API registry links.
# We recommend using environment variables for when possible.
resolve: {}
# Use this when you have external links in your definition that are not publicly accessible.
# Not required for Redocly API registry links.
# We recommend using environment variables for when possible.

preprocessors:
# Preprocessors are rarely indicated -- avoid if possible.
# This section can be omitted.
preprocessors: {}
# Preprocessors are rarely indicated -- avoid if possible.
# This section can be omitted.

rules:
boolean-parameter-prefixes:
Expand All @@ -28,6 +28,12 @@ lint:
severity: error
no-empty-servers: off

decorators:
# Decorators modify the the definition after validation is complete, only in the bundling process.
# This section can be omitted if you don't use decorators.
# Due to warning from mc-model-type on the openapi linter - should be removed once fixed
no-required-schema-properties-undefined: off

no-invalid-media-type-examples:
severity: error

decorators: {}
# Decorators modify the the definition after validation is complete, only in the bundling process.
# This section can be omitted if you don't use decorators.
9 changes: 9 additions & 0 deletions .swcrc
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
}
}
}
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ ENV SERVER_PORT=8080

WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=build /tmp/buildApp/package*.json ./



RUN npm ci --only=production
RUN npm install --omit=dev

COPY --chown=node:node --from=build /tmp/buildApp/dist .
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"]

17 changes: 13 additions & 4 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,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": "TELEMETRY_TRACING_ENABLED",
"url": "TELEMETRY_TRACING_URL"
},
"metrics": {
"enabled": "TELEMETRY_METRICS_ENABLED",
"url": "TELEMETRY_METRICS_URL",
"interval": "TELEMETRY_METRICS_INTERVAL"
"enabled": "TELEMETRY_METRICS_ENABLED"
}
},
"server": {
Expand Down
13 changes: 7 additions & 6 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"telemetry": {
"logger": {
"level": "info",
"prettyPrint": false
"prettyPrint": false,
"opentelemetryOptions": {
"enabled": false
}
},
"shared": {},
"tracing": {
"enabled": false,
"url": "http://localhost:4318/v1/traces"
"isEnabled": false
},
"metrics": {
"enabled": false,
"url": "http://localhost:4318/v1/metrics",
"interval": 5,
"buckets": [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 50, 250, 500]
}
},
Expand Down Expand Up @@ -40,7 +41,7 @@
"reportsPath": "/validation-reports",
"ingestionSourcesDirPath": "",
"server": {
"port": "8080",
"port": 8080,
"request": {
"payload": {
"limit": "1mb"
Expand Down
19 changes: 12 additions & 7 deletions config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"telemetry": {
"logger": {
"level": "info",
"prettyPrint": false
"prettyPrint": false,
"opentelemetryOptions": {
"enabled": false
}
},
"shared": {},
"tracing": {
"enabled": false,
"url": "http://localhost:4318/v1/traces"
"isEnabled": false
},
"metrics": {
"enabled": false,
"url": "http://localhost:4318/v1/metrics",
"interval": 5,
"buckets": [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 50, 250, 500]
"enabled": false
}
},
"server": {
Expand Down Expand Up @@ -51,6 +51,11 @@
"polygonPartsManager": {
"baseUrl": "http://polygon-parts-manager-test"
},
"downloadServer": {
"publicDns": "http://localhost:8085",
"reportsDownloadPath": "downloads/validation-reports"
},
"reportStorageProvider": "FS",
"gpkgsLocation": "/app/tiles_outputs/gpkgs",
"ingestionSourcesDirPath": "tests/integration/shapeFiles",
"reportsPath": "tests/integration/validation-reports",
Expand Down
14 changes: 14 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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, {
files: ['**/*.spec.ts', '**/*.test.ts'],
plugins: { jest: jestPlugin },
rules: {
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
'import-x/no-named-as-default-member': 'off',
},
});
4 changes: 4 additions & 0 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ Custom definitions
{{- define "common.metrics.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics .Values.global.metrics ) "context" . ) }}
{{- end -}}

{{- define "common.openTelemetryOptions.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.env.openTelemetryOptions .Values.global.openTelemetryOptions ) "context" . ) }}
{{- end -}}
16 changes: 14 additions & 2 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $tracing := (include "common.tracing.merged" .) | fromYaml }}
{{- $metrics := (include "common.metrics.merged" .) | fromYaml }}
{{- $openTelemetryOptions := (include "common.openTelemetryOptions.merged" .) | fromYaml }}
{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }}
{{- $jobDefinitions := (include "common.jobDefinitions.merged" .) | fromYaml }}
{{- $fs := (include "common.fs.merged" .) | fromYaml }}
Expand All @@ -18,13 +18,19 @@ 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 }}
TELEMETRY_TRACING_ENABLED: {{ $tracing.enabled | quote }}
{{ if $tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracing.url }}
{{ end }}
{{ if $metrics.enabled }}
TELEMETRY_METRICS_ENABLED: {{ $metrics.enabled | quote }}
TELEMETRY_METRICS_URL: {{ $metrics.url }}
{{ end }}
JOB_MANAGER_BASE_URL: {{ $serviceUrls.jobManager | quote}}
HEARTBEAT_BASE_URL: {{ $serviceUrls.heartbeatManager | quote}}
Expand Down Expand Up @@ -59,4 +65,10 @@ data:
REPORT_STORAGE_PROVIDER: {{ $storage.reportProvider }}
DOWNLOAD_SERVER_PUBLIC_DNS: {{ $serviceUrls.downloadServerPublicDNS | quote }}
DOWNLOAD_SERVER_REPORTS_DOWNLOAD_PATH: {{ $jobDefinitions.tasks.validation.reportsDownloadPath | quote }}
{{- with .Values.configManagement }}
CONFIG_NAME: {{ .name | quote }}
CONFIG_VERSION: {{ .version | quote }}
CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }}
CONFIG_SERVER_URL: {{ .serverUrl | quote }}
{{- end -}}
{{- end }}
5 changes: 4 additions & 1 deletion helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- $releaseName := .Release.Name -}}
{{- $chartName := include "polygon-parts-worker.name" . -}}
{{- $metrics := (include "common.metrics.merged" .) | fromYaml }}
{{- $cloudProviderFlavor := include "polygon-parts-worker.cloudProviderFlavor" . -}}
{{- $cloudProviderDockerRegistryUrl := include "polygon-parts-worker.cloudProviderDockerRegistryUrl" . -}}
{{- $cloudProviderImagePullSecretName := include "polygon-parts-worker.cloudProviderImagePullSecretName" . -}}
Expand Down Expand Up @@ -87,6 +86,10 @@ spec:
env:
- name: SERVER_PORT
value: {{ .Values.env.targetPort | quote }}
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
{{- if .Values.caSecretName }}
- name: REQUESTS_CA_BUNDLE
value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }}
Expand Down
15 changes: 12 additions & 3 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ global:
cloudProvider: {}
tracing: {}
metrics: {}
openTelemetryOptions: {}
environment: ''
jobDefinitions: {}
serviceUrls: {}
Expand Down Expand Up @@ -72,11 +73,15 @@ cloudProvider:
tracing:
enabled: false
url: ""

metrics:
enabled: false
url: ""
prometheus:
scrape: false

configManagement:
offlineMode: false
name: 'polygon-parts-worker'
version: 'latest'
serverUrl: 'http://localhost:8080/api'

enabled: true
environment: development
Expand Down Expand Up @@ -132,6 +137,10 @@ env:
protocol: TCP
logLevel: info
logPrettyPrintEnabled: false
openTelemetryOptions:
enabled: false
url: ''
resourceAttributes: {}
responseCompressionEnabled: true
requestPayloadLimit: 1mb
disableHttpClientLogs: false
Expand Down
Loading
Loading