Flask is a lightweight WSGI web application framework in Python, and MongoDB is a NoSQL database that stores data in JSON-like documents.
This example deploys three services on Unikraft Cloud: NGINX (reverse proxy), Flask (backend), and MongoDB (database).
Install the unikraft CLI.
You need a BuildKit builder. The easiest way to get one is via Docker.
Alternatively, you can also directly set up and use BuildKit, see the quick start.
Clone the examples repository and cd into the examples/nginx-flask-mongo directory:
Finally, deploy NGINX as the public-facing reverse proxy.
It forwards requests to the Flask backend at backend.internal:9091 by default.
To use a different backend domain, set the BACKEND_HOST environment variable to the same value you pass as the Flask domain.
METRO NAME STATE IMAGE MEMORY VCPUS FQDN CREATEDfra nginx-jnpwi standby <my-org>/nginx 512MiB 1 snowy-river-gotjeojl.fra.unikraft.app 11 minutes agofra flask-9a68z standby <my-org>/flask 1GiB 1 backend.internal 12 minutes agofra mongo-o3qhq standby <my-org>/mongo 1GiB 1 mongo.internal 14 minutes ago
Test the deployment
The FQDN of the NGINX instance can be found in the FQDN column of the unikraft instances list output above.
Use curl to query it (replace with your actual FQDN):