Deployments
A deployment is how you run your application on Mengi Cloud. You point Mengi at a Docker image (or a Helm chart), choose where it runs and how much CPU/memory it gets, and Mengi provisions it on a Kubernetes cluster, with a public HTTPS URL, persistent storage and environment variables wired up for you.
You describe the app in the dashboard (or via the API) and Mengi continuously keeps the cluster matching that description, you never have to touch Kubernetes or write YAML.
What Mengi creates for a deployment
When a deployment reaches running, Mengi has created the following on the cluster:
| Resource | Purpose |
|---|---|
| A Deployment (pods) | Runs your container image with the CPU/memory and replica count you chose |
| A Service | Stable in-cluster network address for your pods |
| An Ingress + TLS certificate | Public HTTPS URL, with a TLS certificate issued and renewed automatically |
| A PersistentVolumeClaim | Only if you added persistent storage |
| A ConfigMap / Secret | Holds your environment variables (secret values stay encrypted) |
| A VerticalPodAutoscaler | Docker deployments on dedicated clusters Mengi created only: adjusts the pods’ CPU/memory requests to actual use (see CPU and memory) |
You can delete everything at any time from the dashboard, deleting a deployment removes all of these resources from the cluster.
Part 1, Create a deployment
Start from New deployment in the dashboard. The wizard has four steps.
1. Choose where it runs
Every deployment runs on a Kubernetes cluster. The choice has two dimensions: the cluster type (shared or dedicated) and whether you use one that already exists or create a new one. The step lists your existing clusters grouped by geographic region, each tagged Shared or Dedicated, alongside options to create a new one.
- Shared cluster, a managed, multi-tenant cluster. The quickest option,
with nothing to maintain. A flat per-cluster monthly fee and nothing else:
the host infrastructure is paid by Mengi. Ideal for prototypes, staging and
side projects; not meant for production, there is no SLA, and persistent
volumes are not backed up. See the pricing page
for current rates.
- Use an existing one, pick a shared cluster already running in your chosen region.
- Create one inline, if a region has no shared cluster yet, pick Create shared cluster and Mengi provisions it as part of creating the deployment. No separate step.
- Capacity, a shared cluster has a fixed allowance of CPU and memory
requests shared by everything you run on it, including its own system
components. When you size a deployment or database, Mengi checks the
allowance that is still free and tells you before you create it if it
will not fit; the API answers the same request with
409 Conflictand the numbers. Pick a smaller size or fewer replicas, remove other workloads, or use a dedicated cluster.
- Dedicated cluster, your own single-tenant cluster, on Mengi’s
infrastructure or your own cloud account (BYOC). Full isolation and
control.
- Use an existing one, pick any dedicated cluster you’ve already created.
- Create a new one, Create dedicated cluster takes you to the cluster creation flow first; once it’s running, come back and deploy onto it.
- Just created, a cluster reports running a few minutes before its
platform components (ingress, certificates, secret store) are installed.
Until then a new deployment is refused (the API answers
409 Conflict); try again in a few minutes. A database created in that window waits as pending and is provisioned automatically once the cluster is ready.
Shared clusters can be created inline here; dedicated clusters are created in their own flow and then selected. See Shared vs. dedicated clusters for how to choose.
2. Choose the service type
- Docker, deploy any container image from a public or private registry
(e.g.
nginx:latest,ghcr.io/owner/app:1.4.2). - Helm, deploy a Helm chart from a chart repository (repo URL + chart name +
version), with optional custom
values.yaml. Mengi can inspect the chart so you can see its default values before deploying.
3. Configure the deployment
For a Docker deployment:
- Image, enter the image reference. Mengi analyses the image (see Image analysis below) and pre-fills the container port, suggested environment variables and volumes.
- Container port, the port your app listens on (defaults to a common value; adjust if analysis didn’t detect it).
For a Helm deployment: provide the chart repo, name and version, and any values overrides.
For both types you then set:
- Name, a recognisable name for the deployment.
- Resources, CPU and memory, via presets (Small / Medium / Large / X-Large) or a custom value. CPU runs from a fraction of a vCPU up to several vCPUs; memory from 128 MB up to several GB. What you set is the request; see CPU and memory for how limits follow from it and how requests are adjusted automatically.
- Replicas, how many copies of your app to run (default 1). More replicas = higher availability and throughput.
- Environment variables (optional), add key/value pairs. Each value is either plain text or a secret reference (see Environment variables and secrets). Image analysis flags variables an image expects.
- Persistent storage (optional), add one or more volumes, each with a mount path and a size in GB, for data that must survive restarts. Volumes are not backed up unless you turn on backups, which need a dedicated cluster; on a shared cluster, data in a volume is lost if the volume is lost. See Volume sizes and the provider minimum for what happens when you request less than the provider’s minimum.
- Image update strategy (Docker only, optional), let Mengi automatically
roll out new image versions as they’re published. Choose a strategy
(semver, newest-build, digest, or alphabetical) and, for
semver, a constraint such as
~1.0or^2.0. Leave it disabled to update only when you change the image yourself. - Command and arguments (Docker only, optional), override what the
container runs, with standard Kubernetes semantics: command replaces the
image’s
ENTRYPOINT, arguments replaces itsCMD. Leave both empty and the image’s own settings apply. See Overriding the container command.
4. Confirm
If creating new infrastructure requires it, you’ll confirm your payment method,
then create the deployment. It moves through pending → provisioning → running.
Once running, the dashboard shows its public URL.
Image analysis (what Mengi detects)
When you enter a Docker image, Mengi analyses it (and caches the result) and suggests sensible defaults so you don’t have to hunt through the image’s documentation. It surfaces:
- Ports the image exposes.
- Environment variables the image expects, marked required or optional with a short description.
- Volumes / mount points the image uses for data.
- Backing services it likely needs (PostgreSQL, Redis, MongoDB, …).
- Health-check and best-practice suggestions, and a 12-factor readiness view.
These are suggestions, you can override any of them before creating the deployment.
Environment variables and secrets
Every deployment can take environment variables. Each one is either:
- a plain value you type in, or
- a secret reference, the value comes from a secret instead of being stored in the deployment’s configuration.
Use secrets for anything sensitive, passwords, API keys, tokens. When you add an environment variable you can:
- Pick an existing secret, secrets you created on the Secrets page are offered in a dropdown.
- Create one inline, add a new secret right from the environment-variable row, without leaving the wizard.
Secret values are injected into your container at runtime and never appear in the deployment configuration or the dashboard. This is also how you connect a managed database: the database publishes its credentials as a secret, and you reference that secret here so the password reaches your app without ever being copied around.
Overriding the container command
One image often serves several roles: a Django application ships a single image, but the web server, the background worker and the scheduler each start a different process. Instead of building an image per role, create one deployment per role from the same image and set command / arguments on each.
Both fields are arrays of strings with standard Kubernetes semantics:
- Command replaces the image’s
ENTRYPOINT. - Arguments replaces the image’s
CMD. - Leave a field empty and the image’s own setting applies. Existing deployments are unaffected until you set one.
For example, the three roles of a Django stack:
| Deployment | Command | Arguments |
|---|---|---|
| web | (empty) | gunicorn, app.wsgi, --bind, 0.0.0.0:8000 |
| worker | (empty) | celery, -A, app, worker |
| scheduler | (empty) | celery, -A, app, beat |
To chain commands, say, run database migrations before starting the server invoke a shell explicitly:
- Command:
sh,-c - Arguments:
python manage.py migrate --noinput && exec gunicorn app.wsgi
The explicit sh -c keeps you in control of signal handling: exec hands
PID 1 to your server so it receives shutdown signals directly. Mengi never
wraps your command in a hidden shell.
Two things to keep in mind:
- Don’t put secrets in the command line. Command and arguments are part of the deployment’s configuration and visible wherever the workload specification is, unlike secret-referenced environment variables, which stay in the secrets vault. Pass sensitive values as secret references instead.
- Changing the command rolls the deployment the same way an image change does: a rolling update replaces the pods with the new process.
Command and arguments apply to Docker image deployments. Helm chart deployments define their containers in the chart, so these fields are not available there, set the equivalent in the chart’s values.
CPU and memory
The CPU and memory you choose are the container’s requests: what Kubernetes reserves for each pod when it places it on a node. For a Docker deployment Mengi derives the limits from them:
| Request | Limit | |
|---|---|---|
| CPU | what you set | 5 × the request |
| Memory | what you set | 4 × the request |
The dashboard starts at the Medium preset (0.5 vCPU, 512 MB). A deployment created through the API without resources gets 0.1 vCPU and 128 MB.
For example, a request of 0.1 vCPU and 128 MB gives limits of 500m CPU and 512 MB memory. A container that uses more CPU than its limit is slowed down; one that uses more memory than its limit is stopped and restarted.
Automatic right-sizing of requests
On dedicated clusters that Mengi created, every Docker deployment also gets a VerticalPodAutoscaler (VPA). It watches the app’s actual CPU and memory use and changes the requests of the running pods to match:
- Only requests change, never limits. The limits above stay as they are.
- Requests stay within bounds: CPU between 50m and 2 vCPU, memory between 64 MB and the container’s memory limit. A CPU request above 2 vCPU is therefore lowered to at most 2 vCPU; the CPU limit stays at 5 × what you set, so the app can still use more when the node has it free. As with any container, a request is never higher than its limit, so a CPU request can’t grow past 5 × what you set either.
- Pods are resized in place where possible, without a restart. Only when an in-place resize isn’t possible is the pod recreated, which for a single replica means a short interruption.
- Your configuration is not changed. The deployment keeps the values you set; the adjusted requests exist only on the pods. New pods (after a rollout or restart) start with the autoscaler’s current recommendation once it has one.
So a deployment that asked for 0.1 vCPU and 128 MB but idles at a few millicores and 90 MB can run with requests of 50m and about 100 MB a few minutes after it starts. Lower requests let more pods fit on a node; higher ones keep a busy app from being squeezed by its neighbours.
The autoscaler is not used for Helm chart deployments (the chart sets its own resources), for workloads adopted from an existing cluster, or on shared and imported clusters; there, pods keep the requests you set. It can’t be turned off for a single deployment: on dedicated clusters Mengi created it is always part of a Docker deployment.
Accessing your app
- URL, every deployment gets a public address like
https://<id>.apps.mengi.cloud, shown on the deployment once it’s running. - HTTPS, each deployment’s hostname gets its own Let’s Encrypt certificate, issued and renewed automatically. There’s nothing to configure.
- Custom domains, serve your app on your own domain by picking it in the deployment’s Custom Domain settings (available in the wizard and on an existing deployment). Requires a dedicated cluster and a connected DNS provider, see Custom Domains.
HTTPS and request headers
- HTTP is redirected to HTTPS. A plain
http://request to the deployment’s URL or custom domain gets a permanent redirect tohttps://, and HTTPS responses carry aStrict-Transport-Securityheader (one year), so browsers keep using HTTPS andSecurecookies work. To serve plain HTTP as well, sethttps_redirecttofalseon the deployment in the API. Browsers remember the HSTS header for its full year, so switching the redirect off later only takes effect for visitors who haven’t seen the site over HTTPS yet; opt out before the deployment goes live if it must stay reachable over plain HTTP. - TLS is terminated at the Mengi ingress. Visitors connect over HTTPS (TLS 1.2 or newer); the ingress decrypts the request and forwards it to your container over plain HTTP on its container port, inside the cluster. Your app doesn’t need a certificate of its own.
- No TLS passthrough or HTTPS backend. The ingress always terminates TLS and always talks HTTP to the container, so an app that only accepts HTTPS on its port won’t work behind it, serve HTTP on the container port instead.
- Forwarded headers, the ingress adds the standard proxy headers to every
request:
X-Forwarded-Proto(httpsfor requests to your public URL),X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-ForandX-Real-Ip. Configure your app or auth proxy to trust them, so it buildshttps://links and redirects. On shared clusters and on dedicated clusters on Hetzner,X-Forwarded-ForandX-Real-Ipcarry the visitor’s own IP address.
Public and internal-only traffic
- Every Docker deployment is public on its container port. The public URL always routes to the deployment’s container port; it can’t be switched off.
- Additional ports are internal only. Ports you add next to the container port are reachable inside the cluster but never get a public URL. To keep a service private, expose its traffic on an additional port.
- Reaching a deployment inside the cluster, each deployment runs in its own
namespace,
app-<deployment id>, behind a service named after the deployment. Other workloads on the same cluster reach it at<deployment name>.app-<deployment id>.svc.cluster.local: port 80 goes to the container port, and additional ports keep their own numbers.
Helm charts and the public URL
Helm deployments run on shared and dedicated clusters alike, and also get an
https://<id>.apps.mengi.cloud address with DNS pointing at the cluster’s
ingress. The difference from a Docker deployment: Mengi doesn’t create the
Service or Ingress for a chart, the chart’s own Ingress serves traffic,
and the Service and port that Ingress points at are the ones that receive it.
The chart is rendered with exactly your custom values, nothing else is
added, so charts with a strict values.schema.json work too. Configure the
chart’s Ingress there, the way the chart expects it.
To serve the chart on its https://<id>.apps.mengi.cloud URL, either set that
host in the chart’s own Ingress values, or turn on Mengi ingress values
(helm_ingress_values in the API) to have Mengi add these values under yours:
ingress: enabled: true className: mengi-traefik host: <id>.apps.mengi.cloud tls: true annotations: cert-manager.io/cluster-issuer: letsencrypt-prodYour custom values override any of them. They suit charts whose Ingress
template reads ingress.host (a single hostname); a chart that names its hosts
differently (for example a list under ingress.hosts), or whose schema rejects
these keys, needs its Ingress set in the custom values instead. A chart that
renders no Ingress leaves the URL unanswered (HTTP 503). Chart Services without
an Ingress are reachable only inside the cluster, at
<service>.app-<deployment id>.svc.cluster.local.
When the chart itself can’t be deployed, a repo URL or chart version that doesn’t exist, a chart the cluster can’t pull, the deployment shows an error with ArgoCD’s sync message instead of reporting running. A Helm deployment only counts as running once its chart has actually been synced with resources in the cluster; the wrapper resources Mengi renders for secrets don’t count on their own.
Secrets for a chart. Environment variables that reference a
secret (for example a managed database password)
are not injected into the chart’s containers, Mengi can’t know where a chart
wants them. Instead they land in a Kubernetes Secret named
<deployment name>-secrets in the deployment’s namespace, one key per
variable. Point the chart’s own existingSecret-style values at it, and name
each variable after the key the chart reads. For a chart that expects the
database password under the key password in db.existingSecret, add a
variable password referencing the database’s password secret and set:
db: existingSecret: my-app-secrets # <deployment name>-secretsManaging a deployment
From a deployment’s page you can:
- Watch status & health, Mengi tracks the live sync/health state, so you can see when a rollout is in progress, healthy, or degraded.
- View logs and metrics, application logs and CPU/memory metrics are collected per deployment.
- Update it, change the image tag, environment variables, resources or replica count. Mengi regenerates the config and performs a rolling update (no downtime for multi-replica apps).
- Scale, change the replica count up or down at any time.
- Promote to another cluster, copy a deployment’s configuration to a different cluster (e.g. dev → production), see Promoting a deployment below.
- Delete it, removes the deployment and all its Kubernetes resources.
- Import existing workloads, point Mengi at a cluster and it can discover and adopt Deployments/Helm releases already running there, so you can manage them through Mengi.
Promoting a deployment
Promote copies a deployment to another cluster, for example from a Dedicated cluster to production, or to a different provider or region. From the deployment’s page, choose Promote and:
- Pick the target cluster, any other running cluster you own (shared or dedicated, any provider or region).
- Review the settings, they’re pre-filled from the source deployment (image or chart, resources, replicas, container port, environment variables and secret references, storage, image update strategy). Adjust anything you want different on the target, say, more replicas for production, then confirm.
Mengi creates a new deployment on the target cluster with that configuration and provisions it like any other deployment, with its own public URL.
- Configuration only, persistent volumes are recreated empty on the target; data in them is not migrated. If your app keeps state in a volume, move that data yourself.
- The original keeps running untouched, so you can verify the new deployment and switch over at your own pace, delete the source once you no longer need it.
Backups
Deployments on a dedicated cluster can be backed up; shared clusters (including app hosting) don’t support deployment backups. Backups are off by default, so persistent volumes are not backed up until you turn them on for a deployment, and never on a shared cluster. Backups are turned on per deployment, which runs them on a schedule (hourly, daily or weekly) and lets you take one on demand:
-
Dashboard, the Backups section of the deployment’s settings.
-
API, set
backupswhen creating the deployment (POST /deployments) or later withPATCH /deployments/{id}:{ "backups": { "enabled": true, "schedule": "daily", "retention_days": 7 } }scheduleishourly,dailyorweekly;retention_daysis 1 to 90.{ "backups": { "enabled": false } }turns them off again. -
MCP, the same
backupsobject oncreate_deploymentandupdate_deployment;create_deployment_backup,list_deployment_backupsandrestore_deployment_backuptake, list and restore backups.
The first deployment with backups on prepares its cluster for them, so allow a few minutes before the first backup. An on-demand backup of a deployment without backups on is refused with 400 “Backups are not enabled for this deployment”; on a shared cluster, the answer is 400 “Backups require a dedicated cluster” instead, as it is for turning them on there. If the API answers 403 “This feature is not enabled for your account”, backups have been switched off for your account; contact support.
- What a backup covers, the deployment’s whole namespace
(
app-<deployment id>): every Kubernetes resource in it, including those a Helm chart created, and the data of every volume (PVC) mounted by a running pod, copied file by file. Managed databases live outside the namespace and are backed up separately. - Consistency, volume files are copied while the app runs, without pausing it. For a database running inside your chart, use its own dump tool for an application-consistent backup, or use a managed database.
- Where it’s stored, in object storage in Amsterdam (EU), outside the cluster, in a bucket dedicated to your organization and accessible only with your organization’s own storage key.
- Retention, each backup is kept for 1 to 90 days (default 7) and then removed.
Restoring a backup
Restoring overwrites the deployment with a completed backup. It needs the organization’s admin role and, like backups, a dedicated cluster.
- What rolls back, the data of every volume is replaced with the backup’s, and the Kubernetes objects in the namespace that the deployment’s configuration does not define (for example objects your app or a Helm chart hook created at runtime) return to their state in the backup.
- What stays current, the deployment’s configuration: image, environment variables, replicas and the other settings you manage in Mengi. Once the data is back, Mengi applies the current configuration again. To run an older image as well, change the deployment’s image yourself.
- Safety backup first, before it changes anything, the restore backs up
the current state as
pre-restore-<namespace>-<time>. If that backup does not complete, or a volume is not mounted by a running pod (so its data cannot be backed up), the restore stops and nothing is changed. Restore the safety backup to undo a restore. - Downtime, the safety backup runs while the app is still up. Then the deployment’s pods and volumes are removed and recreated from the backup, so the app is down until the restore finishes: typically minutes, longer for large volumes. Scheduled backups and automatic updates of the deployment pause meanwhile.
- If it fails after the deployment was changed, the safety backup is restored the same way, and the restore is reported as rolled back. This also holds when the restore is interrupted midway (for example by a platform update): Mengi puts the safety backup back before the deployment resumes.
- Progress, the deployment page shows the latest restore’s status (queued, running, completed, failed or rolled back) and any error. Volumes created after the backup was taken have no data in the backup, so they come back empty.
Shared vs. dedicated clusters
- Shared, multi-tenant, Mengi-managed clusters: your workloads run in their own virtual cluster on host nodes shared with other customers. Cheapest and fastest to start: a flat per-cluster monthly fee, with the host infrastructure paid by Mengi. Ideal for prototypes, staging and side projects. Not meant for production: no SLA, no backups, so persistent volumes are not backed up.
- Dedicated / BYOC, your own single-tenant cluster (on Mengi’s infrastructure or your own cloud account). Full isolation and control; deploy to it just like any other cluster by picking it in step 1. The Dedicated tier (1 worker node, no SLA) suits staging, internal tools and low-criticality production; pick Dedicated HA (3 worker nodes, dedicated load balancer, SLA) for production. See Tiers in the clusters guide.
Good to know
- Private images and Helm charts are supported when you push them to your Mengi Cloud container registry, Mengi authenticates the pull for you automatically. Images and charts in third-party private registries aren’t supported yet; use a public one, or push it to your Mengi registry first.
- Rollouts are declarative, every change you make is applied automatically, so the running app always matches your declared configuration.
- A deployment inherits its provider and region from the cluster it runs on.
Volume sizes and the provider minimum
Some providers have a minimum volume size: 10 GB on Hetzner and Google Cloud. A smaller request (say 1 GB) is created at that minimum, and the deployment records the size that was actually created: the size shown on the deployment and used in cost estimates is the size you get and pay for. Other providers create the size you ask for.
Volumes don’t grow on their own when they fill up. To make one larger, raise its size in the deployment’s settings; a volume can’t be made smaller.