Sign inSign up

lianshufeng/tasker

By lianshufeng

•Updated 10 months ago

Image
0

1.4K

lianshufeng/tasker repository overview

⁠Tasker Microservices Deployment Guide

This project uses Docker Compose to build a microservices platform that supports image registry, task scheduling, and monitoring visualization. It includes:

  • Redis (for Celery broker and result backend)
  • Docker Registry (private image repository)
  • Registry UI (web-based image browser)
  • Tasker API (FastAPI-based task manager)
  • Celery Worker (asynchronous task processor)
  • Celery Exporter (metrics exporter for Celery)
  • Prometheus (monitoring)
  • Grafana (dashboard visualization)

ā šŸ“ Project Structure


.
ā”œā”€ā”€ conf/
│   ā”œā”€ā”€ redis.conf
│   ā”œā”€ā”€ registry\_config.yml
│   ā”œā”€ā”€ htpasswd
│   ā”œā”€ā”€ prometheus.yml
ā”œā”€ā”€ store/
│   ā”œā”€ā”€ redis/
│   ā”œā”€ā”€ registry/
│   └── grafana/data/
ā”œā”€ā”€ docker-compose.yml
ā”œā”€ā”€ requirements.txt
└── README.md


ā šŸš€ Quick Start

⁠1. Environment Setup

Create a .env file in the root directory:

docker_registries=http://registry:5000
docker_username=your-username
docker_password=your-password
grafana_password=your-grafana-password
redis_password=your-redis-password
⁠2. Start Services
docker compose up -d
⁠3. Check Status
docker ps

⁠🧩 Service Overview

⁠Redis (redis-server)
  • Used as Celery's broker and result backend.
  • Data and configuration are persisted via mounted volumes.
⁠Docker Registry (registry)
  • Local private Docker image registry.
  • Port: 5000
  • Authentication configured via htpasswd.
⁠Registry UI (registry-ui)
⁠Tasker API (api)
  • RESTful task management API based on FastAPI.
  • Port: 8000
⁠Celery Worker (worker)
  • Executes background tasks using Celery.
  • Runs with 3 replicas for concurrent processing.
⁠Celery Exporter
  • Exposes Celery task metrics for Prometheus.
  • Port: 9808
⁠Prometheus
  • Collects metrics from Celery Exporter and other sources.
  • Port: 9090
⁠Grafana

ā šŸ“¦ Python Dependencies

fastapi>=0.115.0
uvicorn>=0.34.0
celery>=5.5.2
redis>=5.0.0
docker>=7.1.0

Install with:

pip install -r requirements.txt

ā šŸ”— Service Ports Summary

ServicePortURL
Tasker API8000http://localhost:8000⁠
Redis6379-
Docker Registry5000http://localhost:5000⁠
Registry UI5001http://localhost:5001⁠
Celery Exporter9808http://localhost:9808⁠
Prometheus9090http://localhost:9090⁠
Grafana3000http://localhost:3000⁠

ā šŸ›  Common Issues

  • Redis connection error? Ensure redis_password matches between .env, Redis config, and Celery Exporter.
  • Worker can't log into Registry? Verify docker_username and docker_password are set correctly in .env.
  • Grafana dashboard is empty? Manually import Dashboard ID 20076⁠ after first login.

Tag summary

Content type

Image

Digest

sha256:089a9f795…

Size

63.7 MB

Last updated

10 months ago

docker pull lianshufeng/tasker