Worker for kjanat/chatlogger-api-go, a go backend for the multi-tenant ChatLogger API.
4.5K
The ChatLogger API Worker is a background processing component of the ChatLogger API system. It handles asynchronous tasks, primarily focused on generating exports of chat data in various formats (JSON, CSV). This worker uses Asynq with Redis for reliable job queue management.
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | PostgreSQL connection string | Required |
REDIS_ADDR | Redis address for job queue | redis:6379 |
EXPORT_DIR | Directory to store export files | exports |
JWT_SECRET | Secret for JWT validation | Required |
version: '3.8'
services:
# API server component
api:
image: kjanat/chatlogger-api-server:latest # or ghcr.io/kjanat/chatlogger-api-server:latest
ports:
- "8080:8080"
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
environment:
- DATABASE_URL=postgresql://dbuser:dbpassword@db:5432/chatlogger
- REDIS_ADDR=redis:6379
- HOST=0.0.0.0
- PORT=8080
- JWT_SECRET=your-jwt-secret-replace-in-production
- EXPORT_DIR=/app/exports
- GIN_MODE=release # Set to `debug` for more verbose logging
volumes:
- ./migrations:/app/migrations
- cl_exports_data:/app/exports
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
restart: unless-stopped
# Worker component for background jobs
worker:
image: kjanat/chatlogger-api-worker:latest # or ghcr.io/kjanat/chatlogger-api-worker:latest
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
environment:
- DATABASE_URL=postgresql://dbuser:dbpassword@db:5432/chatlogger
- REDIS_ADDR=redis:6379
- EXPORT_DIR=/app/exports
- JWT_SECRET=your-jwt-secret-replace-in-production
volumes:
- cl_exports_data:/app/exports
healthcheck:
test: ["CMD", "ps", "aux", "|", "grep", "chatlogger-worker"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
# Database
db:
image: postgres:16-alpine
ports:
- "5432:5432" # Optional: remove if you don't need direct DB access from host
environment:
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpassword
- POSTGRES_DB=chatlogger
volumes:
- cl_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dbuser"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
# Redis for job queue
redis:
image: redis:alpine
ports:
- "6379:6379" # Optional: remove if you don't need direct Redis access from host
volumes:
- cl_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
cl_postgres_data:
cl_redis_data:
cl_exports_data:
This worker is part of a clean architecture implementation with:
Released under the MIT License.
Content type
Image
Digest
sha256:a900a7418…
Size
13.4 MB
Last updated
about 1 year ago
docker pull kjanat/chatlogger-api-worker