From 1710d71463c821657e702df0da18a8823e1ead18 Mon Sep 17 00:00:00 2001 From: josedario87 <71241187+josedario87@users.noreply.github.com> Date: Wed, 4 Jun 2025 19:22:28 -0600 Subject: [PATCH] Revert "feat: Initial Docker Compose setup for conversation layer" --- README.md | 72 +----------------------------------- chat-ui/Dockerfile | 20 ---------- chat-ui/package.json | 12 ------ chat-ui/server.js | 11 ------ docker-compose.yml | 67 --------------------------------- whatsapp-router/Dockerfile | 20 ---------- whatsapp-router/package.json | 12 ------ whatsapp-router/router.js | 16 -------- 8 files changed, 1 insertion(+), 229 deletions(-) delete mode 100644 chat-ui/Dockerfile delete mode 100644 chat-ui/package.json delete mode 100644 chat-ui/server.js delete mode 100644 docker-compose.yml delete mode 100644 whatsapp-router/Dockerfile delete mode 100644 whatsapp-router/package.json delete mode 100644 whatsapp-router/router.js diff --git a/README.md b/README.md index 7c7c9be..0c5acf5 100644 --- a/README.md +++ b/README.md @@ -1,71 +1 @@ -# 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 - -1. **Clone the repository:** - ```bash - git clone - cd - ``` - -2. **Configure OpenWA:** - * Open the `docker-compose.yml` file. - * **Crucial:** Locate the `openwa` service definition. You may need to replace the placeholder image `image: devlikeapro/open-wa-api:latest` with 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 the `WEBHOOK_URL` that OpenWA should call. The `whatsapp-router` service expects this webhook at `http://whatsapp-router:3001/webhook`. So, an example for OpenWA's configuration might be `WEBHOOK_URL=http://whatsapp-router:3001/webhook`. - * Adjust port mappings for `openwa` if your image uses different ports than the defaults provided (API `8080`, Webhook `3000`). - -3. **Configure Service Endpoints (if necessary):** - * **Chat UI (`chat-ui` service):** If the Chat UI needs to know the endpoint of your LLM agent, set the `LLM_AGENT_URL` (or similar) environment variable in `docker-compose.yml` under `services.chat-ui.environment`. - * **WhatsApp Router (`whatsapp-router` service):** This service is pre-configured to look for OpenWA at `http://openwa:8080`. If your LLM agent is called by the router, set its URL via an environment variable like `LLM_AGENT_URL` under `services.whatsapp-router.environment`. - -4. **Build and run the services:** - ```bash - docker-compose up --build - ``` - * The `--build` flag 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`. - -5. **Accessing Services:** - * **OpenWA API:** Typically `http://localhost:8080` (or the host port you mapped). - * **WhatsApp Router:** `http://localhost:3001` (its webhook is at `http://localhost:3001/webhook`, but this is for OpenWA to call internally). - * **Chat UI:** `http://localhost:3002`. - -6. **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 `openwa` service for the QR code or instructions: - ```bash - docker-compose logs openwa - ``` - * Session data for OpenWA is stored in a Docker volume named `openwa_data` to persist the session across restarts. - -7. **Stopping the services:** - ```bash - docker-compose down - ``` - * To remove volumes (like `openwa_data`, which will clear the session), use `docker-compose down -v`. - -## 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. +# conversation-layer \ No newline at end of file diff --git a/chat-ui/Dockerfile b/chat-ui/Dockerfile deleted file mode 100644 index 485d3a5..0000000 --- a/chat-ui/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Use an official Node.js runtime as a parent image -FROM node:18-slim - -# Set the working directory in the container -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json (or yarn.lock) -COPY package*.json ./ - -# Install application dependencies -RUN npm install - -# Bundle app source -COPY . . - -# Expose the port the app runs on -EXPOSE 3000 - -# Define the command to run the app -CMD [ "node", "server.js" ] diff --git a/chat-ui/package.json b/chat-ui/package.json deleted file mode 100644 index c510446..0000000 --- a/chat-ui/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "chat-ui", - "version": "1.0.0", - "description": "Chat UI for LLM Agent", - "main": "server.js", - "scripts": { - "start": "node server.js" - }, - "dependencies": { - "express": "^4.17.1" - } -} diff --git a/chat-ui/server.js b/chat-ui/server.js deleted file mode 100644 index 7b27aa0..0000000 --- a/chat-ui/server.js +++ /dev/null @@ -1,11 +0,0 @@ -const express = require('express'); -const app = express(); -const PORT = process.env.PORT || 3000; - -app.get('/', (req, res) => { - res.send('Chat UI is running!'); -}); - -app.listen(PORT, () => { - console.log(`Chat UI listening on port ${PORT}`); -}); diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index d3b4846..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,67 +0,0 @@ -version: '3.8' - -services: - openwa: - # IMPORTANT: Replace with your specific OpenWA image if different. - # This is a commonly used one, but your setup might require another. - image: devlikeapro/open-wa-api:latest - ports: - # Default port for OpenWA API is often 8080. Adjust if your image uses a different one. - - "8080:8080" - # Port for the webhook if OpenWA serves it directly. - # This might also be configured via environment variables for OpenWA. - - "3000:3000" # Assuming OpenWA's webhook might be on 3000, adjust as needed - environment: - # Add any necessary environment variables for OpenWA here - # For example: - # - WEBHOOK_URL=http://whatsapp-router:3001/webhook - # The actual variable names will depend on the OpenWA image being used. - - SERVER_PORT=8080 # Example, may not be needed if image defaults correctly - volumes: - # Persist session data for OpenWA to avoid re-scanning QR code on restart - - openwa_data:/app/session - # networks: - # - conversation_net - - chat-ui: - build: - context: ./chat-ui - dockerfile: Dockerfile - ports: - - "3002:3000" # Expose Chat UI on host port 3002, container port 3000 - environment: - # Example: Endpoint for the LLM agent - # - LLM_AGENT_URL=http://your-llm-agent-service/api - - NODE_ENV=development - # depends_on: - # - openwa # If Chat UI needs to directly interact with OpenWA - # networks: - # - conversation_net - - whatsapp-router: - build: - context: ./whatsapp-router - dockerfile: Dockerfile - ports: - - "3001:3001" # Expose WhatsApp Router on host port 3001, container port 3001 - environment: - # URL for OpenWA API - - OPENWA_API_URL=http://openwa:8080 - # URL where OpenWA should send webhook events - # This should match what OpenWA is configured to call - - OPENWA_WEBHOOK_TARGET=http://whatsapp-router:3001/webhook - # Example: Endpoint for the LLM agent (if router talks to it) - # - LLM_AGENT_URL=http://your-llm-agent-service/api - - NODE_ENV=development - depends_on: - - openwa # Router needs OpenWA to be up - # networks: - # - conversation_net - -volumes: - openwa_data: # Named volume for OpenWA session data - -# Optional: Define a shared network -# networks: -# conversation_net: -# driver: bridge diff --git a/whatsapp-router/Dockerfile b/whatsapp-router/Dockerfile deleted file mode 100644 index ba977dc..0000000 --- a/whatsapp-router/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Use an official Node.js runtime as a parent image -FROM node:18-slim - -# Set the working directory in the container -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json (or yarn.lock) -COPY package*.json ./ - -# Install application dependencies -RUN npm install - -# Bundle app source -COPY . . - -# Expose the port the app runs on (if it has an HTTP server for internal checks, though not strictly necessary for a router) -EXPOSE 3001 - -# Define the command to run the app -CMD [ "node", "router.js" ] diff --git a/whatsapp-router/package.json b/whatsapp-router/package.json deleted file mode 100644 index 077fb6a..0000000 --- a/whatsapp-router/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "whatsapp-router", - "version": "1.0.0", - "description": "WhatsApp Router for OpenWA and LLM Agent", - "main": "router.js", - "scripts": { - "start": "node router.js" - }, - "dependencies": { - "express": "^4.17.1" - } -} diff --git a/whatsapp-router/router.js b/whatsapp-router/router.js deleted file mode 100644 index 264435f..0000000 --- a/whatsapp-router/router.js +++ /dev/null @@ -1,16 +0,0 @@ -const express = require('express'); -const app = express(); -const PORT = process.env.PORT || 3001; - -app.use(express.json()); - -app.post('/webhook', (req, res) => { - console.log('Received webhook event:', req.body); - // Logic to process OpenWA event and interact with LLM agent will go here - res.status(200).send('Event received'); -}); - -app.listen(PORT, () => { - console.log(`WhatsApp Router listening on port ${PORT}`); - console.log('Webhook endpoint available at /webhook'); -});