Build, deploy and release

Table of contents

Introduction

Your product reaches production through three commands. product:build compiles it, product:deploy runs it on this machine, and product:release publishes a version for everyone else. A server that only runs the product needs none of them, since a clone of the repository starts with docker compose.

splent product:build
splent product:deploy
Build compiles, deploy runs, release publishes product:build Compile Writes the deploy bundle, builds the production image. product:deploy Run Starts the containers from what build produced. product:release Publish Bumps the version, tags it, pushes to the forge, PyPI and the image registries. Nothing leaves this machine The only one that publishes
Build and deploy stay on the machine that runs them. Release is the one that sends things out.

Build and deploy never leave your machine. Release sends things out, and it is the only one you cannot undo.


Building and deploying

What build reads and writes, and what deploy runs BUILD READS <product>/pyproject.toml which features, at which versions <product>/docker/ env, Compose and the prod Dockerfile <feature>/docker/ env and Compose defaults, per feature product:build BUILD WRITES deploy/.env.example production env, secrets left empty deploy/docker-compose.yml every service, one self-contained stack image <product>:latest on this machine's Docker daemon product:deploy DEPLOY RUNS <product>_deploy Compose project, env from deploy/.env, your secrets kept across deploys web, published or built image db feature services
Deploy consumes what build produced. The web container runs the image a release published when there is one, or the one build made from the repository, and SPLENT_IMAGE in deploy/.env names another.

Build checks the product, writes the bundle deploy/ and the pins the image is built from, and builds the image. Deploy writes deploy/.env, asks for the secrets and starts the <product>_deploy project.

To put a change into production, run both again, or product:derive --prod, which does both. Commit what the build changed, since a server deploys what the repository says.


Deploying from a clone

A clone of the product runs with docker compose alone A CLONE OF THE PRODUCT deploy/, the bundle a host runs docker-compose.yml .env.example → .env features/<service>/ README.md what the image is built from docker/Dockerfile.<product>.prod pyproject.toml splent.contracts.json docker/spl/<spl>/ Image registry <product>:stable docker compose up -d refuses to start while a required value is empty THE HOST RUNS <product>_deploy Compose project web, pulled or built db feature services on its own network settings from deploy/.env data on named volumes
A host needs Docker and a clone of the product, nothing else. The compose file names its project, owns its network, and pulls the image a release published, or builds it from the repository when no release publishes one.
git clone <the product's repository> && cd <product>/deploy
cp .env.example .env      # then fill in the required values
docker compose up -d

.env.example gives every setting a working default except the secrets, which are empty and marked required. docker compose up starts nothing until each one is set. Choose the database passwords before the first start, since MariaDB keeps the ones it starts with.

  Your releases publish an image They do not
The web service runs <forge host>/<org>/<product>:stable <product>:<version>
The image is built By the release. The host pulls it On the host, on the first up, from PyPI at the pinned versions
To upgrade git pull, docker compose pull, docker compose up -d git pull, docker compose up -d --build

The database and uploads live on named volumes, so they survive upgrades, and the app applies its migrations when it starts.

To hold a server on one version, set SPLENT_IMAGE=<image>:<version> in .env. To build instead of pulling, run docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build.


Releasing a version

Release publishes a version to three channels, in order YOUR WORKSPACE <product>/ git repository every feature pinned, lint and tests green pyproject.toml version 1.2.2 becomes 1.2.3 product:release 1 PyPI <product> 1.2.3, permanent 2 The forge commit, tag v1.2.3, release page 3 Image registries <org>/<product>:1.2.3 and :stable BESIDES PUBLISHING It commits the deploy bundle and the pins for the version, so a clone of the tag runs it. It starts no container. A host runs a clone of the tag, or follows the stable tag.
PyPI goes first because a version there can never be replaced. The image registries go last because the image is the channel most able to diverge.
splent product:release

product:release first refuses a release a clone could not deploy, such as a product that does not validate, a pin nobody published, or a .gitignore that leaves out the bundle. Then it runs lint and tests, bumps the version, commits the bundle, and publishes to PyPI, the forge and the image registries.

If a step fails, release:resume finishes the rest without bumping the version again. A release deploys nothing, unless your product has a feature that deploys it.


Which one to run

You want to Run
Put a change into production on this machine product:build, then product:deploy
The same, in one command product:derive --prod
Check that the production image builds product:build
Regenerate the deploy files without the image product:build --no-image
Stop production product:deploy --down
Publish a version product:release
Run a released version on a host without SPLENT git clone, then docker compose up -d in deploy/
Run another image for one deploy product:deploy --image <ref>
Finish a release that stopped halfway release:resume product:<name>
Release a feature feature:release

Reference

  product:build product:deploy product:release
Reads The product’s pyproject.toml and docker/, and each feature’s docker/ at its pin deploy/ and the image it names The product’s repository, plus what build reads
Writes deploy/, the runtime pins, docker/requirements.lock, splent.contracts.json, docker/spl/, and the image <product>:<version> deploy/.env and the <product>_deploy containers A release commit and a tag
Sends out Nothing Nothing The tag and release page to the forge, the package to PyPI, the image to the registries
Needs Every production feature pinned to a published version A previous build A valid product, every feature pinned, lint and tests passing, credentials
Undo Run it again product:deploy --down None. A PyPI version is permanent

See also


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es