Skip to content

Commit cacd014

Browse files
authored
☕ chore: update docker compose and env file
Merge pull request #13 from wgtechlabs/chore/docker-compose
2 parents ce7bf40 + 470e3c2 commit cacd014

File tree

2 files changed

+57
-28
lines changed

2 files changed

+57
-28
lines changed

.env.example

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
1-
NODE_ENV=development
1+
# =============================================================================
2+
# UNTHREAD WEBHOOK SERVER - ENVIRONMENT CONFIGURATION
3+
# =============================================================================
4+
# Copy this file to .env and fill in your actual values
5+
# Only required variables are listed here. All other values use sensible defaults.
6+
# =============================================================================
7+
8+
# ======= Application Configuration (Required) =======
9+
10+
# Server Port
11+
# Port for the webhook server (default: 3000)
212
PORT=3000
3-
# For local development use: redis://localhost:6379
4-
# For Docker Compose, this gets overridden automatically to: redis://redis:6379
5-
REDIS_URL=redis://localhost:6379
613

7-
# Target platform for webhook processing (REQUIRED)
14+
# ======= Redis Configuration (Required) =======
15+
16+
# Redis Connection URL
17+
# Docker (default): redis://redis-webhook:6379
18+
# Local development: redis://localhost:6379
19+
REDIS_URL=redis://redis-webhook:6379
20+
21+
# ======= Webhook Configuration (Required) =======
22+
23+
# Target Platform for Webhook Processing
824
# IMPORTANT: Cannot use reserved values: dashboard, unknown, buffered
925
# NOTE: Value is automatically converted to lowercase for canonical format
10-
# Supported examples: discord, telegram, whatsapp, messenger, slack, teams
26+
# Supported platforms: discord, telegram, whatsapp, messenger, slack, teams
1127
TARGET_PLATFORM=discord
1228

13-
UNTHREAD_WEBHOOK_SECRET=your_webhook_secret_here
29+
# Unthread Webhook Secret
30+
# How to get: Unthread dashboard → Settings → Webhooks → Create webhook → Copy secret
31+
UNTHREAD_WEBHOOK_SECRET=your_unthread_webhook_secret_here
32+
33+
# ======= Optional Development Override =======
34+
35+
# Node Environment (only set for development)
36+
# Defaults to 'production' for production-safe logging
37+
# NODE_ENV=development

docker-compose.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,64 @@
44
# Complete application stack for the Unthread Webhook Server
55
#
66
# Services:
7-
# ┌─ webhook-server → Main webhook processing application
8-
# └─ redis-webhook → Redis for webhook message queuing
7+
# ┌─ server → Main webhook processing application (builds from source)
8+
# └─ redis-webhook → Redis 8-alpine for webhook message queuing
9+
#
10+
# Docker Container Naming:
11+
# - server → unthread-webhook-server-server-1
12+
# - redis-webhook → unthread-webhook-server-redis-webhook-1
913
#
1014
# Usage:
1115
# docker-compose up -d # Start all services
12-
# docker-compose logs -f webhook-server # View webhook server logs
16+
# docker-compose logs -f server # View webhook server logs
1317
# docker-compose exec redis-webhook redis-cli
18+
# docker-compose down # Stop all services
19+
# docker-compose down -v # Stop and remove volumes
1420
#
1521
# Prerequisites:
16-
# - Copy .env.example to .env and configure your tokens
17-
# - Ensure external network exists: docker network create unthread-integration-network
22+
# - Copy .env.example to .env and configure your values
23+
# - Ensure Docker and Docker Compose are installed
1824
#
1925
# =============================================================================
2026

21-
version: '3.8'
22-
2327
services:
2428
# =============================================================================
2529
# REDIS - WEBHOOK OPERATIONS
2630
# =============================================================================
2731
# Dedicated Redis instance for webhook message queuing and communication
2832
redis-webhook:
29-
image: redis:7-alpine
33+
image: redis:8-alpine
34+
container_name: unthread-webhook-server-redis-webhook-1
3035
ports:
3136
- "6379:6379"
3237
volumes:
3338
- redis_webhook_data:/data
39+
command: redis-server --appendonly yes # Enable data persistence
3440
restart: unless-stopped
3541
healthcheck:
3642
test: ["CMD", "redis-cli", "ping"]
3743
interval: 30s
38-
timeout: 3s
39-
retries: 3
40-
start_period: 30s
44+
timeout: 5s
45+
retries: 5
4146
networks:
4247
- unthread-integration-network
4348

4449
# =============================================================================
4550
# WEBHOOK SERVER APPLICATION
4651
# =============================================================================
47-
# Handles incoming webhooks from Unthread and processes them
48-
webhook-server:
49-
image: wgtechlabs/unthread-webhook-server:latest
50-
container_name: docker-unthread-webhook-server
52+
# Main Node.js application that handles webhook processing and Redis queuing
53+
server:
54+
image: unthread-webhook-server:latest # Explicit image name for consistency
55+
build:
56+
context: .
57+
container_name: unthread-webhook-server-server-1
5158
ports:
5259
- "3000:3000"
5360
env_file:
5461
- .env
55-
environment:
56-
- REDIS_URL=redis://redis-webhook:6379
5762
depends_on:
5863
redis-webhook:
59-
condition: service_healthy
64+
condition: service_healthy # Wait for Redis to be ready
6065
restart: unless-stopped
6166
healthcheck:
6267
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
@@ -77,8 +82,8 @@ volumes:
7782
# =============================================================================
7883
# NETWORKING
7984
# =============================================================================
80-
# External network for communication between services
81-
# Create with: docker network create unthread-integration-network
85+
# Docker Compose will automatically create and manage this network
8286
networks:
8387
unthread-integration-network:
84-
external: true
88+
driver: bridge
89+
name: unthread-integration-network # Use explicit name for consistency

0 commit comments

Comments
 (0)