Deploy an Application

This guide covers deploying an application using the App Platform — from a Docker image, a git repository, or a marketplace template.

Option 1: Deploy from a Docker Image

The simplest way to deploy. Point to any public or private container image.
curl -X POST http://localhost:8080/api/v1/apps \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-api",
    "source_type": "image",
    "image_url": "nginx:latest",
    "port": 80,
    "replicas": 2,
    "env": {
      "NODE_ENV": "production"
    }
  }'
Uncloud creates a Kubernetes Deployment, Service, and Ingress. Your app is accessible at my-api.<base-domain>.

Option 2: Deploy from Git

Build and deploy directly from a git repository:
curl -X POST http://localhost:8080/api/v1/apps \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-frontend",
    "source_type": "git",
    "repo_url": "https://github.com/user/frontend.git",
    "repo_branch": "main",
    "build_command": "npm run build",
    "port": 3000
  }'
Uncloud clones the repo, runs the build, pushes the image to the internal registry, and deploys.

Option 3: Deploy from Marketplace

Deploy a pre-configured application template:
# List available templates
curl http://localhost:8080/api/v1/library/templates

# Deploy WordPress
curl -X POST http://localhost:8080/api/v1/apps \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-blog",
    "template_id": "tmpl_wordpress",
    "port": 80
  }'

Configure Environment Variables

Set environment variables for your app:
curl -X PATCH http://localhost:8080/api/v1/apps/app_your_id \
  -H "Content-Type: application/json" \
  -d '{
    "env": {
      "DATABASE_URL": "postgresql://user:pass@host:5432/db",
      "REDIS_URL": "redis://cache:6379",
      "LOG_LEVEL": "info"
    }
  }'

Set Secrets

For sensitive values, use the secrets API:
curl -X POST http://localhost:8080/api/v1/apps/app_your_id/secrets \
  -H "Content-Type: application/json" \
  -d '{
    "key": "API_SECRET_KEY",
    "value": "super-secret-value"
  }'
Secrets are stored in Kubernetes Secrets and are not visible in the dashboard.

Scale Your App

curl -X PATCH http://localhost:8080/api/v1/apps/app_your_id \
  -H "Content-Type: application/json" \
  -d '{"replicas": 5}'

Add a Custom Domain

curl -X POST http://localhost:8080/api/v1/apps/app_your_id/domains \
  -H "Content-Type: application/json" \
  -d '{"domain": "api.example.com"}'
Then add a CNAME record pointing api.example.com to your cluster’s domain.

View Logs

# Application logs
curl http://localhost:8080/api/v1/apps/app_your_id/logs

# Build logs (for git/upload deployments)
curl http://localhost:8080/api/v1/apps/app_your_id/build-log

Redeploy

Trigger a new deployment (pulls latest image or rebuilds from git):
curl -X POST http://localhost:8080/api/v1/apps/app_your_id/deploy

Rollback

View deployment history and roll back to a previous version:
# List deployments
curl http://localhost:8080/api/v1/apps/app_your_id/deployments

# Rollback
curl -X POST http://localhost:8080/api/v1/apps/app_your_id/deployments/dep_previous_id/revert

Monitor Performance

curl http://localhost:8080/api/v1/apps/app_your_id/metrics

Next Steps