# Apply Database Schema Changes for ASP.NET Core

## Summary
Schema changes for an ASP.NET Core app on Ample. Verified on ASP.NET Core: a --release-command migration ran before activation and its marker was readable by the live app (migrated=release-ok). Build and start: `dotnet publish -c Release -o out` in the builder, then `dotnet .dll` on the dotnet-10 template with `ASPNETCORE_URLS` bound to `PORT`.

## Resource Requirements
- **Compute**
- **Postgres**

## Infrastructure Requirements
- **Compute**: Verified, runs in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.
- **Postgres**: 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
- An ASP.NET Core project (`dotnet publish -c Release -o out` in the builder, then `dotnet .dll` on the dotnet-10 template with `ASPNETCORE_URLS` bound to `PORT`)
- A PostgreSQL driver reading `DATABASE_URL` at runtime
- An Ample account token with `servers:write`, `databases:read`

## Workload
### Build and Start
`dotnet publish -c Release -o out` in the builder, then `dotnet .dll` on the dotnet-10 template with `ASPNETCORE_URLS` bound to `PORT`; the server must bind `0.0.0.0` on `PORT`.

### Run Migrations as the Release Command
Ample runs the command before activation and fails the release if it exits non-zero; keep migrations idempotent.
```bash
ample deploy . --name <app_name> --public --release-command "python3 migrate.py"
```

### Verify
Fetch the live URL and `/p/migrated` on the example; on failure read the build and runtime logs.
```bash
ample logs <app_name> --kind build
```

## Limitations
- Verified on the dotnet-10 template at `s-1vcpu-1gb`; other sizes and ASP.NET Core major versions are not verified.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.

## Success Checks
1. App responds on its public URL.
   - **Kind**: `http_get`
   - **Path**: `/`
   - **Expect**: "ample canary asp net core patterns"

2. Migrated check from the example.
   - **Kind**: `http_get`
   - **Path**: `/p/migrated`
   - **Expect**: "see the pattern fixture checks"

## Cost Estimate
- **Currency**: USD
- **Monthly Amount**: 10.0
- **Basis**: Size prices from `pricing.toml` (loaded by the API) at build revision `1ac5595375130d45290090e82ed0f554ccd45405-dirty`.
- **Components**:
  - App server (`s-1vcpu-1gb`): $5.0/month
  - Managed PostgreSQL database (`s-1vcpu-1gb`): $5.0/month
- **Note**: Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Examples
### ASP.NET Core Pattern Fixture
- **Description**: Verified schema changes on ASP.NET Core.
- **Source Reference**: tests/deploy-canaries/asp-net-core-patterns

## Next Actions
- **Browse the catalog index**: `/v1/catalog`
- **Search published recipes by intent, stack, and constraints**: `/v1/catalog/search` 
- **Prepare a side-effect-free deployment plan for an authorized project**: `/v1/catalog/plan`
- **Read the existing agent authentication setup**: `/mcp/setup`
- **Browse ASP.NET Core**: `/v1/catalog/nodes/stack%3Aframework-asp-net-core`
- **Browse Configure Deployment**: `/v1/catalog/nodes/intent%3Aconfigure-deployment`
- **Browse Transactional Workflows**: `/v1/catalog/nodes/pattern%3Atransactional-workflows`
