# Deployment Overview {#deployment-overview}



## Architecture {#architecture}


MQUAD is deployed as a set of Docker containers orchestrated via Docker Compose. All services run on a shared `mquad-network` bridge network with Traefik as the ingress gateway.


## Environment Requirements {#environment-requirements}


| Resource | Minimum | Recommended |
|----------|---------|-------------|
| CPU | 4 cores | 8+ cores |
| RAM | 8 GB | 16+ GB |
| Disk | 50 GB | 100+ GB SSD |
| Docker | 24+ | 24+ |
| OS | Linux/macOS | Linux (production) |


## Docker vs Bare Metal {#docker-vs-bare-metal}


| Aspect | Docker (Recommended) | Bare Metal |
|--------|---------------------|------------|
| Setup | Single command | Manual per service |
| Isolation | Container-level | Process-level |
| Scaling | Horizontal via Compose | Manual |
| Networking | Built-in bridge | Manual config |
| Port conflicts | Isolation via containers | Potential conflicts |
| Upgrade | Rolling rebuilds | Per-process |


## Networking {#networking}


All containers attach to the `mquad-network` bridge:

```yaml
networks:
  mquad-network:
    driver: bridge
    name: mquad-network
```

Service discovery uses Docker DNS — services resolve each other by container name (e.g., `http://survey-service:8001`).


## Environment Files {#environment-files}


| File | Location | Purpose |
|------|----------|---------|
| `.env` | Project root | Shared environment variables |
| `backend/.env` | backend/ | Backend-specific settings |
| `survey-service/.env` | survey-service/ | Survey service settings |


## Configuration Pattern {#configuration-pattern}


```bash
# .env (project root)
ENVIRONMENT=development
HOST_MAIN_DOMAIN=mquad.local
LOG_JSON=true

# Service-specific .env
DATABASE_URL=postgresql+asyncpg://appuser:appsecret@postgres:5432/survey_db
REDIS_URI=redis://:${REDIS_PASSWORD}@redis:6379
```


## Shared Module {#shared-module}


The `common/` directory is mounted into every service container at `/opt/common`:

```yaml
volumes:
  - ./common:/opt/common
```

Each service must add this to Python path before importing:

```python
import sys
sys.path.insert(0, "/opt/common")
```
