feat(forgejo): sell add-ons through Creem's sandbox on dev #297
No reviewers
Labels
No labels
project
automation
project
ci
project
monitoring
project
secrets
bug
dashboard
dependency 📦️
type
enhancement
type
feature
type
question
type
refactor
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codefloe/infrastructure-as-code!297
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/billing-dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Turn on the fork's paid add-ons (codefloe/forgejo-codefloe#180) on dev.codefloe.com, selling through the sandbox of Creem's
codefloestore so nothing is charged.Changes
.envrc: read the sandbox API key fromsaas/creem/sandbox/api-keys/testasCREEM_API_KEY_DEV.environments/dev/host_vars/git-dev.yaml: addforgejo_billing_*(API key, test mode, webhook id and three products) and render[billing],[billing.creem]and one[billing.product.<key>]per product intoforgejo.ini.ci-1000: 1,000 CI minutes per unit ontime:ci:allandtime:ci:class:linux, EUR 5.00 per unit and month, up to 20 units.git-2g: 2 GiB per unit onsize:repos:all, EUR 1.00 per unit and month (EUR 0.50/GiB), up to 25 units.assets-5g: 5 GiB of asset storage per unit, EUR 1.00 per unit and month (EUR 0.20/GiB), up to 20 units. It is a shared pool: it namessize:assets:alland each ofsize:assets:packages:all,size:assets:attachments:allandsize:assets:artifacts, so it raises theall-assetsrule, which bounds the total, and each per-type cap, and the 5 GiB can go to packages, attachments or artifacts in any mix (tested in forgejo-codefloe#184).CI quota (all),CI quota (Linux),git,all-assets,packages,attachmentsandaction-artifactsrules, without which a product is offered to nobody.environments/dev/host_vars/git-dev.yaml: set theall-assetsrule from unlimited to 32G, the sum of the packages (20G), attachments (10G) and artifacts (2G) caps, so it never binds on its own and only becomes the pool the asset add-on raises. Wiki edits are checked against it too (Forgejo walkssize:wikiup tosize:assets:all), so they are refused once all three asset types are full.playbooks/tasks/forgejo-billing.yaml, imported byplaybook-git.yamlbeforeforgejo.iniis rendered: read the webhook's signing secret from Creem's API, and fail the deploy when a configured product is unknown to the store.The secret is read rather than stored in OpenBao so it cannot go stale when the webhook is re-created, and hosts without
forgejo_billing_products(prod) skip it.tests/test_forgejo_deploy.py: run the task file against a fake Creem for success, a missing webhook, an unknown product and a missing key, and check neither the key nor the secret reaches the output.The products (
prod_hvcQ0FgYh2azUIxO4qSLE,prod_7QItuJHW1pMLMgWXglSm0A,prod_5KkBsxGix0zi2hELTjBNrn) and the webhook (wh_test_7hvFFFsrrhhqmMW0olYPZi,https://dev.codefloe.com/-/billing/creem/webhook, checkout and subscription events) were created in the sandbox store for this.Validation
playbook-git.yaml:ok=120 changed=9 failed=0; the billing pre-tasks read the secret and found both products.billing-e2e: bought 2 units ofci-1000through Creem's sandbox checkout (test card 4111 1111 1111 1111), and the webhook raisedCI quota (all)andCI quota (Linux)from 180000 to 300000 seconds.Changing the quantity to 3 raised them to 360000, "Manage billing" opened the buyer's Creem portal, and "Cancel subscription" left the add-on counting as
scheduled_canceluntil 2026-10-29.All five Creem webhook deliveries were answered 200.
git-10g(10 GiB for EUR 3.00,prod_64cbme5ejjuB10qCDM9mDV) after review, and have not been bought on dev yet.python3 -m unittest discover -s testspasses apart fromtest_maintenance_strategy, which cannot importansibleon agent-dev's Homebrew Python and is unrelated.Not done here
all-assets: 32Gandassets: -1in every custom quota with an unlimited asset type (packages: -1for crowci, crow-plugins, pat-s, codefloe, devxy, ricochet), or their registries would be capped at 32G.saas/creem/prod/api-keys/main), live products, a live webhook, and the keys in the CI deploy's OpenBao mapping (forgejo-deploy-openbao.yaml).sub_4FQnnMqxV0H7CEzyvMXM44ofbilling-e2eis left to end on its own on 2026-10-29.8f144ad08b4e31b040a44e31b040a4a1bba6e83c