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
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#local helm configs
helm/local
Chart.lock

# Logs
logs
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit ${1}
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0);
}
const husky = (await import('husky')).default;
console.log(husky());
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx pretty-quick --staged
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FROM node:24 AS mid

WORKDIR /usr/src/app
COPY ./package*.json ./
COPY .husky/ .husky/
RUN npm install
COPY . .
RUN npm run build
Expand All @@ -35,10 +36,12 @@ RUN npm run build
FROM node:24-slim AS production

ENV NODE_ENV=production
ENV CONFIG_OFFLINE_MODE=true

# install the application
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node .husky/ .husky/
RUN npm ci --only=production

RUN apt-get update || : && apt-get install python3 -y
Expand All @@ -61,5 +64,5 @@ RUN chmod -R 777 /mapproxy

USER node
EXPOSE 8080
CMD ["dumb-init", "node", "./index.js"]
CMD ["dumb-init", "node", "--import", "./instrumentation.mjs", "./index.js"]

42 changes: 33 additions & 9 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
{
"openapiConfig": {
"filePath": "OPENAPI_FILE_PATH"
},
"telemetry": {
"serviceName": "TELEMETRY_SERVICE_NAME",
"hostname": "TELEMETRY_HOST_NAME",
"version": "TELEMETRY_SERVICE_VERSION",
"logger": {
"level": "LOG_LEVEL",
"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 All @@ -36,6 +45,21 @@
}
}
},
"httpRetry": {
"attempts": {
"__name": "HTTP_RETRY_ATTEMPTS",
"__format": "number"
},
"delay": "HTTP_RETRY_DELAY",
"shouldResetTimeout": {
"__name": "HTTP_RETRY_RESET_TIMEOUT",
"__format": "boolean"
},
"disableHttpClientLogs": {
"__name": "HTTP_RETRY_DISABLE_CLIENT_LOGS",
"__format": "boolean"
}
},
"queue": {
"jobManagerBaseUrl": "QUEUE_JOB_MANAGER_BASE_URL",
"heartbeat": {
Expand Down
34 changes: 19 additions & 15 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
{
"openapiConfig": {
"filePath": "./openapi3.yaml",
"basePath": "/docs",
"rawPath": "/api",
"uiPath": "/api"
},
"telemetry": {
"logger": {
"level": "info",
"prettyPrint": false
"prettyPrint": false,
"opentelemetryOptions": {
"enabled": false
}
},
"shared": {},
"tracing": {
"enabled": false,
"url": "http://localhost:4318/v1/traces"
},
"metrics": {
"enabled": false,
"url": "http://localhost:4318/v1/metrics",
"interval": 5
"isEnabled": false
}
},
"server": {
"port": "8080",
"port": 8080,
"request": {
"payload": {
"limit": "1mb"
Expand All @@ -26,14 +30,14 @@
"enabled": true,
"options": null
}
},
"httpRetry": {
"attempts": 5,
"delay": "exponential",
"shouldResetTimeout": true,
"disableHttpClientLogs": true
}
},
"httpRetry": {
"attempts": 5,
"delay": "exponential",
"shouldResetTimeout": true,
"disableHttpClientLogs": true
},
"queue": {
"jobManagerBaseUrl": "http://localhost:8088",
"heartbeat": {
Expand Down
20 changes: 20 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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',
},
},
{
ignores: ['dist', 'coverage', 'reports', 'helm', '.husky', 'tests/unit/mapproxyUtils', 'tests/mockData'],
}
);
4 changes: 4 additions & 0 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Custom definitions
{{- 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 -}}

{{- define "common.serviceUrls.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceUrls .Values.global.serviceUrls ) "context" . ) }}
{{- end -}}
Expand Down
25 changes: 21 additions & 4 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 }}
{{- $configmapName := include "configmap.fullname" . }}
{{- $redis := (include "common.redis.merged" .) | fromYaml }}
{{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }}
Expand All @@ -19,9 +19,13 @@ data:
{{ if $tracing.enabled }}
TELEMETRY_TRACING_URL: {{ $tracing.url }}
{{ end }}
{{ if $metrics.enabled }}
TELEMETRY_METRICS_ENABLED: {{ $metrics.enabled | quote }}
TELEMETRY_METRICS_URL: {{ $metrics.url }}
{{-with $openTelemetryOptions -}}
OPENTELEMETRY_LOGGING_ENABLED: {{ .enabled | quote }}
{{ if .enabled }}
OPENTELEMETRY_LOGGING_URL: {{ .url | quote }}
{{ if .resourceAttributes }}
OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }}
{{ end }}
{{ end }}
npm_config_cache: /tmp/
QUEUE_JOB_MANAGER_BASE_URL: {{ $serviceUrls.jobManager | quote}}
Expand All @@ -30,7 +34,14 @@ data:
QUEUE_DEQUEUE_INTERVAL_MS: {{ .Values.env.queue.dequeueIntervalMs | quote}}
QUEUE_JOB_TYPE: {{ $jobDefinitions.jobs.seed.type | quote}}
QUEUE_TASK_TYPE: {{ $jobDefinitions.tasks.seed.type | quote}}
HTTP_RETRY_ATTEMPTS: {{ .Values.env.httpRetry.attempts | quote }}
HTTP_RETRY_DELAY: {{ .Values.env.httpRetry.delay | quote }}
HTTP_RETRY_RESET_TIMEOUT: {{ .Values.env.httpRetry.shouldResetTimeout | quote }}
HTTP_RETRY_DISABLE_CLIENT_LOGS: {{ .Values.env.httpRetry.disableHttpClientLogs | quote }}
MAPPROXY_API_URL: {{ $serviceUrls.mapproxyApi | quote}}
MAPPROXY_YAML_DIR: {{ .Values.env.mapproxy.mapproxyYamlDir | quote }}
SEED_YAML_DIR: {{ .Values.env.mapproxy.seedYamlDir | quote }}
GEOMETRY_TXT_FILE: {{ .Values.env.mapproxy.geometryTxtFile | quote }}
JOB_TRACKER_URL: {{ $serviceUrls.jobTracker | quote}}
SEED_ATTEMPTS: {{ .Values.env.seedAttempts | quote}}
SEED_CONCURRENCY: {{ .Values.env.seedConcurrency | quote}}
Expand All @@ -44,4 +55,10 @@ data:
MAPPROXY_CMD_COMMAND: {{ .Values.env.mapproxyCmdCommand | quote }}
INVALID_BBOX_INITIAL_BUFFER_METERS: {{ .Values.env.invalidBboxInitialBufferMeters | quote }}
INVALID_BBOX_RETRY_LIMIT: {{ .Values.env.invalidBboxRetryLimit | quote }}
{{- with .Values.configManagement }}
CONFIG_NAME: {{ .name | quote }}
CONFIG_VERSION: {{ .version | quote }}
CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }}
CONFIG_SERVER_URL: {{ .serverUrl | quote }}
{{- end }}
{{- end }}
25 changes: 23 additions & 2 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: {}
storage:
Expand Down Expand Up @@ -112,7 +113,13 @@ tracing:
metrics:
enabled: false
url: ''


configManagement:
offlineMode: true
name: 'cache-seeder'
version: 'latest'
serverUrl: 'http://localhost:8080/api'

image:
repository: cache-seeder
tag: 'latest'
Expand All @@ -132,13 +139,27 @@ env:
protocol: TCP
logLevel: info
logPrettyPrintEnabled: false
openTelemetryOptions:
enabled: false
url: ''
resourceAttributes: {}
responseCompressionEnabled: true
requestPayloadLimit: 1mb


httpRetry:
attempts: 5
delay: exponential
shouldResetTimeout: true
disableHttpClientLogs: true

queue:
heartbeat:
heartbeatIntervalMs: 3000
dequeueIntervalMs: 2000
mapproxy:
mapproxyYamlDir: /mapproxy/mapproxy.yaml
seedYamlDir: /mapproxy/seed.yaml
geometryTxtFile: /mapproxy/coverage.json
seedAttempts: 5
seedConcurrency: 5
mapproxyCmdCommand: "mapproxy-seed"
Expand Down
Loading
Loading