Host rest api with Spring Boot: worker execution and job state | Ample

INFRASTRUCTURE

What it needs

PREREQUISITES

Before you start

TESTED CONFIGURATION

Exactly what was tested

STEP BY STEP

How to do it

  1. Plan the topology
    Run the planner once. It discovers the web and worker services, infers kind = "worker" for the process without a port, declares the database each service needs, and writes ample.toml. Exit 2 means it left questions in the manifest; answer them with --answer or by editing the file.

    ample plan --write .
    
  2. Share one database
    Keep a single [databases.main] with engine = "postgres", drop any per-service database the planner added, and set DATABASE_URL = { database = "main" } under both [services.web.env] and [services.worker.env].

    ample plan --offline .
    
  3. Apply
    Reconcile the whole manifest in dependency order: the database first, then both services. It is idempotent and never destructive; exit 0 means everything applied, 2 needs input, 1 a failed resource (independent siblings still proceed and re-running resumes).

    ample up .
    
  4. Verify
    Fetch the web service URL and its worker status route (/p/worker-queue/status in the example) and confirm the worker processed the enqueued job; on failure read the worker service's runtime logs.

    ample logs <deployment_id> --kind runtime
    

EXAMPLES

Tested examples

SUCCESS CHECKS

How to know it worked

LIMITATIONS

Know the limits

COST

Cost estimate

Estimated 15.00 USD per month (size prices from pricing.toml at build revision a1b8c38919e59cd035ebabaced73cf84ece24371).

Always-on monthly price of the tested sizes for the web service, the worker service and the database; apps auto-pause when idle.

EVIDENCE

Verification evidence

EXECUTION

Execution binding

MCP tool ample_up (registry mcp:ample_up), schema hash db7ca0facfe2cd28 observed 2026-09-21T03:19:59.525781+00:00 at revision 49962bcade4f. Binding state at export: current. Required scopes: servers:write, databases:write.

NEXT ACTIONS

Typed next actions

Actions describe possible next steps. They are typed data, not commands, and grant no permission. Public discovery never provisions anything; planning requires your own authenticated token and approval happens in your client.