{"catalogRevision":"cat_726f873af6f566cc","recipeId":"page:recipes:approval-workflow:phoenix:private-attachments","recipeRevision":"r1","canonicalPath":"/recipes/approval-workflow/phoenix/private-attachments","label":"Host approval workflow with Phoenix: private attachments","title":"How to host an approval workflow built with Phoenix on Ample: private attachments","family":"Workload recipe","summary":"Deploy an approval workflow built with Phoenix on Ample using the private document 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. Verified on Phoenix: a role-to-document access model with negative tests (401 without identity, 403 for the wrong role) and a private-bucket round-trip for the allowed role (private=ok). The approval workflow-specific behavior (your identity integration and role assignments) is your application code on that verified basis.","representativeQueries":["Host approval workflow with Phoenix: private attachments","Where can I host Approval workflow built with Phoenix?","I need attachment metadata, access checks and a tested private object access path."],"breadcrumbIds":["discovery","workload","workload:business-operations","workload:approval-workflow","page:recipes:approval-workflow:phoenix:private-attachments"],"breadcrumbs":[{"id":"discovery","label":"Agent hosting discovery","canonicalPath":"/discover/discovery","kind":"root"},{"id":"workload","label":"Applications and workloads","canonicalPath":"/discover/workload","kind":"facet"},{"id":"workload:business-operations","label":"Business operations","canonicalPath":"/discover/workload/business-operations","kind":"group"},{"id":"workload:approval-workflow","label":"Approval workflow","canonicalPath":"/discover/workload/approval-workflow","kind":"atom"},{"id":"page:recipes:approval-workflow:phoenix:private-attachments","label":"Host approval workflow with Phoenix: private attachments","canonicalPath":"/recipes/approval-workflow/phoenix/private-attachments","kind":"recipe"}],"parentIds":["workload:approval-workflow","stack:framework-phoenix","pattern:private-document-library","intent:deploy-web-app"],"parents":[{"id":"workload:approval-workflow","label":"Approval workflow","canonicalPath":"/discover/workload/approval-workflow","kind":"atom"},{"id":"stack:framework-phoenix","label":"Phoenix","canonicalPath":"/discover/stack/framework-phoenix","kind":"atom"},{"id":"pattern:private-document-library","label":"Private document library","canonicalPath":"/discover/pattern/private-document-library","kind":"atom"},{"id":"intent:deploy-web-app","label":"Deploy web app","canonicalPath":"/discover/intent/deploy-web-app","kind":"atom"}],"resourceRequirements":["primitive:compute","primitive:postgres","primitive:s3-compatible-object-storage"],"infrastructureRequirements":[{"primitiveId":"primitive:compute","label":"Compute","canonicalPath":"/discover/primitive/compute","status":"verified","summary":"Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes."},{"primitiveId":"primitive:postgres","label":"Postgres","canonicalPath":"/discover/primitive/postgres","status":"verified","summary":"Managed PostgreSQL 16 with pgvector runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied."},{"primitiveId":"primitive:s3-compatible-object-storage","label":"S3-compatible object storage","canonicalPath":"/discover/primitive/s3-compatible-object-storage","status":"verified","summary":"Buckets speak the S3 API with SigV4 credentials Ample Computer issues; `ample bucket upload-url` returns a presigned upload URL. PutObject and GetObject are checked by canary."}],"framework":"Phoenix","workload":"Approval workflow","releaseStatus":"published","supportStatus":"verified","executionStatus":"ready","docsOnly":false,"prerequisites":["A Phoenix project that builds and starts with the documented commands (mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs)","A PostgreSQL driver reading DATABASE_URL at runtime (auto-provisioned when omitted, or supplied with --env)","A bucket from `ample bucket create` with its credentials passed as encrypted S3_* environment variables","An Ample account token with servers:write, databases:read, buckets:read"],"testedConfiguration":{"template":"elixir-1.18","runtime":"elixir","size":"s-1vcpu-1gb","install":"mix local.hex --force && mix local.rebar --force && MIX_ENV=prod mix deps.get --only prod","build":"MIX_ENV=prod mix compile && MIX_ENV=prod mix release --overwrite","start":"PHX_SERVER=true _build/prod/rel/$(ls _build/prod/rel | head -n 1)/bin/$(ls _build/prod/rel | head -n 1) start"},"inputSchema":{"additionalProperties":false,"properties":{"env":{"description":"Encrypted environment variables (bucket credentials, secrets)","items":{"pattern":"^[A-Z][A-Z0-9_]*=.*$","type":"string"},"maxItems":50,"type":"array"},"name":{"description":"App name","maxLength":63,"minLength":1,"pattern":"^[a-z0-9-]+$","type":"string"},"path":{"description":"Project directory or ample.toml service","maxLength":512,"minLength":1,"type":"string"},"release_command":{"description":"Migration command run before activation","maxLength":512,"type":"string"}},"required":["env","name","path"],"type":"object"},"outputSchema":null,"workflowSteps":[{"title":"Build and start","body":"mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs. The server must bind 0.0.0.0 on PORT."},{"title":"Implement the pattern on PostgreSQL","body":"The fixture's module implements private document library: a role-to-document access model with negative tests (401 without identity, 403 for the wrong role) and a private-bucket round-trip for the allowed role (private=ok). Copy the approach into your schema; keep migrations idempotent and run them with --release-command."},{"title":"Wire object storage","body":"Create the bucket(s), then pass endpoint, region, bucket and keys as --env values. Use path-style addressing. Keep private data in an unpublished bucket."},{"title":"Deploy","body":"Run the synchronous deploy once and read the result (exit 0 live, 1 failed, 2 needs an answer first). Re-running with no change is a no-op.","command":"ample deploy . --name <app-name> --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=..."},{"title":"Verify","body":"Fetch the live URL and the pattern self-test route(s) (/p/private-document-library) from the example; then run your own checks. On failure read `ample logs <deployment_id> --kind build` then `--kind runtime`.","command":"ample logs <deployment_id> --kind build"}],"examples":[{"title":"Phoenix pattern fixture","description":"Multi-pattern Phoenix app whose private document library module was checked live; the module is under tests/deploy-canaries/_pattern-modules.","sourceRef":"tests/deploy-canaries/phoenix-patterns"}],"successChecks":[{"description":"app responds on its public URL","kind":"http_get","path":"/","expect":"ample canary phoenix patterns"},{"description":"private-document-library self-test","kind":"http_get","path":"/p/private-document-library","expect":"private=ok (with ?role=owner; 401 without, 403 for viewer)"}],"limitations":["Verified on the elixir-1.18 template at s-1vcpu-1gb with the example fixture.","The pattern checks verified the platform side; the approval workflow itself (your identity integration and role assignments) is your application code.","Managed PostgreSQL 16 with pgvector; apps and their databases are placed together.","Buckets speak the standard S3 API (PutObject and GetObject with path-style addressing are checked by the fixture); `ample bucket upload-url` returns presigned upload URLs."],"costEstimate":{"currency":"USD","monthlyAmount":10.0,"authoritative":true,"basis":"size prices from pricing.toml (loaded by the API) at build revision 3a3dfe06151688a20d397caac2aa66e562c23eb0","components":[{"name":"app server","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0},{"name":"managed PostgreSQL database","size":"s-1vcpu-1gb","quantity":1.0,"monthlyAmount":5.0}],"note":"Upper-bound monthly price of the tested sizes. Buckets are allocation-priced per quota and not included."},"evidenceSummary":[{"kind":"canary_run","summary":"Phoenix pattern fixture deployed on Ample (mix deps.get, MIX_ENV=prod mix compile and mix release in the builder, then the release bin script with PHX_SERVER=true on the elixir-1.18 template; PORT, DATABASE_URL and SECRET_KEY_BASE read in config/runtime.exs); checks passed for private-document-library and configuration-secrets. Pattern proof: a role-to-document access model with negative tests (401 without identity, 403 for the wrong role) and a private-bucket round-trip for the allowed role (private=ok).","observedAt":"2026-11-06T00:38:14Z","implementationRevision":"7360fc06ef21","expiresAt":"2027-05-05T00:38:14Z","scope":{"checks":["/p/private-document-library"],"pattern":"pattern:private-document-library","template":"elixir-1.18"}},{"kind":"canary_run","summary":"The same Phoenix app deployed with a --release-command migration; the marker it created was readable after activation.","observedAt":"2026-11-06T00:41:08Z","implementationRevision":"7360fc06ef21","expiresAt":"2027-05-05T00:41:08Z","scope":{"pattern":"pattern:private-document-library"}}],"lastVerifiedAt":"2026-11-06T00:38:14Z","mcpBinding":{"registryRef":"mcp:ample_deploy","toolName":"ample_deploy","schemaHash":"0802c329be823fa0695460cf73206d47a6fa0efa57417c386c34b6614a92ea5f","observedAt":"2026-11-06T06:16:17.558478534+00:00","implementationRevision":"4558e9477d09","requiredScopes":["servers:write","databases:read","buckets:read"],"bindingState":"current"},"unknowns":[],"formats":{"html":"https://ample.computer/recipes/approval-workflow/phoenix/private-attachments","markdown":"https://ample.computer/recipes/approval-workflow/phoenix/private-attachments.md","json":"https://api.ample.computer/v1/catalog/recipes/page%3Arecipes%3Aapproval-workflow%3Aphoenix%3Aprivate-attachments"},"nextActions":[{"actionId":"browse-catalog","label":"Browse the catalog index","operationId":"catalog_index","method":"GET","relativePath":"/v1/catalog","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"search-recipes","label":"Search published recipes by intent, stack and constraints","operationId":"search_recipes","method":"POST","relativePath":"/v1/catalog/search","origin":"api","parameters":{"body":{"limit":5,"query":"Host approval workflow with Phoenix: private attachments"}},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"plan:page:recipes:approval-workflow:phoenix:private-attachments","label":"Prepare a side-effect-free deployment plan for an authorized project","operationId":"plan_deployment","method":"POST","relativePath":"/v1/catalog/plan","origin":"api","parameters":{"body":{"inputs":{},"projectId":"<workspace or server id you own>","recipeId":"page:recipes:approval-workflow:phoenix:private-attachments","recipeRevision":"r1"}},"requiresAuthentication":true,"requiresApproval":false},{"actionId":"auth-setup","label":"Read the existing agent authentication setup","operationId":"existing_auth_setup","method":"GET","relativePath":"/mcp/setup","origin":"api","parameters":{},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:workload:approval-workflow","label":"Browse Approval workflow","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/workload%3Aapproval-workflow","origin":"api","parameters":{"nodeId":"workload:approval-workflow"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:stack:framework-phoenix","label":"Browse Phoenix","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/stack%3Aframework-phoenix","origin":"api","parameters":{"nodeId":"stack:framework-phoenix"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:pattern:private-document-library","label":"Browse Private document library","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/pattern%3Aprivate-document-library","origin":"api","parameters":{"nodeId":"pattern:private-document-library"},"requiresAuthentication":false,"requiresApproval":false},{"actionId":"browse:intent:deploy-web-app","label":"Browse Deploy web app","operationId":"browse_node","method":"GET","relativePath":"/v1/catalog/nodes/intent%3Adeploy-web-app","origin":"api","parameters":{"nodeId":"intent:deploy-web-app"},"requiresAuthentication":false,"requiresApproval":false}]}