Skip to content

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.yaml configuration
  • 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

mecca register git@gitlab.com:appmecca-sample-apps/hello-flask.git -e dev
Expected output
Registered app: hello-flask
Environment: dev
Repository: git@gitlab.com:appmecca-sample-apps/hello-flask.git

2. Build the container

mecca build trigger -e dev -g git@gitlab.com:appmecca-sample-apps/hello-flask.git

This clones the repository, reads appmecca.yaml, builds the Docker image, and pushes it to your private image registry.

Expected output
Build started: build-xxxxxxxx
Cloning repository...
Building container: web
Pushing image to the private registry: hello-flask/web
Build complete. Duration: 45s

3. Deploy

mecca app deploy -e dev hello-flask
Expected output
Deploying hello-flask to dev...
Deployment queued: deploy-xxxxxxxx
Waiting for agents...
Container started: hello-flask-web
Health check passed: /health -> 200 OK
Deployment complete.

Services:
  web: https://hello-flask-web.dev.appmecca.net

4. Verify

mecca app show hello-flask -e dev

(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:

curl https://hello-flask-web.dev.appmecca.net/health
{"status": "healthy"}

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?