audb 0.1.11

AuDB - Compile-time database application framework with gold files
Documentation
# Deployment Configuration Example

This example demonstrates how to configure deployment settings in gold files using the `config deployment { ... }` block.

## Files

- `gold/app.au` - Example gold file with deployment configuration

## Deployment Configuration

The deployment config block supports:

### Basic Settings

```au
config deployment {
  target = "docker"           // docker, systemd, daemon, or local
  persist = true              // persist across reboots
  port = 3000                 // port to expose
  restart = "unless-stopped"  // restart policy
}
```

### Environment Variables

```au
config deployment {
  environment {
    DATABASE_URL = "sqlite://data/app.db"
    LOG_LEVEL = "info"
    RUST_LOG = "debug"
  }
}
```

### Volume Mappings

```au
config deployment {
  volumes {
    "./data" = "/app/data"  // host_path = container_path
    "./logs" = "/app/logs"
  }
}
```

### Health Checks

```au
config deployment {
  healthcheck {
    endpoint = "/api/health"  // health check endpoint
    interval = "10s"          // check interval
    timeout = "30s"           // request timeout
    retries = 5               // retries before unhealthy
  }
}
```

## Testing the Configuration

From this directory:

```bash
# Parse and validate the configuration
au check

# Deploy using the configuration
au deploy start

# Check deployment status
au deploy status

# View logs
au deploy logs

# Stop deployment
au deploy stop
```

## What Gets Deployed

When you run `au deploy start`, the CLI will:

1. Parse `gold/app.au` and extract the deployment config
2. Validate the gold files
3. Generate code from schemas and queries
4. Build release binary (`cargo build --release`)
5. Create Docker image with the specified configuration:
   - Port 3000 exposed
   - Environment variables set
   - Volumes mounted
   - Health check configured on `/api/health`
6. Start the container with `unless-stopped` restart policy
7. Verify deployment with health checks

## Fallback Behavior

If no `config deployment { ... }` block is found:
- Uses Docker as default target
- Port 8080
- Basic health check on `/health`
- No environment variables or volumes
- Restart policy: `unless-stopped`

## Notes

- The deployment config is parsed at deploy time from the gold files
- Changes to the config require redeployment
- Invalid configurations will show warnings and fall back to defaults
- You can override settings with CLI flags (TODO: implementation in progress)