# The Big Combo

We've reached the moment of truth. We have an Oracle server (free), Swap memory (to prevent crashing), and a secure Tunnel. Now, let's install the software that will actually work for us.

If we were to install [**n8n**](https://n8n.io/) and [**Evolution API**](https://doc.evolution-api.com/v2/en/get-started/introduction) the "old way," we'd have to download files, install Node.js dependencies, configure databases manually... a nightmare.

But since we are using **Docker**, we'll use the "Combo" strategy with **Docker Compose**.

**1\. The Recipe (The Magic File)**

Docker Compose allows us to write a "recipe" in a text file. We say: "I want a Postgres database, a Redis cache, the WhatsApp API, and n8n. And I want them all to talk to each other."

Go to your project folder (`cd ~/n8n`) and edit the file (`nano docker-compose.yml`). Delete whatever is inside and paste this **Full Stack**:

YAML

```bash
services:
  # 1. Database (Postgres for Evolution)
  postgres:
    image: postgres:15-alpine
    restart: always
    environment:
      POSTGRES_USER: evolution
      POSTGRES_PASSWORD: evolution_password
      POSTGRES_DB: evolution
    volumes:
      - evolution_db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U evolution"]
      interval: 5s
      timeout: 5s
      retries: 5

  # 2. Cache (Redis for Evolution)
  redis:
    image: redis:alpine
    restart: always
    command: ["redis-server", "--appendonly", "no"]

  # 3. Evolution API v2 (WhatsApp)
  evolution:
    image: atendai/evolution-api:v2.2.2
    restart: always
    ports:
      - "8080:8080"
    environment:
      - SERVER_URL=https://api.YOURDOMAIN.com
      - AUTHENTICATION_API_KEY=[YOUR-AUTHENTICATION-KEY-GOES-HERE]
      - DATABASE_ENABLED=true
      - DATABASE_PROVIDER=postgresql
      - DATABASE_CONNECTION_URI=postgresql://evolution:evolution_password@postgres:5432/evolution
      - CACHE_REDIS_ENABLED=true
      - CACHE_REDIS_URI=redis://redis:6379/0
      - DEL_INSTANCE=false
      # Trick to prevent WhatsApp Web disconnection
      - CONFIG_SESSION_PHONE_VERSION=2.3000.1019430043
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started

  # 4. n8n (Automation)
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.YOURDOMAIN.com
      - WEBHOOK_URL=https://n8n.YOURDOMAIN.com/
      - GENERIC_TIMEZONE=America/Sao_Paulo
      - TZ=America/Sao_Paulo
      - N8N_SECURE_COOKIE=false
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:
  evolution_db:
```

**2\. The Integration Secret (Networking)**

The magic happens in Docker's internal network. When connecting n8n to the Evolution API, **do not use** the external address ([`https://api`](https://api)`...`). Use the internal Docker network address:

👉 **URL:** [`http://evolution:8080`](http://evolution:8080)

This allows n8n to talk directly to the WhatsApp container via a virtual network cable, without going out to the internet. It is safer, instant, and bypasses the firewall.

**3\. The Launch Command**

After saving the file (`Ctrl+O`, `Ctrl+X`), the magic happens with just three words in the terminal:

Bash

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

The server will download the images, create the databases, and connect everything. In about 2 minutes, you will have enterprise-grade infrastructure running on your free machine.

On Thursday, we go for the final test: sending the first message!
