@zigordev/stack 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -172,7 +172,11 @@ KAFKA_SETUP: |
172
172
  allow notes-api Read group notes-api. prefixed
173
173
  ```
174
174
 
175
- On the laptop the job also needs `KAFKA_PASSWORD_NOTES_API`, a throwaway password in `compose.local.yaml`. The app reaches the broker with three settings, which `@zigordev/events` reads: `KAFKA_BROKERS: kafka:9092`, `KAFKA_USERNAME: notes-api` and `KAFKA_PASSWORD`, the same password. Where an app's password lives in production is decided with the first app that needs one.
175
+ On the laptop the job also needs `KAFKA_PASSWORD_NOTES_API`, a throwaway password in `compose.local.yaml`. The app reaches the broker with three settings, which `@zigordev/events` reads: `KAFKA_BROKERS: kafka:9092`, `KAFKA_USERNAME: notes-api` and `KAFKA_PASSWORD`, the same password. In production an app's password lives once, at its own `/<product>/KAFKA_PASSWORD` in Parameter Store. A line of `.env.production.example` names it, such as `KAFKA_PASSWORD_NOTIFICATIONS_API=/notifications/KAFKA_PASSWORD`, and the host's deploy reads it from there. [Record 0028](../docs/adr/0028-the-shared-services-read-each-apps-kafka-password-from-the-apps-own-parameter.md) says why.
176
+
177
+ `KAFKA_SETUP` holds one user today, `notifications-api`, the notifications service. It reads every app's requests and writes every app's answers, through three prefixed rules that never change when an app joins. On the laptop its password is `local-only-notifications-api`.
178
+
179
+ On the laptop the job reads a second list after `KAFKA_SETUP`: `KAFKA_SETUP_LAPTOP`, in `compose.local.yaml`, for users that only a laptop needs. Production never sets it. It holds one user today, `template-api`, the product template's API, which sends its emails through the notifications service and never deploys. Its throwaway password is `local-only-template-api`.
176
180
 
177
181
  The broker formats its own storage before the image starts it, and makes the users `admin` and `setup` there, because image 4.4.0 ignores the setting that would do that. [Record 0027](../docs/adr/0027-the-broker-formats-its-own-storage-and-one-list-holds-its-topics-users-and-rules.md) says why.
178
182
 
@@ -45,6 +45,19 @@ services:
45
45
  profiles: [setup]
46
46
  environment:
47
47
  KAFKA_SETUP_PASSWORD: local-only-setup
48
+ KAFKA_SETUP_LAPTOP: |
49
+ user template-api
50
+ topic notifications.requests.template-api 1
51
+ topic notifications.requests.template-api.dead-letter 1
52
+ topic notifications.outcomes.template-api 1
53
+ topic notifications.outcomes.template-api.dead-letter 1
54
+ allow template-api Write topic notifications.requests.template-api
55
+ allow template-api Read topic notifications.outcomes.template-api
56
+ allow template-api Write topic notifications.outcomes.template-api.dead-letter
57
+ allow template-api Read group template-api. prefixed
58
+ allow notifications-api Write topic notifications.requests.template-api.dead-letter
59
+ KAFKA_PASSWORD_NOTIFICATIONS_API: local-only-notifications-api
60
+ KAFKA_PASSWORD_TEMPLATE_API: local-only-template-api
48
61
 
49
62
  lgtm:
50
63
  image: grafana/otel-lgtm:0.41.1@sha256:1b852b77d7bcadb7699bfe7c78a51d059dff85168de674728cf7abf4474645e5
package/compose.yaml CHANGED
@@ -398,7 +398,7 @@ services:
398
398
  exit 1
399
399
  ;;
400
400
  esac
401
- done <<< "$${KAFKA_SETUP:-}"
401
+ done <<< "$$(printf '%s\n%s\n' "$${KAFKA_SETUP:-}" "$${KAFKA_SETUP_LAPTOP:-}")"
402
402
  echo "kafka-setup: done"
403
403
  user: "1000:1000"
404
404
  init: true
@@ -411,7 +411,11 @@ services:
411
411
  cpus: 0.5
412
412
  environment:
413
413
  KAFKA_HEAP_OPTS: -Xms128m -Xmx256m
414
- KAFKA_SETUP: ""
414
+ KAFKA_SETUP: |
415
+ user notifications-api
416
+ allow notifications-api Read topic notifications.requests. prefixed
417
+ allow notifications-api Write topic notifications.outcomes. prefixed
418
+ allow notifications-api Read group notifications-api. prefixed
415
419
  tmpfs:
416
420
  - /tmp
417
421
  - /opt/kafka/logs:uid=1000,gid=1000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zigordev/stack",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "The shared services of the zigordev platform for a laptop: the ingress, the telemetry agent, a local Grafana and a mail catcher, as compose files with one command that starts them",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",