# Versions and deployments in a network

> A version is an immutable set of bundles named by the hash of its content, and a deployment points a label selector of a Minekube network at a version: every server whose labels match runs its bundles, and one that starts later gets them by itself.

Versions and deployments are how code you build with Minekube Games reaches the servers of a [Connect network](https://minekube.com/guide/networks/concepts/network). A version says what runs. A deployment says where.

## Versions

A version is an immutable set of [bundles](https://minekube.com/games/concepts/bundle), each for a platform: for example a game for Paper and a proxy bundle for Velocity, built together.

- **The content names it.** A version's id is a hash over its bundles: each one's platform, name and content hash. The same bundles are always the same version, even when they are uploaded again.
- **It never changes.** A build with changed bundles is a new version. What you tested is what runs.
- **It belongs to a network.** Each network keeps its own versions, and only its members can fetch their bundles.

## Deployments

A deployment points a [label selector](https://minekube.com/guide/networks/labels) of the network at a version, such as `game=arena` at the newest build of your arena game.

- **Every matching server runs it.** Each server gets the bundles of every deployment whose selector matches its labels, for its own platform. Where two deployments have a bundle of the same name, the newer deployment wins.
- **It is desired state, not a push.** The Minekube API works out what each server should run, and the server's connector installs it. A server that starts later, or reconnects after a while, gets the current bundles by itself, with nothing to catch up on.
- **Many deployments side by side.** A network can run `channel=canary` on one version and everything else on another. A canary is a label, not a special feature.
- **Rolling back is deploying an earlier version** to the same selector. Ending a deployment leaves each server with what other deployments give it, and the version stays available.

When a server's bundles change, its runtime swaps them in [the same way `mk dev` does](https://minekube.com/games/concepts/runtime), while players stay connected.

## Why selectors and content hashes

- **Selectors, not percentages.** A server runs exactly one revision of each bundle, so every player on it sees the same game. Choosing servers by their labels says which ones, in the same language the network uses to route players.
- **Content hashes, not version numbers.** A hash cannot drift from what it names, and it is the same name the runtime, the recordings and the devtools use.
- **Desired state, not commands.** A server that was offline during a deployment does not miss it. When it comes back, it asks once and converges.

## What they are not

- **Not for clients.** Versions hold bundles for Paper and Velocity. Client bundles are installed on clients directly.
- **Not per bundle.** A deployment assigns a whole version to one selector. Bundles that should go to different servers are different versions.
- **Not a server image.** Deployments change the bundles a running server loads, never the server software, the Minekube plugin or the world. [Minekube Cloud](https://minekube.com/cloud/concepts) installs and updates servers.

## Built and planned

Versions, deployments, rolling back and ending a deployment are built, with bundles stored by their hash and installed by the connector. Planned: a project that declares its bundles and targets in its configuration, updates a game holds until a round ends, rollouts in waves, and hostnames per target.

## Related

- [Versions and deployments](https://minekube.com/games/versions-and-deployments/): deploy, list, roll back and end deployments.
- [Networks](https://minekube.com/guide/networks/concepts/network#versions-and-deployments-per-network): where versions and deployments live.
