Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e021082
feat: add redis storage configuration (MAPCO-11263)
almog8k Sep 7, 2026
c161e4f
feat: add redis connection (MAPCO-11263)
almog8k Sep 13, 2026
40ce69d
feat: add redis storage provider key deletion (MAPCO-11263)
almog8k Sep 13, 2026
ac6e467
feat: add redis prefix wipe and target existence check (MAPCO-11263)
almog8k Sep 13, 2026
a9f72f5
feat: report observed deleted count from storage providers (MAPCO-11263)
almog8k Sep 14, 2026
145f48b
feat: support redis in tiles deletion strategy (MAPCO-11263)
almog8k Sep 14, 2026
f5cd581
feat: wire redis storage provider into the container (MAPCO-11263)
almog8k Sep 14, 2026
7596d83
feat: remove unnecessary logging details for storage provider parameters
almog8k Sep 14, 2026
ab17828
test: add redis storage provider integration tests (MAPCO-11263)
almog8k Sep 14, 2026
98369d1
feat: wire redis cache deletion jobs to the deletion strategies (MAPC…
almog8k Sep 15, 2026
5431a37
chore(helm): add redis storage config and cache deletion capability p…
almog8k Sep 15, 2026
16b26cc
feat(redis): update Redis configuration to include port and database …
almog8k Sep 15, 2026
43c2c11
test: cover both deletion strategies end to end on shared storage bac…
almog8k Sep 15, 2026
db86801
fix(minio): update MINIO_IMAGE to use Quay.io instead of Docker Hub
almog8k Sep 15, 2026
935de35
chore(deps): bump @map-colonies/raster-shared to 9.0.0
almog8k Sep 23, 2026
b9cbcbc
refactor(redis): move scanCount under storage.redis.delete (MAPCO-11263)
almog8k Oct 4, 2026
ca8a303
refactor(clients): extract clients from storageProviders
almog8k Oct 4, 2026
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
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,26 @@ npm run test:watch

#### Integration tests

`npm run test:integration` needs an S3-compatible server. By default it starts a Minio
[testcontainer](https://testcontainers.com/) automatically.
The image is pinned to the release deployed in our Azure environment; bump it in
`tests/integration/helpers/minioContainer.ts` when that environment moves.
`npm run test:integration` needs an S3-compatible server and a Redis server. By default it starts
a Minio and a Redis [testcontainer](https://testcontainers.com/) automatically.
The images are pinned to the releases deployed in our environments; bump them in
`tests/integration/helpers/minioContainer.ts` and `tests/integration/helpers/redisContainer.ts`
when those environments move.

To run against an already-running Minio instead, set `TEST_MINIO_ENDPOINT`:
To run against already-running servers instead, set the `TEST_*` variables:

| Variable | Default | Purpose |
| ------------------------ | ------------ | ------------------------------------------------------------------ |
| Variable | Default | Purpose |
| ------------------------ | ------------ | -------------------------------------------------------------------- |
| `TEST_MINIO_ENDPOINT` | _(unset)_ | Point the suite at an existing Minio. Unset means start a container. |
| `TEST_MINIO_ACCESS_KEY` | `minioadmin` | Access key for that server. |
| `TEST_MINIO_SECRET_KEY` | `minioadmin` | Secret key for that server. |

> **The suite creates and deletes buckets on whichever endpoint it is given.** Never point
> `TEST_MINIO_ENDPOINT` at a shared or deployed environment, and beware of leaving it exported in a
> shell profile. Each run prints which mode it selected and against which endpoint.
| `TEST_MINIO_ACCESS_KEY` | `minioadmin` | Access key for that server. |
| `TEST_MINIO_SECRET_KEY` | `minioadmin` | Secret key for that server. |
| `TEST_REDIS_HOST` | _(unset)_ | Point the suite at an existing Redis. Unset means start a container. |
| `TEST_REDIS_PORT` | `6379` | Port for that server. |

> **The suite creates and deletes buckets on whichever Minio it is given, and calls `FLUSHDB` on
> whichever Redis it is given.** Never point `TEST_MINIO_ENDPOINT` or `TEST_REDIS_HOST` at a shared
> or deployed environment, and beware of leaving them exported in a shell profile. Each run prints
> which mode it selected and against which server.

## Customizing the Boilerplate

Expand Down
27 changes: 27 additions & 0 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,33 @@
"__name": "FS_SUB_PATHS",
"__format": "json"
}
},
"redis": {
"delete": {
"batchSize": {
"__name": "REDIS_DELETE_BATCH_SIZE",
"__format": "number"
},
"scanCount": {
"__name": "REDIS_SCAN_COUNT",
"__format": "number"
}
},
"host": "REDIS_HOST",
"port": {
"__name": "REDIS_PORT",
"__format": "number"
},
"db": {
"__name": "REDIS_DB",
"__format": "number"
},
"username": "REDIS_USERNAME",
"password": "REDIS_PASSWORD",
"tlsEnabled": {
"__name": "REDIS_TLS_ENABLED",
"__format": "boolean"
}
}
},
"strategies": {
Expand Down
25 changes: 24 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
{
"job": "Delete_Layer",
"task": "artifacts-deletion"
},
{
"job": "Update_Delete_Cache",
"task": "tiles-deletion"
},
{
"job": "Swap_Delete_Cache",
"task": "tiles-deletion"
}
]
}
Expand All @@ -58,6 +66,12 @@
},
"deleteLayer": {
"type": "Delete_Layer"
},
"updateCacheDeletion": {
"type": "Update_Delete_Cache"
},
"swapCacheDeletion": {
"type": "Swap_Delete_Cache"
}
},
"tasks": {
Expand All @@ -77,7 +91,7 @@
"shouldResetTimeout": true
},
"storage": {
"cleanupStorageProviders": ["FS", "S3"],
"cleanupStorageProviders": ["FS", "S3", "REDIS"],
"s3": {
"delete": {
"batchSize": 1000
Expand All @@ -97,6 +111,15 @@
"subPaths": {
"tilesSubPath": "tiles"
}
},
"redis": {
"delete": {
"batchSize": 1000,
"scanCount": 1000
},
"host": "localhost",
"port": 6379,
"db": 0
}
},
"strategies": {
Expand Down
5 changes: 5 additions & 0 deletions helm/templates/_tplValues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ Custom definitions
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.storage .Values.global.storage ) "context" . ) }}
{{- end -}}

{{/* storage.redis, then global.storage.redis, then the shared global.redis block */}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need it if we already have the storage.merged that handle it above

{{- define "common.redis.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list ((.Values.storage).redis | default dict) ((.Values.global.storage).redis | default dict) (.Values.global.redis | default dict) ) "context" . ) }}
{{- end -}}

{{- define "common.ca.merged" -}}
{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.ca .Values.global.ca ) "context" . ) }}
{{- end -}}
17 changes: 17 additions & 0 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{- $storage := fromYaml (include "common.storage.merged" .) -}}
{{- $s3 := ($storage.s3) | default dict -}}
{{- $fs := ($storage.fs) | default dict -}}
{{- $redis := fromYaml (include "common.redis.merged" .) -}}
{{- $internalPvc := (($fs).internalPvc) | default dict -}}
{{- $fsBasePath := clean (printf "/%s" $internalPvc.mountPath) -}}
{{- if .Values.enabled -}}
Expand Down Expand Up @@ -74,6 +75,22 @@ data:
{{- end }}
FS_SUB_PATHS: {{ $subPaths | toJson | quote }}
{{- end }}
{{- if has "REDIS" $storage.cleanupStorageProviders }}
REDIS_DELETE_BATCH_SIZE: {{ $redis.delete.batchSize | default 1000 | quote }}
REDIS_HOST: {{ $redis.host | quote }}
REDIS_PORT: {{ $redis.port | default 6379 | quote }}
REDIS_DB: {{ $redis.db | default 0 | quote }}
REDIS_SCAN_COUNT: {{ $redis.delete.scanCount | default 1000 | quote }}
REDIS_TLS_ENABLED: {{ $redis.tlsEnabled | default false | quote }}
{{- with $redis.auth }}
{{- if .enabled }}
{{- if .username }}
REDIS_USERNAME: {{ .username | quote }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we want it to be taken from a secret

{{- end }}
REDIS_PASSWORD: {{ .password | quote }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this one - from secret

{{- end }}
{{- end }}
{{- end }}
{{- with .Values.env.strategies.tilesDeletion }}
TILES_DELETION_BATCH_SIZE: {{ .batchSize | default 1000 | quote }}
TILES_DELETION_CONCURRENCY: {{ .concurrency | default 10 | quote }}
Expand Down
23 changes: 22 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ global:
metrics: {}
jobDefinitions: {}
storage: {}
redis: {}
serviceUrls: {}
ca: {}

Expand All @@ -13,7 +14,7 @@ serviceUrls:
jobTracker: ""

storage:
cleanupStorageProviders: {}
cleanupStorageProviders: [] # any of "FS", "S3", "REDIS"
s3:
delete:
batchSize: 1000
Expand All @@ -30,6 +31,19 @@ storage:
name: ""
mountPath: ""
tilesSubPath: "" # e.g. folder/tiles
redis:
host: ""
port: 6379
db: 0
# Same nesting as global.redis.auth; username is sent only when non-empty
auth:
enabled: false
username: ""
password: ""
tlsEnabled: false
delete:
batchSize: 1000
scanCount: 1000

mclabels:
component: backend
Expand Down Expand Up @@ -115,13 +129,20 @@ env:
queue:
heartbeatIntervalMs: 1000
dequeueIntervalMs: 3000
jobnik:
worker:
concurrency: 1
worker:
capabilities:
pairs:
- job: "Ingestion_Update"
task: "tiles-deletion"
- job: "Ingestion_Swap_Update"
task: "tiles-deletion"
- job: "Update_Delete_Cache"
task: "tiles-deletion"
- job: "Swap_Delete_Cache"
task: "tiles-deletion"
httpRetry:
attempts: 3
delay: "exponential"
Expand Down
69 changes: 65 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
"@map-colonies/js-logger": "^5.0.0",
"@map-colonies/mc-priority-queue": "^9.1.2",
"@map-colonies/mc-utils": "^6.0.1",
"@map-colonies/raster-shared": "^9.0.0-alpha.0",
"@map-colonies/raster-shared": "^9.0.0",
"@map-colonies/read-pkg": "^1.0.0",
"@map-colonies/schemas": "^1.20.0",
"@map-colonies/telemetry": "^10.0.1",
"@opentelemetry/api": "^1.9.0",
"compression": "^1.8.0",
"express": "^4.21.2",
"ioredis": "^6.0.0",
"prom-client": "^15.1.3",
"reflect-metadata": "^0.2.2",
"tsyringe": "^4.8.0",
Expand Down
2 changes: 2 additions & 0 deletions src/cleaner/clients/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { createRedisConnection } from './redisClient';
export { createS3Client } from './s3Client';
Loading
Loading