ec1f8df6133b4f6672ead3fd2bc6dbdce567328f
feat: Initial Docker Compose setup for conversation layer
conversation-layer
Conversation Layer System
This repository contains the services for the conversation layer, managed by Docker Compose. It includes:
- OpenWA: Handles WhatsApp communication.
- Chat UI: Provides a user interface for conversations.
- WhatsApp Router: Connects OpenWA to the Chat UI and an LLM agent.
Prerequisites
- Docker (https://www.docker.com/get-started)
- Docker Compose (usually included with Docker Desktop)
Setup and Running
-
Clone the repository:
git clone <your-repo-url> cd <your-repo-directory> -
Configure OpenWA:
- Open the
docker-compose.ymlfile. - Crucial: Locate the
openwaservice definition. You may need to replace the placeholder imageimage: devlikeapro/open-wa-api:latestwith the specific OpenWA Docker image you intend to use. - Consult the documentation for your chosen OpenWA image to set necessary environment variables under
services.openwa.environment. For example, you'll likely need to configure theWEBHOOK_URLthat OpenWA should call. Thewhatsapp-routerservice expects this webhook athttp://whatsapp-router:3001/webhook. So, an example for OpenWA's configuration might beWEBHOOK_URL=http://whatsapp-router:3001/webhook. - Adjust port mappings for
openwaif your image uses different ports than the defaults provided (API8080, Webhook3000).
- Open the
-
Configure Service Endpoints (if necessary):
- Chat UI (
chat-uiservice): If the Chat UI needs to know the endpoint of your LLM agent, set theLLM_AGENT_URL(or similar) environment variable indocker-compose.ymlunderservices.chat-ui.environment. - WhatsApp Router (
whatsapp-routerservice): This service is pre-configured to look for OpenWA athttp://openwa:8080. If your LLM agent is called by the router, set its URL via an environment variable likeLLM_AGENT_URLunderservices.whatsapp-router.environment.
- Chat UI (
-
Build and run the services:
docker-compose up --build- The
--buildflag ensures images are built if they don't exist or if Dockerfiles/contexts have changed. - To run in detached mode (in the background), use
docker-compose up -d --build.
- The
-
Accessing Services:
- OpenWA API: Typically
http://localhost:8080(or the host port you mapped). - WhatsApp Router:
http://localhost:3001(its webhook is athttp://localhost:3001/webhook, but this is for OpenWA to call internally). - Chat UI:
http://localhost:3002.
- OpenWA API: Typically
-
Initial OpenWA Setup:
- After starting, OpenWA will likely require you to scan a QR code with your WhatsApp mobile app to link it. Check the logs of the
openwaservice for the QR code or instructions:docker-compose logs openwa - Session data for OpenWA is stored in a Docker volume named
openwa_datato persist the session across restarts.
- After starting, OpenWA will likely require you to scan a QR code with your WhatsApp mobile app to link it. Check the logs of the
-
Stopping the services:
docker-compose down- To remove volumes (like
openwa_data, which will clear the session), usedocker-compose down -v.
- To remove volumes (like
Project Structure
docker-compose.yml: Defines and configures all the services.chat-ui/: Contains the Dockerfile and source code for the Chat UI service.Dockerfile: Instructions to build the Chat UI Docker image.server.js: Placeholder Node.js/Express application.package.json: Node.js project manifest.
whatsapp-router/: Contains the Dockerfile and source code for the WhatsApp Router service.Dockerfile: Instructions to build the WhatsApp Router Docker image.router.js: Placeholder Node.js/Express application with a webhook.package.json: Node.js project manifest.
.gitignore: Specifies intentionally untracked files that Git should ignore.README.md: This file.
Description
Languages
TypeScript
82.7%
JavaScript
14.3%
Dockerfile
1.3%
HTML
1.2%
Makefile
0.5%