Suggest me 5 different tasks for Python middle-leveled developer for docker compose…
- User
Suggest me 5 different tasks for Python middle-leveled developer for docker compose practice
- Assistant
Here are five different tasks for a middle-level Python developer to practice Docker Compose, ranging from basic to more advanced scenarios:
1. Multi-Service Web App with Flask & Redis
Task: Create a Docker Compose setup for a Flask web application that uses Redis for caching.
- Services:
web: Flask app (Python)redis: Redis for caching
- Requirements:
- The Flask app should connect to Redis.
- Use environment variables for Redis configuration.
- Include a
Dockerfilefor the Flask app.
2. FastAPI + PostgreSQL + Celery (Async Task Queue)
Task: Build a Docker Compose setup for a FastAPI backend with PostgreSQL and Celery for background tasks.
- Services:
api: FastAPI appdb: PostgreSQLcelery: Celery workerredis: Redis (for Celery broker)
- Requirements:
- The FastAPI app should interact with PostgreSQL.
- Celery should process tasks asynchronously.
- Use
depends_onto ensure proper service startup order.
3. Django + Nginx + Gunicorn (Production-like Setup)
Task: Set up a Django application with Nginx as a reverse proxy and Gunicorn as the WSGI server.
- Services:
web: Django app (Gunicorn)nginx: Nginx reverse proxydb: PostgreSQL
- Requirements:
- Configure Nginx to serve static files.
- Use environment variables for Django settings.
- Ensure proper volume mounting for static/media files.
4. Microservices with Flask & RabbitMQ (Message Queue)
Task: Create a microservices setup where two Flask apps communicate via RabbitMQ.
- Services:
service1: Flask app (producer)service2: Flask app (consumer)rabbitmq: RabbitMQ message broker
- Requirements:
- Use
pika(Python RabbitMQ client) for messaging. - Ensure proper network communication between services.
- Use
5. Data Processing Pipeline (Python + Airflow + PostgreSQL)
Task: Set up an Airflow pipeline that processes data from a PostgreSQL database.
- Services:
airflow: Apache Airflow (with scheduler & webserver)postgres: PostgreSQL (for Airflow metadata & data storage)python_script: A custom Python script (DAG) that fetches and processes data.
- Requirements:
- Configure Airflow to use PostgreSQL as a backend.
- Define a simple DAG that runs a Python script periodically.
Bonus Challenge:
- Add health checks to ensure services are running correctly.
- Use Docker secrets or
.envfiles for sensitive configurations. - Implement logging (e.g., ELK stack or simple file logging).
These tasks cover real-world scenarios like web apps, microservices, async task queues, and data pipelines—great for improving Docker Compose skills! 🚀
Would you like a sample
docker-compose.ymlfor any of these? - Services:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.