- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| COPYING | ||
| COPYING.LESSER | ||
| MANIFEST.in | ||
| pyproject.toml | ||
| README.md | ||
splent_feature_webhook
The webhook feature of a SPLENT product line.
A SPLENT feature is a Python package that a product composes with others:
its models, routes, services, templates and hooks are registered when the
product starts. What this feature provides and requires is listed in the
[tool.splent.contract] section of pyproject.toml, which
splent feature:contract --write keeps in sync with the source.
What it does
POST /webhook/deploy with Authorization: Bearer $WEBHOOK_TOKEN redeploys
the product. uvlhub pulled new code inside its running containers; a SPLENT
product runs a released image (splent product:release pushes
<user>/<product>:latest), so this webhook pulls that image and has Compose
recreate the web container from it, from a short-lived docker:cli helper.
It needs, in production:
- the Docker socket mounted into the web container, as uvlhub's
docker-compose.prod.webhook.ymldid:/var/run/docker.sock:/var/run/docker.sock. That gives the app control of the host's Docker, so only mount it where the webhook is wanted; WEBHOOK_TOKENin.env.deploy, the same secret CI sends;WEBHOOK_COMPOSE_DIR, the host path of the product'sdocker/directory, whenproduct:deployran Compose from the CLI container (the usual case).
Use it in a product
splent feature:add splent_feature_webhook
Develop
splent feature:test splent_feature_webhook
splent feature:contract splent_feature_webhook
Release
splent feature:release splent_feature_webhook --dry-run --bump patch
splent feature:release splent_feature_webhook
The first command rehearses the release and changes nothing. The second publishes it to the git forge and to PyPI, and a PyPI version is permanent.