feat(provision): kongctl bootstrap scripts for OpenMeter catalog#53
Conversation
Replace the Go clearinghouse-bootstrap CLI with thin cross-platform kongctl scripts and a JSON catalog for idempotent Konnect metering setup.
There was a problem hiding this comment.
@eliteprox looks good to me. I good it working with the instructions. I did however run into one issue though. The .env.example does not contain the OPENMETER_URL placeholder which will cause it to always fallback to https://us.api.konghq.com/v3/openmeter which will print the following:
== catalog (https://us.api.konghq.com/v3/openmeter) ==
meter network_fee_usd_micros — exists
meter billable_usd_micros — exists
meter signed_ticket_count — exists
feature network_spend — exists
feature billable_spend — exists
plan clearinghouse_default_ppu — active
done.But not create anything on my org as I'm in the eu region. Could be your script is not handling errors correctly.
Good to be merged if you handled my comments.
…scripts - Updated `README.md` to reflect changes in OpenMeter environment variables, including the addition of `OPENMETER_URL`. - Modified `openmeter-collector/.env.example` to include `OPENMETER_URL` and clarify its usage. - Enhanced `bootstrap.ps1` and `bootstrap.sh` scripts to derive `OPENMETER_URL` from `OPENMETER_INGEST_URL` if not set, improving flexibility. - Added error handling and response validation in API helper functions within the bootstrap scripts for better reliability.
…R review" This reverts commit 97552cc.
There was a problem hiding this comment.
Pull request overview
Adds an OpenMeter/Konnect provisioning workflow to bootstrap the metering catalog and customers using kongctl api, and updates top-level docs/env examples to point users at the new provisioning path instead of the old Go bootstrap CLI.
Changes:
- Add
openmeter-collector/provision/with idempotent bootstrap scripts (bash + PowerShell) plus a data-drivencatalog.json. - Document the provisioning workflow and Konnect setup in a new provision README (including identity/subject-key contract).
- Update root
README.mdandopenmeter-collector/.env.exampleto referenceOPENMETER_URLand the new bootstrap commands/docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates bootstrap instructions to point at the new kongctl provision scripts and references the new catalog data file. |
| openmeter-collector/provision/README.md | New docs for running the catalog/customer bootstrap (bash + PowerShell), configuration, and identity contract. |
| openmeter-collector/provision/catalog.json | Declares meters/features/plan configuration consumed by the bootstrap scripts. |
| openmeter-collector/provision/bootstrap.sh | New bash bootstrap script implementing catalog/customer provisioning via kongctl api + jq. |
| openmeter-collector/provision/bootstrap.ps1 | New PowerShell bootstrap script implementing the same provisioning flow on Windows. |
| openmeter-collector/.env.example | Adds OPENMETER_URL and clarifies env expectations for collector vs bootstrap scripts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixed in c5609da Root cause:
For EU orgs, set both to the eu host:
|
…cs with collector - Add soft kapi helpers (bash + PowerShell) for publish, subscription, and feature-recreate delete so optional paths warn instead of aborting the run - Fix header comment: scripts warn on missing subject_keys, never mutate them - Derive OPENMETER_URL from ingest URL using trailing-only /events strip (ps1) - Remove usage_subject from catalog dimensions; use external_user_id to match collector.yaml; clarify billable_usd_micros is phase-2 (not yet emitted) - Fix provision README identity contract and remove broken screenshot links
…rap scripts - Modified the subscription creation logic in both PowerShell and Bash scripts to use a new structured format for the request body, enhancing clarity and consistency. - The new format encapsulates customer and plan details in a more organized manner, improving maintainability of the code.
- Changed the paths for the environment file in both PowerShell and Bash bootstrap scripts to point to the repo-root `.env` instead of the previous relative paths. - Updated the README to reflect the new location of the `.env` file, clarifying the setup instructions for users.
Summary
openmeter-collector/provision/— idempotent Konnect metering bootstrap viakongctl api(catalog, customers, plan publishing)clearinghouse-bootstrapCLIReplaces #51's scope with a clean branch off
main(no collector or identity-webhook changes).Manual test walkthrough (verified)
End-to-end test against a fresh Konnect org so the catalog starts empty.
1. Create a new Konnect org
From the org picker, click + Create to provision a clean Metering & Billing workspace.
2. Name the org
Example used for this test: Clearinghouse Example Org.
3. Create a Personal Access Token for bootstrap
Profile menu → Personal access tokens → Generate.
admin provisioning(or similar)kpat_…token immediately — it is shown only once.4. Set the env file
cp openmeter-collector/.env.example openmeter-collector/.env # edit OPENMETER_API_KEY=kpat_… (the PAT from step 3)The bootstrap scripts auto-load
openmeter-collector/.env— no need tosourceit.5. Run catalog bootstrap (first run)
cd openmeter-collector/provision ./bootstrap.sh catalogObserved output (fresh org — all objects created):
6. Re-run — idempotency confirmed
Observed output (existing objects left untouched):
Test plan
Prerequisites
kongctlandjqinstalled (command -v kongctl jq)kpat_…) with Metering & Billing accessopenmeter-collector/.envconfigured withOPENMETER_API_KEYCatalog bootstrap
./bootstrap.sh catalogon fresh org — all meters/features/plan created./bootstrap.sh catalog— all linesexists/active, no errorsCustomer provisioning
./bootstrap.sh customer demo-client demo-user "Demo User"./bootstrap.sh all demo-client demo-user "Demo User" --subscribeREADME
openmeter-collector/provision/README.md./bootstrap.shcommands match the provision README