diff --git a/services/cojedzie/stack.yml b/services/cojedzie/stack.yml index bac3887..9311ceb 100644 --- a/services/cojedzie/stack.yml +++ b/services/cojedzie/stack.yml @@ -44,8 +44,25 @@ services: COJEDZIE_WORKER_OPTS: '-vv' COJEDZIE_WORKER_QUEUES: 'scheduler_default scheduler_hub scheduler_recorder' + # import jobs run in parallel on every worker (cojedzie ADR 0026) worker: <<: *worker + deploy: + mode: replicated + replicas: {{ cojedzie_worker_replicas|default(3) }} + + # state the workers share, e.g. the Sentry check-ins of running imports; reached only inside the stack + redis: + image: redis:{{ cojedzie_redis_version|default('7.4-alpine') }} + command: ["redis-server", "--appendonly", "yes"] + volumes: + - redis_data:/data + deploy: + mode: replicated + replicas: 1 + resources: + limits: + memory: 128M # departure history (cojedzie ADR 0020); reached only inside the stack clickhouse: @@ -128,3 +145,4 @@ volumes: clickhouse_data: ~ mercure_data: ~ mercure_config: ~ + redis_data: ~ diff --git a/services/cojedzie/templates/api.env b/services/cojedzie/templates/api.env index eb0732a..406ca29 100644 --- a/services/cojedzie/templates/api.env +++ b/services/cojedzie/templates/api.env @@ -12,3 +12,6 @@ SENTRY_SAMPLE_RATE={{ sentry_sample_rate_api }} # departure history; see cojedzie's contrib/agents/wiki/api/departure-history.md COJEDZIE_CLICKHOUSE_URL=http://cojedzie:{{ cojedzie_clickhouse_password | urlencode }}@clickhouse:8123/cojedzie COJEDZIE_DEPARTURE_HISTORY_RETENTION_DAYS={{ cojedzie_departure_history_retention_days }} + +# state shared by workers, e.g. Sentry check-ins of running imports +COJEDZIE_REDIS_URL=redis://redis:6379