Skip to content

Commit

Permalink
compose.yaml: autopair first-party leader
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tgeoghegan committed Jun 14, 2024
1 parent 8185776 commit 233cf84
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 21 additions & 12 deletions compose.dev.override.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
# 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/
action: rebuild

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
22 changes: 22 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 233cf84

Please sign in to comment.