# /deploy — Docker Deployment

Docker Compose deployment management for the mawidi-site application.

## Usage

```
/deploy                    # Full build + start
/deploy build              # Build Docker image only
/deploy up                 # Start containers
/deploy down               # Stop containers
/deploy logs               # Tail application logs
/deploy reset              # WARNING: Wipes data! Full rebuild
/deploy status             # Health check and container status
/deploy restart            # Stop + start containers
```

**Examples:**
- `/deploy`
- `/deploy status`
- `/deploy logs`
- `/deploy reset`

## Workflow

### Default: Full Deploy
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site
docker compose build
docker compose up -d
```
Then verify with health check.

### Build Only
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site && docker compose build
```

### Start Containers
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site && docker compose up -d
```

### Stop Containers
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site && docker compose down
```

### Tail Logs
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site && docker compose logs -f --tail=100
```

### Reset (DANGEROUS)
**ALWAYS warn the user** before running reset:
```
WARNING: This will wipe all data and rebuild from scratch!
Are you sure? (y/N)
```
Only if confirmed:
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site
docker compose down -v
docker compose build --no-cache
docker compose up -d
```

### Status / Health Check
```bash
cd /Users/Asim/Desktop/mawidi_codex/mawidi-site
docker compose ps
```
Then check health endpoints:
```bash
curl -s http://localhost:9000/api/health | jq .
curl -s http://localhost:9000/api/health/ready | jq .
curl -s http://localhost:9000/api/health/database | jq .
curl -s http://localhost:9000/api/health/redis | jq .
```

## Output Format

```
DEPLOY STATUS
=============
Containers:
  mawidi-app    UP (healthy)     port 9000
  postgres      UP (healthy)     port 5432
  redis         UP (healthy)     port 6379

Health Checks:
  /api/health           OK
  /api/health/ready     OK
  /api/health/database  OK
  /api/health/redis     OK
```

## Key Rules
- Always check `docker compose ps` first
- ALWAYS warn before reset/destructive operations
- Port is always 9000
- Check health endpoints after deploy
- If containers are unhealthy, check logs first
