--- 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 params: permissions: read: - logs - events 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: 36 }, { 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: "params-section", title: "Params", startLine: 32, endLine: 36 }, { id: "permissions-section", title: "Permissions", startLine: 33, endLine: 36 }, { id: "profiles-section", title: "Profiles", startLine: 38, endLine: 66 }, { id: "cpu-section", title: "CPU", startLine: 43, endLine: 44 }, { id: "memory-section", title: "Memory", startLine: 45, endLine: 46 }, { id: "storage-section", title: "Storage", startLine: 47, endLine: 54 }, { id: "gpu-section", title: "GPU", startLine: 55, endLine: 61 }, { id: "placement-section", title: "Placement", startLine: 63, endLine: 70 }, { id: "deployment-section", title: "Deployment", startLine: 72, endLine: 76 }, { id: "endpoints-section", title: "Endpoints", startLine: 78, endLine: 80 }, ];
## Version **Required.** SDL version identifier. ```yaml version: "2.0" ``` | Value | Description | |-------|-------------| | `"2.0"` | Current stable version |
## Services Define containers and networking.
### image **Required.** Docker image to deploy. ```yaml 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. ```yaml command: - /bin/sh - -c args: - | npm start ```
### env **Optional.** Environment variables as `KEY=value` strings. ```yaml 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. ```yaml 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 (`error`, `timeout`, `500`, `502`, `503`, `504`, `403`, `404`, `429`, `off`) | | `proxy` | - | - | Optional nginx proxy tuning (see below) | **Proxy tuning (`http_options.proxy`):** Optional nginx `proxy_*` directives. Every field is optional; unset fields fall back to the provider gateway defaults. | Option | Unit | Description | |--------|------|-------------| | `buffering_disable` | boolean | Turn off `proxy_buffering` when `true` (default `false`) | | `buffer_size` | bytes | `proxy_buffer_size` | | `buffers_number` | count | `` in `proxy_buffers ` (set with `buffers_size`) | | `buffers_size` | bytes | `` in `proxy_buffers ` (set with `buffers_number`) | | `busy_buffers_size` | bytes | `proxy_busy_buffers_size` | | `connect_timeout` | ms | `proxy_connect_timeout` |
### credentials **Optional.** Private registry authentication. ```yaml credentials: host: https://registry.example.com username: user password: pass ```
### params **Optional.** Service-level runtime parameters. Groups storage mounts and inter-service RBAC permissions. ```yaml params: permissions: read: - logs - events ``` `params.storage` covers persistent-volume mounts and is documented under [advanced features](/docs/developers/deployment/akash-sdl/advanced-features#persistent-storage).
#### permissions **Optional.** Grant a sibling service in the same deployment RBAC access to read this service's runtime data. Used by log-collector and observability sidecars so they can tail logs and events from the target service's pods. ```yaml params: permissions: read: - logs # pods, pods/log, deployments — read-only - events # kubernetes events — read-only ``` | Scope | RBAC granted | |-------|--------------| | `logs` | `get/list/watch` on `pods`, `get` on `pods/log`, `get/list/watch` on `apps/deployments` | | `events` | `get/list/watch` on `events` | **Typical use:** log-forwarding sidecars that ship stdout/stderr to an external destination (Datadog, Loki, Fluent Bit, the Akash log-collector image), or monitoring agents that observe pod restarts, OOM kills, scheduling failures, and other lifecycle transitions. The collector pod authenticates against the Kubernetes API using a ServiceAccount the provider mounts into every container. When the target service declares `permissions.read`, the provider attaches a matching `Role` and `RoleBinding` so collectors in the same deployment can call the API server. See [Log Forwarding](/docs/developers/deployment/akash-sdl/advanced-features#log-forwarding) for the full sidecar pattern.
## Profiles Define resources and provider requirements. ### compute
#### cpu **Required.** CPU units (1 = 1 core). ```yaml cpu: units: 1.0 # Cores (0.1, 0.5, 1.0, etc.) ``` **Limits:** Min: 0.01 cores, Max: 384 cores
#### memory **Required.** Memory allocation. ```yaml 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. ```yaml 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. ```yaml gpu: units: 1 # Number of GPUs attributes: vendor: nvidia: - model: rtx4090 ram: 24Gi # Optional: filter by VRAM interface: pcie # Optional: pcie or sxm interconnect: [] # Optional: opt into GPU interconnect (RDMA) ``` **Limits:** Max: 24 GPUs per service **Common models:** `a100`, `a40`, `rtx4090`, `rtx3090`, `t4`, `v100`, `h100` **`interconnect`** — **Optional.** Opts the service into GPU interconnect (RDMA over InfiniBand or RoCE) for high-bandwidth multi-node GPU communication (NCCL). Two forms: - `interconnect: []` — implicit group. All services (and replicas) that use `[]` under the same placement form one peer group and are scheduled on distinct nodes. - `interconnect: { group: }` — explicit named group, for running multiple independent groups in one deployment. The name `auto` is reserved. Any service using `interconnect` requires the placement to request `capabilities/gpu-interconnect: "true"` (see [placement](#placement-section)). The provider chooses the fabric and auto-injects the NCCL environment. See [GPU Interconnect (multi-node RDMA)](/docs/learn/core-concepts/gpu-deployments/#gpu-interconnect-multi-node-rdma) for full examples.
### placement Provider selection and pricing. ```yaml placement: akash: attributes: # Optional filters region: us-west capabilities/gpu-interconnect: "true" # Required if any service uses gpu.attributes.interconnect capabilities/gpu-interconnect/fabric/infiniband: "true" # Optional: require InfiniBand specifically (or .../fabric/roce) 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. ```yaml 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. ```yaml endpoints: myendpoint: kind: ip ``` Use in services: ```yaml expose: - port: 1194 to: - global: true ip: myendpoint ```
## Quick Reference **Minimum viable SDL:** ```yaml 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:** - [GPU deployments](#gpu-section) - [Persistent storage](#storage-section) - [Private registries](#credentials-section) - [Static IPs](#endpoints-section) **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:** - [Quick Start Guide](/docs/getting-started/quick-start) - [CLI Documentation](/docs/developers/deployment/cli)