page:recipes:marketplace:spring boot:product media

Host marketplace with Spring Boot: public product media

Summary

Deploy a marketplace built with Spring Boot on Ample using the public media library pattern. Compute runs the app in an isolated microVM behind a public HTTPS URL, a managed PostgreSQL 16 database is auto-provisioned and injected as DATABASE_URL, a private S3-compatible bucket holds objects with credentials delivered as encrypted environment variables, and a published bucket serves public assets from the CDN host. Verified on Spring Boot: an object written to a published bucket with an immutable Cache-Control header, a mapping row, and the CDN URL serving it publicly. Not separately tested: your media processing, object layout and cache policy; treat the marketplace-specific behavior as your application code.

Resource Requirements

Infrastructure Requirements

Prerequisites

  1. A Spring Boot project that builds and starts with the documented commands (e.g., ./mvnw -q -DskipTests package).
  2. A PostgreSQL driver reading DATABASE_URL at runtime.
  3. A bucket from ample bucket create with its credentials passed as encrypted S3_* environment variables.
  4. An Ample account token with servers:write, databases:read, buckets:read.

Workflow Steps

  1. Build and start
    Run: ./mvnw -q -DskipTests package, then java -jar on the jvm-21 template with server.port read from PORT.
  2. Implement the pattern on PostgreSQL
    Copy the public media library approach into your schema; keep migrations idempotent.
  3. Wire object storage
    Create buckets and pass endpoint, region, bucket, and keys as --env values.
  4. Deploy
    Run: ample deploy . --name ... --public ...
  5. Verify
    Check the live URL and run your own checks.

Examples

Limitations

  1. Verified only on the jvm-21 template at s-1vcpu-2gb with example fixture.
  2. Marketplace media processing and object layout were not separately tested.

Cost Estimate

Next Actions