Cosmoner Docs
Guides

App Deployment Templates

Commit a .datablock/app.yaml to your repository to predefine your app's build, runtime, and environment configuration — the deploy wizard fills itself in from it.

Overview

When you deploy an app from a git repository, you normally configure the source directory, build settings, ports, and environment variables by hand in the deploy wizard. A deployment template moves that configuration into your repository: commit a .datablock/app.yaml file and the wizard reads it as soon as you select the repository, prefilling every setting it defines.

A template can describe one or more services. Each deploy sets up one service — when a template defines several, the wizard lets you pick which one to deploy, and you run the wizard again for the others.

File Location

The template is looked up on the selected branch, in this order:

  1. .datablock/app.yaml
  2. .datablock/app.yml

Example

# .datablock/app.yaml
name: my-platform
region: ams

services:
  - name: api
    type: service
    source_dir: apps/api
    build:
      strategy: docker
      command: bun run build
    run_command: bun start
    http_port: 8080
    internal_port: 3000
    instance_size: apps-s-1vcpu-1gb
    instances: 2
    autodeploy: true
    envs:
      - key: NODE_ENV
        value: production
      - key: DATABASE_URL
        secret: true   # value is filled in the wizard, never committed

  - name: web
    type: static
    source_dir: apps/web
    build:
      command: bun run build
      output_dir: dist

Reference

Top level

FieldTypeDescription
namestringOptional display name for the template.
regionstringOptional App Platform region slug (e.g. ams) preselected on the configure step.
serviceslistOne or more services (max 10). Required.

Service

FieldTypeDescription
namestringRequired. Lowercase letters, numbers, and hyphens (max 32 chars). Must be unique within the file.
typeservice | staticDefaults to service. static builds once and serves from CDN.
source_dirstringDirectory containing the app, for monorepos. Defaults to the repository root.
build.strategynixpacks | buildpacks | dockerHow the app is built. Defaults to auto-detection.
build.commandstringBuild command. Leave unset to auto-detect.
build.output_dirstringBuild output directory. Static sites only.
run_commandstringStart command. Web services only.
http_portnumberPublic HTTP port.
internal_portnumberInternal container port.
instance_sizestringApp Platform instance size slug, preselected on the configure step.
instancesnumberInstance count (1–10).
autodeploybooleanDeploy automatically on push to the selected branch.
envslistEnvironment variables (see below).

Environment variables

FieldTypeDescription
keystringRequired. Letters, numbers, and underscores, starting with a letter or underscore.
valuestringThe value. Required unless secret: true.
secretbooleanMarks the variable as secret. Never commit secret values — leave value unset and the wizard prompts for it, storing it masked.

Validation

If the template exists but is invalid — malformed YAML, a missing required field, duplicate service names — the wizard shows the validation error and falls back to manual configuration. Nothing is applied from an invalid template.

Values you can still change: everything. The template only prefills the wizard; every setting remains editable before you launch, and settings changed later in the app's dashboard are not overwritten by the file.

On this page