# Host storefront with Symfony: relational catalog data

## Summary

Deploy a storefront built with Symfony on Ample using the transactional workflows 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. Verified on Symfony: an optimistic version check and an event row written in the same transaction, a stale update rejected, and a history query over the application-owned events (history=2 conflict=rejected). Not separately tested: your domain records, validation rules and concurrency policy; treat the storefront-specific behavior as your application code.

## Infrastructure requirements

- **Compute**: verified (Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.)
- **Postgres**: verified (Managed PostgreSQL 16 runs in its own microVM and is auto-provisioned when an app needs a database and no DATABASE_URL is supplied.)

## Prerequisites

- A Symfony project that builds and starts with the documented commands (`composer install --no-dev` from composer.lock with Symfony Runtime's dotenv disabled - .env never ships, its values arrive as encrypted env).
- A PostgreSQL driver reading DATABASE_URL at runtime (auto-provisioned when omitted or supplied with --env).
- An Ample account token with `servers:write`, `databases:read`.

## Exact tested configuration

- **Template**: `php-8.5`
- **Runtime**: `php`
- **Size**: `s-1vcpu-1gb`
- **Install**: `composer install --no-dev --prefer-dist --no-interaction --no-progress --optimize-autoloader`
- **Start**: `frankenphp php-server --listen :$PORT --root public`

## Steps

1. **Build and start.** `composer install --no-dev` from composer.lock with Symfony Runtime's dotenv disabled, then FrankenPHP serving public/ (php-server with the index.php fallback) reading PORT on the php-8.5 template with APP_ENV=prod. The server must bind 0.0.0.0 on PORT.
2. **Implement the pattern on PostgreSQL.** The fixture's module implements transactional workflows: an optimistic version check and an event row written in the same transaction, a stale update rejected, and a history query over the application-owned events (history=2 conflict=rejected). Copy the approach into your schema; keep migrations idempotent and run them with --release-command.
3. **Deploy.** Run the synchronous deploy once and read the result (exit 0 live, 1 failed, 2 blocked).
   
   ```
   ample deploy . --name <app-name> --public
   ```
4. **Verify.** Fetch the live URL and run your own checks.
   
   ```
   ample logs <deployment_id> --kind build
   ```

## Tested examples

- **Symfony pattern fixture** (tests/deploy-canaries/symfony-patterns): Multi-pattern Symfony app whose transactional workflows module was checked live.

## Success checks

- App responds on its public URL.
- Transactional-workflows self-test from the live URL.

## Limitations

- Verified only with the php-8.5 template at s-1vcpu-1gb.
- The storefront-specific behavior must be treated as application code and was not tested separately.
- Regional and compliance limits are unknown.
- Apps auto-pause when idle and wake on the next request.
- Managed PostgreSQL 16 limitations apply.

## Cost estimate

Estimated 10.00 USD per month.
- App server x1 `s-1vcpu-1gb`: 5.00 USD
- Managed PostgreSQL database x1 `s-1vcpu-1gb`: 5.00 USD

## Verification evidence

- Canary run on 2026-09-20: Symfony pattern fixture was deployed on Ample; checks passed for transactional-workflows and configuration-secrets.
