What You’ll Deploy

A secure, high-performance Rust web API with:

  • Pre-built Rust web server
  • TEE security verification
  • High-performance endpoints
  • No code changes required

This tutorial uses an existing Rust container to demonstrate dstack deployment. Perfect for security-critical and high-performance workloads.

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 Rust 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 Rust application.

Step 3: Launch and Monitor

  1. Click Launch in the dashboard
dstack will start your Rust Warp application. This usually takes 2–3 minutes (Rust compilation).
  1. Monitor the deployment progress
  • Check Serial Logs for VM boot details
  • View container status in the Containers tab
  • Wait for the Rust compilation and application startup

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

# Test secure computation with performance metrics
curl -X POST $APP_URL/api/compute \
  -H "Content-Type: application/json" \
  -d '{"data": "high-performance secure computation"}'

Expected Responses

Main endpoint (/):
{
  "message": "Rust app running in TEE",
  "secure": true,
  "tee_enabled": true,
  "timestamp": "2024-01-01T12:00:00.000Z",
  "environment": "dstack-tee",
  "rust_version": "1.75"
}
Health endpoint (/health):
{
  "status": "healthy",
  "tee_protected": true,
  "framework": "Warp",
  "language": "Rust"
}
Compute endpoint (/api/compute):
{
  "processed": true,
  "secure_computation": "completed",
  "result": "Securely processed: high-performance secure computation",
  "tee_protected": true,
  "performance_micros": 42
}

Performance Benchmarking

Test the high-performance capabilities:
# Install Apache Bench for load testing (if available)
sudo apt-get install apache2-utils

# Benchmark the secure endpoint
ab -n 1000 -c 10 $APP_URL/health

# Test concurrent secure computations
echo '{"data": "benchmark test data"}' > payload.json
ab -n 100 -c 5 -p payload.json -T application/json $APP_URL/api/compute

What’s Next?

Your Rust application is now running securely in a dstack TEE environment with: Zero-Overhead Security - Hardware protection without performance cost
High-Performance Computation - Optimized Rust code in secure environment
Memory Safety - Rust’s memory safety + hardware memory encryption
Attestation Support - Cryptographic proof of security available

Continue Learning