page:guides:sinatra:cdn assets
Deliver public assets through CDN for Sinatra
Summary: Cdn assets for a Sinatra app on Ample. Verified on Sinatra: a versioned, immutable-cached asset uploaded to a published bucket and served from the CDN URL. Build and start: bundle install into vendor/bundle from Gemfile.lock (development and test groups skipped), then Puma via rackup (config.ru) reading PORT on the ruby-3.4 template.
Representative Queries
- Deliver public assets through CDN for Sinatra
- Where can I host Deliver public assets through CDN built with Sinatra?
- I need a public-origin configuration, versioned asset build and observable cache behavior.
Resource Requirements
- Compute ([34mprimitive:compute[39m): Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- CDN ([34mprimitive:cdn[39m): The CDN host serves objects from published buckets. It does not front app compute and is not a cache or key-value store.
Prerequisites
- A Sinatra project (
bundle installintovendor/bundlefromGemfile.lock(development and test groups skipped), then Puma viarackup(config.ru) reading PORT on the ruby-3.4 template). - A bucket from
ample bucket createwith credentials passed as encrypted S3_* environment variables. - An Ample account token with
servers:write,buckets:read.
Workflow Steps
- Build and start:
bundle installintovendor/bundlefromGemfile.lock(development and test groups skipped), then Puma viarackup(config.ru) reading PORT on the ruby-3.4 template; the server must bind0.0.0.0on PORT. - 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 - Verify: Fetch the live URL and
/p/versioned-static-assetson the example; on failure read the build and runtime logs. Command:ample logs --kind build
Examples
- Sinatra pattern fixture: Verified CDN assets on Sinatra.
Success Checks
- App responds on its public URL
- Versioned-static-assets check from the example.
Limitations
- Verified on the ruby-3.4 template at s-1vcpu-1gb; other sizes and Sinatra 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.tomlat build revision1ac5595375130d45290090e82ed0f554ccd45405-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.
Last Verified At
2026-09-20T23:45:31Z
Formats
- HTML: https://ample.computer/guides/sinatra/cdn-assets
- Markdown: https://ample.computer/guides/sinatra/cdn-assets.md
- JSON: https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Asinatra%3Acdn-assets
Next Actions
- Browse the catalog index
- Search published recipes by intent, stack and constraints
- Prepare a side-effect-free deployment plan for an authorized project
- Read the existing agent authentication setup
- Browse Sinatra
- Browse Add CDN
- Browse Versioned static assets