Skip to content

アプリマニフェスト (.takos/app.yml)

.takos/app.yml は Takos でアプリ構成を宣言する主要な source です。public spec は Cloudflare-native の syntax を使い、Takos runtime が Cloudflare backend または互換 backend 上で同じ spec を実現します。takos apply は manifest を group に反映し、group 省略時は metadata.name を使って自動作成します。

最小例

yaml
apiVersion: takos.dev/v1alpha1
kind: App
metadata:
  name: my-app
spec:
  version: 0.1.0
  workers:
    web:
      build:
        fromWorkflow:
          path: .takos/workflows/deploy.yml
          job: bundle
          artifact: web
          artifactPath: dist/worker

Worker + Database

yaml
apiVersion: takos.dev/v1alpha1
kind: App
metadata:
  name: notes-app
spec:
  version: 0.1.0
  workers:
    web:
      build:
        fromWorkflow:
          path: .takos/workflows/deploy.yml
          job: bundle
          artifact: web
          artifactPath: dist/worker
      bindings:
        d1: [primary-db]
        r2: [assets]
  resources:
    primary-db:
      type: d1
      binding: DB
      migrations:
        up: .takos/migrations/primary-db/up
        down: .takos/migrations/primary-db/down
    assets:
      type: r2
      binding: ASSETS
  routes:
    - name: app
      target: web
      path: /

Worker + MCP Server

yaml
apiVersion: takos.dev/v1alpha1
kind: App
metadata:
  name: notes-assistant
spec:
  version: 0.3.0
  capabilities: [mcp]
  workers:
    web:
      build:
        fromWorkflow:
          path: .takos/workflows/deploy.yml
          job: bundle
          artifact: web
          artifactPath: dist/worker
  routes:
    - name: mcp-endpoint
      target: web
      path: /mcp
  resources:
    mcp-auth-secret:
      type: secretRef
      binding: MCP_AUTH_TOKEN
      generate: true
  mcpServers:
    - name: notes
      route: mcp-endpoint
      transport: streamable-http
      authSecretRef: mcp-auth-secret

構成の考え方

  • workers: Workers runtime で動くワークロード
  • services: 常設コンテナ系ワークロード
  • containers: Worker に紐づく CF Containers
  • resources: Cloudflare-native resource 定義
  • routes: workload への公開ルート
  • mcpServers: MCP 公開設定

custom domain / hostname routing はこの manifest の canonical desired state には含めず、routing / observed surface として別 API で扱います。

resources

public spec で使う type は Cloudflare-native resource kind です。

type用途追加フィールド
d1SQL データベース contractmigrations
r2オブジェクトストレージ contract-
kvKey-Value ストア-
queueキューqueue.maxRetries, queue.deadLetterQueue, queue.deliveryDelaySeconds
vectorizeベクトルインデックス contractvectorize.dimensions, vectorize.metric
analyticsEngineAnalytics ストア contractanalyticsEngine.dataset
secretRefシークレットgenerate
workflowワークフロー runtime contractworkflow.service, workflow.export, workflow.timeoutMs, workflow.maxRetries
durableObjectDurable Object namespace contractdurableObject.className, durableObject.scriptName
yaml
resources:
  primary-db:
    type: d1
    binding: DB
  uploads:
    type: r2
    binding: UPLOADS
  app-secret:
    type: secretRef
    binding: APP_SECRET
    generate: true

classbacking は public spec では使いません。Cloudflare backend では通常そのまま D1/R2/KV/Vectorize/Workflows/DO に解決され、他 backend では Takos runtime が provider-backed または Takos-managed な実装に解決します。

workflow は manifest でも service settings API / builtin tool でも設定できます。dynamic binding でも workflow.serviceworkflow.export の metadata が必要です。

bindings

workload bindings も Cloudflare-native です。

key参照する resource
d1type: d1
r2type: r2
kvtype: kv
queuestype: queue
vectorizetype: vectorize
analyticsEnginetype: analyticsEngine
workflowtype: workflow
durableObjectstype: durableObject
services他 workload への service binding

デプロイ

manifest の反映は takos apply を使います。

bash
takos apply --env staging

manifest からの online deploy source は次で解決されます。

  • workers.*: build.fromWorkflow.artifactPath
  • services.*: imageRef
  • containers.*: imageRef

関連ページ