What You’ll Deploy

A secure Python Flask application with:

  • Pre-built Flask web server
  • TEE security verification
  • Health monitoring endpoints
  • No code changes required

This tutorial uses an existing Python container to demonstrate dstack deployment. Perfect for quick testing and learning.

Prerequisites

  • Access to a dstack host (see setup guide)
  • SSH tunnel to dstack dashboard
  • Web browser for dashboard access
  • 5 minutes of your time

Step 1: Open Tunnel & Access Dashboard

Connect to your dstack host and open the dashboard:
1

Open tunnel & access dashboard

This command lets you access the dstack dashboard running on your remote host.
Open in your browser:http://127.0.0.1:13680

Step 2: Deploy Python Container

Navigate to your dstack dashboard and click “Deploy a new instance”.

Add the Docker Compose Configuration

Copy this YAML and paste it into the “Docker Compose File” field:
2Paste your Docker Compose YAML
Click “Deploy” to start your Python application.

Step 3: Launch and Monitor

  1. Click Launch in the dashboard
dstack will start your Python FastAPI application. This usually takes 1–2 minutes.
  1. Monitor the deployment progress
  • Check Serial Logs for VM boot details
  • View container status in the Containers tab
  • Wait for the application to show as “Running”

Step 4: Test Your Deployment

After deployment, find your app’s URL in the dashboard:
https://<APP_ID>-8080.app.<host>:<host_port>

Test the Endpoints

# Replace with your actual app URL
APP_URL="https://your-app-id-8080.app.your-host:port"

# Test main endpoint
curl $APP_URL/

# Test health check
curl $APP_URL/health

# Test TEE attestation endpoint
curl $APP_URL/attestation

Expected Responses

Main endpoint (/):
{
  "message": "Python app running in TEE",
  "secure": true,
  "tee_enabled": true,
  "timestamp": 1703123456.789,
  "environment": "dstack-tee"
}
Health endpoint (/health):
{
  "status": "healthy",
  "tee_protected": true,
  "python_version": "3.11",
  "framework": "FastAPI"
}

What’s Next?

Your Python application is now running securely in a dstack TEE environment with: Hardware Protection - Application runs in Intel TDX secure environment
Memory Encryption - All data encrypted by CPU hardware
Attestation Support - Cryptographic proof of security available
Production Ready - HTTPS endpoints with automatic certificates

Continue Learning