# Deliver public assets through CDN for Astro

## Summary
Cdn assets for a Astro app on Ample. Verified on Astro: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. Build and start: astro build with the @astrojs/node standalone adapter then node ./dist/server/entry.mjs on the node-22 template.

## Representative Queries
- Deliver public assets through CDN for Astro
- Where can I host Deliver public assets through CDN built with Astro?
- I need a public-origin configuration, versioned asset build and observable cache behavior.

## Resource Requirements
- Primitive compute
- Primitive CDN

## Infrastructure Requirements
1. **Compute**  
   Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
2. **CDN**  
   The CDN host serves objects from published buckets. It does not front app compute and is not a cache or key-value store.

## Framework
Astro

## Workload
Deliver public assets through CDN

## Release Status
Published

## Support Status
Verified

## Execution Status
Ready

### Prerequisites
- A Astro project (astro build with the @astrojs/node standalone adapter then node ./dist/server/entry.mjs on the node-22 template)
- A bucket from `ample bucket create` with credentials passed as encrypted S3_* environment variables
- An Ample account token with servers:write, buckets:read

## Tested Configuration
- **Template:** node-22  
- **Runtime:** node  
- **Size:** s-1vcpu-1gb  
- **Install:** npm install  
- **Build:** npm run build --if-present  
- **Start:** npm run start

## Input Schema
```json
{
  "type": "object",
  "required": ["env", "name", "path"],
  "properties": {
    "env": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Z][A-Z0-9_]*=.*$"
      },
      "maxItems": 50
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 63,
      "pattern": "^[a-z0-9-]+$"
    },
    "path": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "release_command": {
      "type": "string",
      "maxLength": 512
    }
  },
  "additionalProperties": false
}
```

## Workflow Steps
1. **Build and start**  
   astro build with the @astrojs/node standalone adapter then node ./dist/server/entry.mjs on the node-22 template; the server must bind 0.0.0.0 on PORT.
2. **Publish a bucket for public assets**  
   Publish only the asset bucket; upload versioned keys with an immutable Cache-Control header and build URLs from its public URL.  
   **Command:** ample bucket publish 
3. **Verify**  
   Fetch the live URL and /p/versioned-static-assets on the example; on failure read the build and runtime logs.  
   **Command:** ample logs  --kind build

## Examples
- **Astro pattern fixture**  
   Verified CDN assets on Astro.  
   **Source Reference:** tests/deploy-canaries/astro-patterns

## Success Checks
- app responds on its public URL  
  **Kind:** http_get  
  **Path:** /  
  **Expect:** ample canary astro patterns
- versioned-static-assets check from the example  
  **Kind:** http_get  
  **Path:** /p/versioned-static-assets  
  **Expect:** see the pattern fixture checks

## Limitations
- Verified on the node-22 template at s-1vcpu-1gb; other sizes and Astro major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- The CDN serves published-bucket objects only; cache rules, purge and TTL control are not verified.

## Cost Estimate
- **Currency:** USD  
- **Monthly Amount:** 5.0  
- **Basis:** size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty  
- **Components:**  
  - **App Server:**  
    - Size: s-1vcpu-1gb  
    - Quantity: 1.0  
    - Monthly Amount: 5.0  
- **Note:** Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Evidence Summary
- **Kind:** canary_run  
   **Summary:** Astro pattern fixture deployed on Ample.  
   **Observed At:** 2026-09-20T03:31:44Z  
   **Implementation Revision:** 03b6402b1b3e19178985f08ea4033804521d85d4-dirty (CLI b75e104)  
   **Expires At:** 2027-03-19T03:31:44Z  
   **Scope:**  
   - **Checks:** /p/versioned-static-assets  
   - **Template:** node-22

## Last Verified At
2026-09-20T03:31:44Z

## MCP Binding
- **Registry Ref:** mcp:ample_deploy  
- **Tool Name:** ample_deploy  
- **Schema Hash:** 876465fce906da0c224d62961d3343064108ebe30af80cf1b87094974e948853  
- **Observed At:** 2026-09-21T03:19:59.461917+00:00  
- **Implementation Revision:** 49962bcade4f  
- **Required Scopes:** servers:write, buckets:read  
- **Binding State:** current

## Unknowns
- region availability is unknown until a verified region fact is recorded
- compliance attestations are unknown; none are claimed

## Formats
- **HTML:** https://ample.computer/guides/astro/cdn-assets  
- **Markdown:** https://ample.computer/guides/astro/cdn-assets.md  
- **JSON:** https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aastro%3Acdn-assets

## Next Actions
1. **Action:** Browse the catalog index  
   - **Method:** GET  
   - **Relative Path:** /v1/catalog
2. **Action:** Search published recipes by intent, stack and constraints  
   - **Method:** POST  
   - **Relative Path:** /v1/catalog/search  
   - **Parameters:**  
     - **Body:** {"limit":5, "query":"Deliver public assets through CDN for Astro"}  
3. **Action:** Prepare a side-effect-free deployment plan for an authorized project  
   - **Method:** POST  
   - **Relative Path:** /v1/catalog/plan  
   - **Parameters:**  
     - **Body:** {"inputs":{}, "projectId":"", "recipeId":"page:guides:astro:cdn-assets", "recipeRevision":"r1"}
4. **Action:** Read the existing agent authentication setup  
   - **Method:** GET  
   - **Relative Path:** /mcp/setup
5. **Action:** Browse Astro  
   - **Method:** GET  
   - **Relative Path:** /v1/catalog/nodes/stack%3Aframework-astro
6. **Action:** Browse Add CDN  
   - **Method:** GET  
   - **Relative Path:** /v1/catalog/nodes/intent%3Aadd-cdn
7. **Action:** Browse Versioned static assets  
   - **Method:** GET  
   - **Relative Path:** /v1/catalog/nodes/pattern%3Aversioned-static-assets
