Last Updated: May 5, 2025

Deploying Your First Application on SaladCloud

Welcome to Salad Container Engine (SCE), a fully managed container service for deploying AI and simulation workloads to our global network of idle GPUs. Unlike traditional cloud providers, SaladCloud operates a decentralized marketplace where individuals can sell idle compute time on their PCs, and businesses can run workloads at industry-low costs. This guide walks you through deploying a simple FastAPI application on SCE. Before continuing, make sure you have:
  • A SaladCloud account
  • An organization created in the portal
  • At least a few dollars in credits added to your account

Step 1: Prepare Your Application

We’ll deploy a simple FastAPI server with a GET /hello endpoint and basic probe endpoints (/started, /live, /ready). The /hello route returns a greeting and the machine ID via environment variable injection at runtime. While the probe routes aren’t meaningful in this demo, SCE can use them to manage container lifecycle events.
app.py
from fastapi import FastAPI
import os

salad_machine_id = os.getenv("SALAD_MACHINE_ID", "localhost")

app = FastAPI()


@app.get("/hello")
async def hello_world():
    return {"message": "Hello, World!", "salad_machine_id": salad_machine_id}


@app.get("/started")
async def startup_probe():
    return {"message": "Started!"}


@app.get("/ready")
async def readiness_probe():
    return {"message": "Ready!"}


@app.get("/live")
async def liveness_probe():
    return {"message": "Live!"}

Dockerfile

The Dockerfile uses the Python 3.13 base image, installs dependencies, and runs the server with uvicorn. Ensure your server listens on both IPv4 and IPv6 by using --host *, as SaladCloud requires IPv6 compatibility.
Dockerfile
FROM python:3.13-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app.py .

# It is important to use `--host *` to allow access on ipv6
# networks, such as SaladCloud.
CMD ["uvicorn", "app:app", "--host", "*", "--port", "8000"]

Step 2: Push Your Container Image

Build and push your container image to a registry. In this example, we use Docker Hub:
docker build -t saladtechnologies/misc:hello-world .
docker push saladtechnologies/misc:hello-world
Images up to 35 GB (compressed) are supported.

Step 3: Create a Container Group

In the SaladCloud Portal:
  1. Navigate to your organization and project (e.g., “salad-benchmarking / Default”).
  2. Click Create Container Group.
  3. Choose Custom (instead of a preconfigured Recipe).
  4. Set the name to hello-world.
  5. Under Image Source, enter saladtechnologies/misc:hello-world.
  6. Set Replicas to 3 for high availability across potentially unreliable nodes.
  7. Skip env vars and command overrides for this example (optional: use sleep infinity for debugging).
  8. Configure Hardware:
    • CPU: 1 vCPU
    • RAM: 1 GB
    • GPU: None (select one or more if needed; Salad matches your workload to one).
  9. Skip Storage for this example (note: storage is ephemeral).

Step 4: Configure Network Access

  • Enable Container Gateway to expose your app via a load balancer.
  • Set Port to 8000.
  • Choose Round Robin load balancing for this demo (Least Connections is preferred for AI workloads).
  • Authentication is optional—if enabled, include your Salad API key in the Salad-Api-Key header.
  • Optionally restrict concurrency to 1 request per instance. Not relevant for this demo, but useful for workloads with high vram usage.

Step 5: Set Health Probes

Configure HTTP probes to manage instance lifecycle:

Startup Probe (/started)

  • Initial Delay: 0
  • Period: 1s
  • Timeout: 1s
  • Success Threshold: 1
  • Failure Threshold: 5

Liveness Probe (/live)

  • Starts after startup probe succeeds
  • Detects deadlocks or unresponsive processes
  • Failure Threshold: 3

Readiness Probe (/ready)

  • Controls load balancer routing
  • Can be used to reject new traffic during internal queue saturation
Refer to the probe documentation for full details.

Step 6: Deploy

  • Enable Auto Start.
  • Click Deploy.
  • Watch your instances move through “Allocating” → “Starting” → “Running” → “Ready”.
  • Each replica is assigned to its own machine.
  • You will not be billed while instances are down or being reallocated.

Step 7: Test Your Deployment

  • Access the app via the container gateway URL (e.g., https://tomato-navybean-pm82t0txwjyus8yy.salad.cloud/hello).
  • The response should include the text Hello, World! and a machine ID.
  • Refreshing may show different machine IDs as traffic is distributed.

Step 8: Monitor and Debug

  • Instance Details: Run shell commands or inspect logs.
  • System Events: View instance reallocations, exit codes, and lifecycle events.
  • Container Logs: View logs across all instances (use an external provider like Axiom for production).

Clean Up

  • Click Stop to terminate the container group and stop billing.

What’s Next?

Explore more in the SaladCloud Docs, including: Happy building! 🚀