# Deployment Documentation

The application is designed to be deployed as a Docker container behind a Caddy reverse proxy.

## Docker Setup

### `Dockerfile`
- Based on `python:3.11-slim`.
- Installs `iputils-ping` for network diagnostics.
- Uses `uvicorn` to serve the FastAPI app.

### `docker-compose.yml`
- Defines the `monitor-app` service.
- Connects to `caddy_network` for external access.
- Passes SSH credentials via environment variables.

## Caddy Configuration
Add this to your `Caddyfile`:

```caddy
asf.monitor.nabd-co.com {
    reverse_proxy monitor-app:8000
}
```

## Troubleshooting

### `KeyError: 'ContainerConfig'`
This error occurs when using `docker-compose` V1 with images built by newer Docker versions.
**Solution**: Use `docker compose` (V2) or disable BuildKit:
```bash
DOCKER_BUILDKIT=0 COMPOSE_DOCKER_CLI_BUILD=0 docker-compose up -d --build
```

### SSH Connectivity
Ensure the cloud server can reach the target IPs/hostnames on the specified ports (49152 and 2222).
