From 233cf84b1ce7be294a76d180915187f516de631a Mon Sep 17 00:00:00 2001 From: Tim Geoghegan Date: Thu, 13 Jun 2024 17:22:10 -0700 Subject: [PATCH] compose.yaml: autopair first-party leader To enable the demo workflow, users will need to pair two aggregators with the control plane. Further, one of them must be first-party, which can only be done using a CLI built with feature `admin`. But the one we distribute via GitHub releases isn't, and I argue it shouldn't be, which means that demo users can't appropriately pair aggregators. We could provide a `curl` or `wget` command that'd do it, but as it turns out, we already bundle the `divviup` CLI in the `divviup_api` container, so let's just use that, since the API URL and token for the aggregators are static! I'm thinking we should have the demo user pair the other aggregator themselves with `divviup` to simulate what they might have to do in a realistic use case, if they bring their own helper. This commit: - adds feature `admin` to builds of `divviup_api_integration_test` in `docker-release.yaml` so that the bundled CLI will have `--first-party` and `--shared` - adds a service `pair_aggregator` to `compose.yaml` that uses the `/divviup` entrypoint to pair `janus_1_aggregator` as a first-party, shared aggregator - adds a stanza for `pair_aggregator` to `compose.dev.override.yaml` - makes `compose.dev.override.yaml` build all images with features `integration_test,admin` Part of #1096 --- .github/workflows/docker-release.yml | 2 +- compose.dev.override.yaml | 33 ++++++++++++++++++---------- compose.yaml | 22 +++++++++++++++++++ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index f8b9541b..e8a3782b 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -10,7 +10,7 @@ jobs: matrix: image: [ { name: "divviup_api", rust_features: "default" }, - { name: "divviup_api_integration_test", rust_features: "integration-testing" }, + { name: "divviup_api_integration_test", rust_features: "integration-testing,admin" }, ] permissions: id-token: write diff --git a/compose.dev.override.yaml b/compose.dev.override.yaml index cfec4b75..136ae1f0 100644 --- a/compose.dev.override.yaml +++ b/compose.dev.override.yaml @@ -1,14 +1,19 @@ # Overrides for the local development docker compose setup. Meant only to be used by # compose.dev.yaml +x-build: &build + build: + context: . + args: + RUST_PROFILE: dev + # We don't need both of these features in all three services, but it allows reusing one + # container image for both this and the divviup_api service. + RUST_FEATURES: integration-testing,admin + services: divviup_api: image: !reset null - build: - context: . - args: - RUST_PROFILE: dev - RUST_FEATURES: integration-testing + <<: *build develop: watch: - path: src/ @@ -16,16 +21,20 @@ services: divviup_api_migrate: image: !reset null - build: - context: . - args: - RUST_PROFILE: dev - # This isn't strictly required for migrations, but it allows reusing one container image - # for both this and the divviup_api service. - RUST_FEATURES: integration-testing + <<: *build develop: watch: - path: migration action: rebuild ignore: - README.md + + pair_aggregator: + image: !reset null + <<: *build + develop: + watch: + - path: cli/ + action: rebuild + - path: client/ + action: rebuild diff --git a/compose.yaml b/compose.yaml index c6c640e9..15421d95 100644 --- a/compose.yaml +++ b/compose.yaml @@ -53,6 +53,28 @@ services: postgres: condition: service_started + pair_aggregator: + image: ${DIVVIUP_API_IMAGE:-us-west2-docker.pkg.dev/divviup-artifacts-public/divviup-api/divviup_api_integration_test:0.3.12} + entrypoint: + - /divviup + - --url=http://localhost:8080 + - --token="" + - aggregator + - create + - --name=leader + - --api-url=http://janus_1_aggregator:8080/aggregator-api + - --bearer-token=0000 + - --first-party + - --shared + network_mode: service:divviup_api + depends_on: + divviup_api: + condition: service_healthy + janus_1_aggregator: + condition: service_healthy + janus_2_aggregator: + condition: service_healthy + divviup_api: image: ${DIVVIUP_API_IMAGE:-us-west2-docker.pkg.dev/divviup-artifacts-public/divviup-api/divviup_api_integration_test:0.3.12} ports: