> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.adid.dev/llms.txt.
> For full documentation content, see https://docs.adid.dev/llms-full.txt.

# Docker Setup

Run the complete IDA platform using Docker Compose.

## Prerequisites

| Tool           | Version       |
| -------------- | ------------- |
| Docker         | 24+           |
| Docker Compose | v2+           |
| Available RAM  | 8 GB minimum  |
| Disk space     | 10 GB minimum |

## Quick Start

```bash
git clone https://github.com/infinia/ida.git
cd ida
docker compose up -d
```

## docker-compose.yml

```yaml
version: '3.8'

services:
  # ====== ADI Blockchain ======
  adi-node-1:
    image: infinia/adi-node:latest
    container_name: adi-node-1
    ports:
      - "30303:30303"
      - "8545:8545"
    volumes:
      - adi-data-1:/data
    environment:
      - NETWORK=devnet
      - NODE_ID=1
      - VALIDATOR=true
    networks:
      - ida-network

  adi-node-2:
    image: infinia/adi-node:latest
    container_name: adi-node-2
    ports:
      - "30304:30303"
      - "8546:8545"
    volumes:
      - adi-data-2:/data
    environment:
      - NETWORK=devnet
      - NODE_ID=2
      - VALIDATOR=true
      - BOOTNODE=adi-node-1:30303
    depends_on:
      - adi-node-1
    networks:
      - ida-network

  # ====== Infrastructure ======
  postgres:
    image: postgres:16-alpine
    container_name: ida-postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: ida
      POSTGRES_USER: ida
      POSTGRES_PASSWORD: ida_secret
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - ida-network

  redis:
    image: redis:7-alpine
    container_name: ida-redis
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data
    networks:
      - ida-network

  nats:
    image: nats:2.10-alpine
    container_name: ida-nats
    ports:
      - "4222:4222"
      - "8222:8222"
    networks:
      - ida-network

  ipfs:
    image: ipfs/kubo:latest
    container_name: ida-ipfs
    ports:
      - "5001:5001"
      - "8088:8080"
    volumes:
      - ipfs-data:/data/ipfs
    networks:
      - ida-network

  # ====== IDA Services ======
  ida-api:
    image: infinia/ida-api:latest
    container_name: ida-api
    ports:
      - "8080:8080"
    environment:
      DATABASE_URL: postgres://ida:ida_secret@postgres:5432/ida?sslmode=disable
      REDIS_URL: redis://redis:6379
      ADI_RPC_URL: http://adi-node-1:8545
      NATS_URL: nats://nats:4222
      IPFS_API_URL: http://ipfs:5001
      LOG_LEVEL: info
    depends_on:
      - postgres
      - redis
      - nats
      - ipfs
      - adi-node-1
    networks:
      - ida-network
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 10s
      timeout: 5s
      retries: 5

  ida-resolver:
    image: infinia/ida-resolver:latest
    container_name: ida-resolver
    ports:
      - "8081:8081"
    environment:
      ADI_RPC_URL: http://adi-node-1:8545
      REDIS_URL: redis://redis:6379
      IPFS_API_URL: http://ipfs:5001
    depends_on:
      - redis
      - adi-node-1
      - ipfs
    networks:
      - ida-network

  ida-portal:
    image: infinia/ida-portal:latest
    container_name: ida-portal
    ports:
      - "3000:80"
    environment:
      VITE_API_URL: http://localhost:8080
    depends_on:
      - ida-api
    networks:
      - ida-network

  # ====== Contract Deployer (runs once) ======
  contract-deployer:
    image: infinia/ida-contracts:latest
    container_name: ida-contract-deployer
    environment:
      ADI_RPC_URL: http://adi-node-1:8545
    depends_on:
      adi-node-1:
        condition: service_started
    networks:
      - ida-network
    restart: "no"

volumes:
  adi-data-1:
  adi-data-2:
  postgres-data:
  redis-data:
  ipfs-data:

networks:
  ida-network:
    driver: bridge
```

## Service Ports

| Service      | Port        | Description            |
| ------------ | ----------- | ---------------------- |
| ida-api      | 8080        | IDA Platform API       |
| ida-resolver | 8081        | DID Universal Resolver |
| ida-portal   | 3000        | Web Portal             |
| adi-node-1   | 30303, 8545 | ADI blockchain node 1  |
| adi-node-2   | 30304, 8546 | ADI blockchain node 2  |
| postgres     | 5432        | PostgreSQL database    |
| redis        | 6379        | Redis cache            |
| nats         | 4222        | NATS message queue     |
| ipfs         | 5001        | IPFS API               |

## Operations

### Start all services

```bash
docker compose up -d
```

### View logs

```bash
docker compose logs -f ida-api
docker compose logs -f adi-node-1
```

### Stop all services

```bash
docker compose down
```

### Stop and remove all data

```bash
docker compose down -v
```

### Rebuild after code changes

```bash
docker compose build ida-api ida-portal
docker compose up -d ida-api ida-portal
```

## Health Checks

```bash
# API health
curl http://localhost:8080/health

# Blockchain sync status
curl http://localhost:8545 -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

# Redis ping
docker exec ida-redis redis-cli ping

# PostgreSQL status
docker exec ida-postgres pg_isready
```

## Environment Variables

See [Configuration](configuration.md) for a full list of environment variables.