Hello Flask¶
A minimal Flask web application -- the simplest possible AppMecca deployment. One container, one service, no database, no cache.
Overview¶
| Repository | git@gitlab.com:appmecca-sample-apps/hello-flask.git |
| Tech Stack | Python 3.12 / Flask / Gunicorn |
| Services | web (port 5000) |
| Database | None |
| Cache | None |
| URL Pattern | https://hello-flask-web.{env}.appmecca.net |
What This App Demonstrates¶
- The simplest possible
appmecca.yamlconfiguration - Single-container deployment workflow
- Health check endpoint pattern
- The three-step deploy process: register, build, deploy
appmecca.yaml¶
containers:
- name: web
dockerfile: Dockerfile
context: .
deploy:
- name: web
container: web
port: 5000
health_check:
path: /health
This is the minimum configuration AppMecca needs:
- One container -- build a Docker image from the Dockerfile in the repo root
- One service -- run it on port 5000 with a health check at
/health
Step-by-Step Deployment¶
1. Register the app¶
Expected output
2. Build the container¶
This clones the repository, reads appmecca.yaml, builds the Docker image, and pushes it to your private image registry.
Expected output
3. Deploy¶
Expected output
4. Verify¶
(mecca queue status also exists, but it takes the action ID printed by the deploy, not
an app name.)
You can also check your app directly:
Key Concepts¶
Health checks¶
Every service with a port needs a health_check.path that returns HTTP 200. AppMecca uses this to confirm your app started successfully and to keep monitoring it afterwards.
If the health check fails during a deploy, the deployment is marked as failed — and the container that was already serving keeps serving, untouched. There is no automatic rollback, because none is needed: the new version simply never takes over. To go back to an earlier version deliberately, redeploy an existing image tag with mecca app deploy <app> --image-tag <tag> --no-build.
Threshold minimums
healthy_threshold and unhealthy_threshold both have a minimum of 2. Setting either to 1 is rejected at validation time.
Port mapping¶
The port in appmecca.yaml must match the port your application listens on inside the container. Flask with Gunicorn typically uses port 5000. You do not need to handle HTTPS -- AppMecca terminates TLS at its HTTPS router and forwards traffic to your container over HTTP.
URL assignment¶
Every service gets a URL in the format https://{app}-{service}.{env}.{domain}. The service name is always present — even in a single-service app like this one, the URL is hello-flask-web..., never hello-flask.... Run mecca app show hello-flask -e dev to see the exact URL, which also carries your group slug.
Start here
If you are new to AppMecca, this is the best starting point. Once you are comfortable with this pattern, try adding a database or deploying a multi-container app.
What's Next?¶
- App with Database -- add PostgreSQL to your application
- Multi-Container App -- deploy a frontend and backend together
- Managing Services -- restart, stop, and monitor your services
- Environment Variables -- inject configuration into your app