Skip to content

Commit bc4377c

Browse files
bump backend version + offloading documentation
1 parent dd66a46 commit bc4377c

7 files changed

Lines changed: 50 additions & 4 deletions

File tree

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,16 @@ OPENSANCTIONS_API_HOST=http://yente
156156
# The two pieces of information below will be provided to you after that.
157157
# FIREBASE_APP_ID=
158158
# FIREBASE_AUTH_DOMAIN=
159+
160+
# Set to true to offload decision rules content to blob storage.
161+
# This will enable a background task moving the rule payloads that are older than `OFFLOADING_BEFORE`
162+
# to blob storage to improve database efficiency, while keeping retention requirements.
163+
# If enabled, OFFLOADING_BUCKET_URL (see syntax above along with CASE_MANAGER_BUCKET_URL) must be set on the API and worker,
164+
# while the other variables below need only be set on the worker.
165+
# OFFLOADING_ENABLED=false
166+
# OFFLOADING_BUCKET_URL="file://./tempFiles/offloading-bucket?create_dir=true"
167+
# OFFLOADING_JOB_INTERVAL=30m
168+
# OFFLOADING_BEFORE=168h
169+
# OFFLOADING_BATCH_SIZE=10000
170+
# OFFLOADING_SAVE_POINTS=1000
171+
# OFFLOADING_WRITES_PER_SEC=200

docker-compose-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: marble
22

33
x-backend-image-version: &backend-image-version
4-
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-backend:v0.52.0
4+
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-backend:v0.52.1
55
x-frontend-image-version: &frontend-image-version
66
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-frontend:v0.52.0
77

docker-compose.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: marble
22

33
x-backend-image-version: &backend-image-version
4-
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-backend:v0.52.0
4+
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-backend:v0.52.1
55
x-frontend-image-version: &frontend-image-version
66
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-frontend:v0.52.0
77

@@ -47,6 +47,14 @@ x-backend-environment: &backend-env
4747
OPENSANCTIONS_API_HOST: ${OPENSANCTIONS_API_HOST}
4848
OPENSANCTIONS_AUTH_METHOD: ${OPENSANCTIONS_AUTH_METHOD}
4949
OPENSANCTIONS_API_KEY: ${OPENSANCTIONS_API_KEY}
50+
51+
OFFLOADING_ENABLED: ${OFFLOADING_ENABLED}
52+
OFFLOADING_BUCKET_URL: ${OFFLOADING_BUCKET_URL}
53+
OFFLOADING_JOB_INTERVAL: ${OFFLOADING_JOB_INTERVAL}
54+
OFFLOADING_BEFORE: ${OFFLOADING_BEFORE}
55+
OFFLOADING_BATCH_SIZE: ${OFFLOADING_BATCH_SIZE}
56+
OFFLOADING_SAVE_POINTS: ${OFFLOADING_SAVE_POINTS}
57+
OFFLOADING_WRITES_PER_SEC: ${OFFLOADING_WRITES_PER_SEC}
5058
x-frontend-environment: &frontend-env
5159
NODE_ENV: production
5260
PORT: ${APP_PORT:-8080}

installation/data_offloading.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Decision rule execution details offloading
2+
3+
Out of the box, Marble keeps a full audit trace of you decisions by storing not only the result of a rule execution, but also all the intermediate values computed during rule excution from ingested data, aggregates, etc. This allows you to to justify even past decisions in detail, and is also used by the AI agent to review alerts in the case manager in detail.
4+
5+
However, storing those details can quickly create pressure on the database disk as the data is initially stored inline.
6+
7+
### Basic configuration
8+
9+
It is possible to configure Marble to offload this data for a long-term storage outside of the main database, in a bucket storage solution like S3 or GCS. You do this by configuring the environment variables:
10+
11+
- on the background worker: `OFFLOADING_ENABLED` to `true` and `OFFLOADING_BUCKET_URL` to a valid URL of a storage bucket
12+
- on the API server: `OFFLOADING_BUCKET_URL`
13+
14+
The `OFFLOADING_JOB_INTERVAL`, `OFFLOADING_BEFORE`, `OFFLOADING_BATCH_SIZE`, `OFFLOADING_SAVE_POINTS` and `OFFLOADING_WRITES_PER_SEC` may further be configured on the background worker, but the default values should work in most cases. See the Marble deployment guide on Github for more details on those variables. By default, Marble will offload data on decisions older than a week.
15+
16+
### Storage classes
17+
18+
Old decisions are likely to be rarely consulted. For further cost savings, we recommend you configure your blob storage bucket to automatically move the data to long-term storage classes using lifecycle rules. Objects are stored by decision status prefix (`offloading/decision_rules/{status}` where `status` is one of `error`, `hit`, `no_hit`), so it is possible in most blob storage solutions to configure different lifecycle rules for rules that did or did not result in a hit.
19+
20+
Data offloaded to Google Cloud Storage may further use the custom time metadata attribute instead of the object's creation time for lifecycle rules.
21+
As an example, Marble's managed environment moves objects to "Nearline" storage class after a month, "Coldline" after 3 months and "Archive" after a year.

installation/production_run.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Purpose:
5252

5353
- Store CSV files for batch ingestion
5454
- Store documents for case management
55+
- Offload detailed data on rule execution from the main database, which would otherwise use up a lot of storage volume for nothing
56+
- Parquet data storage for analytics queries
5557

5658
Supported Providers:
5759

@@ -63,6 +65,8 @@ Supported Providers:
6365
Configuration details are available in `.env.example`.
6466
The .env file expects two different buckets for the two purposes, but you may use the same bucket for both.
6567

68+
> ⚠️ **Note**: We strongly suggest you configure data offloading to run in production. See [data offloading](./data_offloading.md)
69+
6670
### 3. Firebase Authentication
6771

6872
#### Setup Steps

kubernetes/.versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
MARBLE-FRONT-VERSION=0.52.0
2-
MARBLE-BACK-VERSION=0.52.0
2+
MARBLE-BACK-VERSION=0.52.1

0 commit comments

Comments
 (0)