Skip to content

Latest commit

 

History

History
443 lines (335 loc) · 9.22 KB

File metadata and controls

443 lines (335 loc) · 9.22 KB
categories
Developers
tags
SDL
Syntax
Reference
title SDL Syntax Reference
linkTitle Syntax Reference
description Complete SDL syntax reference
weight 1

import ReferenceLayout from "@/components/docs/ReferenceLayout.astro"; import LiveSDL from "@/components/docs/LiveSDL.tsx";

export const completeSDL = `--- version: "2.0"

services: web: image: nginx:1.25.3 command: - /bin/sh - -c args: - nginx -g 'daemon off;' env: - NODE_ENV=production - PORT=3000 expose: - port: 80 as: 80 proto: tcp accept: - example.com to: - global: true http_options: max_body_size: 1048576 read_timeout: 60000 send_timeout: 60000 credentials: host: https://registry.example.com username: user password: pass

profiles: compute: web: resources: cpu: units: 1.0 memory: size: 1Gi storage: - size: 1Gi - name: data size: 10Gi attributes: persistent: true class: beta3 gpu: units: 1 attributes: vendor: nvidia: - model: rtx4090

placement: akash: attributes: region: us-west pricing: web: denom: uact amount: 100

deployment: web: akash: profile: web count: 1

endpoints: myendpoint: kind: ip`;

export const sections = [ { id: "version-section", title: "Version", startLine: 2, endLine: 2 }, { id: "services-section", title: "Services", startLine: 4, endLine: 31 }, { id: "image-section", title: "Image", startLine: 6, endLine: 6 }, { id: "command-section", title: "Command & Args", startLine: 7, endLine: 11 }, { id: "env-section", title: "Environment Variables", startLine: 12, endLine: 14 }, { id: "expose-section", title: "Expose", startLine: 15, endLine: 27 }, { id: "credentials-section", title: "Credentials", startLine: 28, endLine: 31 }, { id: "profiles-section", title: "Profiles", startLine: 33, endLine: 61 }, { id: "cpu-section", title: "CPU", startLine: 38, endLine: 39 }, { id: "memory-section", title: "Memory", startLine: 40, endLine: 41 }, { id: "storage-section", title: "Storage", startLine: 42, endLine: 49 }, { id: "gpu-section", title: "GPU", startLine: 50, endLine: 56 }, { id: "placement-section", title: "Placement", startLine: 58, endLine: 65 }, { id: "deployment-section", title: "Deployment", startLine: 67, endLine: 71 }, { id: "endpoints-section", title: "Endpoints", startLine: 73, endLine: 75 }, ];

Version

Required. SDL version identifier.

version: "2.0"
Value Description
"2.0" Current stable version

Services

Define containers and networking.

image

Required. Docker image to deploy.

image: nginx:1.25.3

Supports any public registry (Docker Hub, GHCR, GCR, ECR, etc.)

Best Practice: Always specify a version tag (e.g., nginx:1.25.3) instead of using :latest or omitting the tag. This ensures reproducible deployments and prevents unexpected updates.

command & args

Optional. Override container entrypoint.

command:
  - /bin/sh
  - -c
args:
  - |
    npm start

env

Optional. Environment variables as KEY=value strings.

env:
  - NODE_ENV=production
  - DATABASE_URL=postgresql://db:5432/myapp

expose

Required for individual services. And at least one service in the deployment must have global: true in its expose configuration. Services with only internal endpoints (e.g., database backends) are accessible only to other services within the deployment.

expose:
  - port: 80              # Container port (required)
    as: 80                # External port (default: same as port)
    proto: tcp            # Protocol: tcp or udp (default: tcp)
    accept:               # Accepted hostnames
      - example.com
    to:
      - global: true      # Expose to internet (at least one required)
    http_options:         # HTTP-specific options
      max_body_size: 1048576
      read_timeout: 60000
      send_timeout: 60000

HTTP Options:

Option Default Max Description
max_body_size 1048576 104857600 Max request body (bytes)
read_timeout 60000 60000 Read timeout (ms)
send_timeout 60000 60000 Send timeout (ms)
next_tries 3 - Retry attempts
next_cases [error, timeout] - When to retry

credentials

Optional. Private registry authentication.

credentials:
  host: https://registry.example.com
  username: user
  password: pass

Profiles

Define resources and provider requirements.

compute

cpu

Required. CPU units (1000 = 1 core).

cpu:
  units: 1.0              # Cores (0.1, 0.5, 1.0, etc.)

Limits: Min: 0.01 cores, Max: 384 cores

memory

Required. Memory allocation.

memory:
  size: 1Gi               # RAM (Mi or Gi)

Limits: Min: 1Mi, Max: 2Ti

storage

Required. At least one ephemeral storage volume required. Persistent storage is optional.

storage:
  - size: 1Gi             # Ephemeral root volume (required)
  - name: data            # Persistent volume (optional)
    size: 10Gi
    attributes:
      persistent: true    # Survives restarts
      class: beta3        # Performance tier

Limits: Min: 5Mi, Max: 32Ti per volume

Classes: default, beta1, beta2, beta3, ram

gpu

Optional. GPU resources.

gpu:
  units: 1                # Number of GPUs
  attributes:
    vendor:
      nvidia:
        - model: rtx4090
          ram: 24Gi       # Optional: filter by VRAM
          interface: pcie # Optional: pcie or sxm

Limits: Max: 24 GPUs per service

Common models: a100, a40, rtx4090, rtx3090, t4, v100, h100

placement

Provider selection and pricing.

placement:
  akash:
    attributes:           # Optional filters
      region: us-west
    pricing:              # Required: max bid per service
      web:
        denom: uact
        amount: 100       # uakt per block (~6 sec)

Pricing calculation:

Daily cost = (amount × 14,400 blocks) / 1,000,000 AKT
Example: 100 uakt/block = 1.44 AKT/day = ~43 AKT/month

Deployment

Map services to profiles.

deployment:
  web:                    # Service name
    akash:                # Placement name
      profile: web        # Compute profile name
      count: 1            # Number of replicas

Note: count cannot be changed after deployment. Max: 50 replicas per service.

Endpoints

Optional. Named IP endpoints for static IPs.

endpoints:
  myendpoint:
    kind: ip

Use in services:

expose:
  - port: 1194
    to:
      - global: true
        ip: myendpoint

Quick Reference

Minimum viable SDL:

version: "2.0"
services:
  web:
    image: nginx:1.25.3
    expose:
      - port: 80
        as: 80
        to:
          - global: true
profiles:
  compute:
    web:
      resources:
        cpu:
          units: 0.5
        memory:
          size: 512Mi
        storage:
          size: 512Mi
  placement:
    akash:
      pricing:
        web:
          denom: uact
          amount: 100
deployment:
  web:
    akash:
      profile: web
      count: 1

Common patterns:

Resource Limits (per service):

Resource Minimum Maximum
CPU 0.01 cores 384 cores
Memory 1Mi 2Ti
Storage 5Mi 32Ti (per volume)
GPU 0 (optional) 24 units
Replicas (count) 1 50

See also: