Deploying Your App¶
This page walks you through deploying an application to AppMecca. Before you deploy, you need a registered app with at least one successful build.
Prerequisites¶
Before running mecca app deploy, make sure:
- Your app is registered -- run
mecca app list -e devto check - A build exists -- run
mecca build list -a myapp -e devto verify - Repository preflight passed -- a newly registered app stays quarantined until its repo is proven buildable;
mecca app show myapp -e devreports the verdict
No build yet?
If you have not built your app, deploy will fail with an "Image not found" error. Build first:
See Triggering a Build for details.
Command Flags¶
TARGET is a positional argument — either a registered app name, or a Git URL
(which registers and deploys the app in one step).
| Flag | Short | Description |
|---|---|---|
--env |
-e |
Target environment (resolved from mecca.conf default when omitted) |
--branch |
-b |
Branch to deploy (default: main) |
--image-tag |
Deploy a specific image tag instead of building | |
--no-build |
Deploy the latest existing image — skip the build | |
--no-deploy |
Build only, no auto-deploy | |
--config-path |
Path to appmecca.yaml in the repo (default: repo root) |
|
--skip-preflight |
Bypass the repository preflight gate |
Two flags are Python-CLI only
--force (deploy even if the app already exists, Git-URL targets) and
--skip-check (skip the git ls-remote accessibility pre-check) exist on
pipx run appmecca and not on the mecca you installed from npm or
Homebrew — see
FEATURES #366. They are named
here rather than dropped, so the capability is not lost from the record.
There is no --services or --replicas flag
mecca app deploy deploys all of the app's services and uses the
replicas value declared per service in appmecca.yaml. Replica counts are
a config decision, not a deploy-time one — change deploy[].replicas (1-3)
and redeploy. See Services.
Deploy the Latest Build¶
Expected output
The CLI verifies that container images exist in the image registry, then queues the deployment. Host agents pick it up within seconds.
Deploying a branch
By default, this deploys the main branch. To deploy a different branch, add -b:
Each branch gets its own isolated containers, database, ports, and URL. See Branch Deployments for the full guide.
Deploy a Specific Version¶
Every build is tagged with the Git commit hash. You can deploy a specific version instead of latest:
This is useful when you want to deploy an older build, or when multiple builds exist and you want to be explicit about which one to use.
Finding available tags
Run mecca build list -a myapp -e dev. The Tag column is what you pass
to --image-tag, and Status tells you which tags are usable — only a
succeeded build has an image in the registry.
build list shows build history, not what is serving traffic; read the live
tag from mecca app show myapp -e dev.
Restarting a Single Service¶
mecca app deploy always deploys every service in the app — there is no
per-service deploy flag. If only one service needs to be bounced (and the image
has not changed), restart it instead:
This leaves the other services untouched. See Service Management.
Build and Deploy in One Command¶
mecca build trigger already does both — a deploy is queued automatically and
runs the moment the build succeeds:
It is the fastest way to go from code changes to a running deployment. Pass
--no-deploy if you want the build only. There is no --deploy flag.
Expected output
For an app that is already registered, mecca app redeploy myapp does the same
thing from the stored repo URL — no -g needed.
Service Placement¶
When you deploy, AppMecca automatically decides which hosts run which services. The placement engine is memory-aware and tiered: the first few hosts form a base tier spread across separate availability zones and are spread-packed (each new service lands on the emptiest host), and any scale-out hosts beyond that are bin-packed (filled one at a time) so they stay cold until the base is full. Every container has a hard memory limit, and placement keeps a safety-margin of headroom on each host for the brief blue/green overlap during a redeploy. Replicas of the same service are always placed on different hosts (a hard anti-affinity constraint) for high availability.
Replica counts are set per service in appmecca.yaml (deploy[].replicas, 1-3
— see Services). There is no deploy-time
override; change the config and redeploy.
After a deployment completes, mecca queue status <id> shows the placement plan -- which services were assigned to which hosts.
What Happens During a First Deploy¶
The very first deployment of an app involves extra setup. Here is the full sequence:
- Port allocation -- AppMecca assigns host ports (from the 7001-8999 range) to each service
- Routing group creation -- A routing group is created for each service with a port
- Router rules -- Rules are added to the platform HTTPS router to route traffic by hostname
- DNS registration -- A wildcard DNS record points
*.dev.yourdomain.ioat the router - Container deployment -- The Docker image is pulled and the container is started
- Health check -- The router confirms the container is responding on the configured health check path
- Traffic flows -- HTTPS requests to your app URL reach the container
After the first deploy, steps 1-4 are skipped on subsequent deploys. Only the container is replaced.
What Happens During a Redeploy¶
Redeploys are zero-downtime. AppMecca runs the old and new containers side by side (blue/green) and only cuts traffic over once the new one is proven healthy:
- The new image is pulled from the image registry
- A new container starts on a temporary port, alongside the still-serving old one
- The new container is health-checked; once it passes, the router switches traffic to it
- The old container is drained and removed after in-flight requests finish
The routing (routing group, router rules, DNS) remains unchanged, so the URL does not change.
A failed redeploy costs you nothing
If the new container never passes its health check, the old one keeps serving and the new one is discarded. A broken deploy does not take your app down.
Using Environment Defaults¶
To stop retyping -e on every command, set a default environment once:
mecca then resolves the environment from (in order) an explicit -e flag, the
APPMECCA_ENV environment variable, and finally the [default] section of
~/.appmecca/mecca.conf.
There is no APPMECCA_BRANCH, and APPMECCA_APP does not fill in the app name here
mecca app deploy takes its target as a required positional argument —
it is not defaulted from APPMECCA_APP, so mecca app deploy on its own is
an error. And no APPMECCA_BRANCH variable exists: -b defaults to main
and must be passed explicitly for any other branch.
APPMECCA_APP is honoured by the commands that take -a/--app as a
filter flag — mecca logs, mecca build list, mecca queue list.
Troubleshooting Deploy Issues¶
"App not found"
Your app is not registered. Register it first:
"Image not found"
No build exists for this app, or the tag you specified does not exist. Check what is available, then trigger a build if needed:
Deployment stays in QUEUED status
Check whether the action is being held back by an admission gate, which explains the hold in plain language:
If it reports no blockers and the action still never starts, the host agents may be down — that is a platform-side problem, so contact your administrator. See Troubleshooting.
Next Steps¶
- Branch Deployments -- deploy multiple branches side by side
- Checking Status -- monitor your deployment after it starts
- Undeploying -- remove a running deployment
- Rolling Back -- revert to a previous version