Quick Setup
This directory contains scripts to quickly set up and test the e-commerce reliability examples from Chapter 1.
๐ Quick Start
One-Command Setup (Recommended)
The fastest way to try the example with zero local dependencies:
# Download and run the setup script
curl -fsSL https://raw.githubusercontent.com/tasker-systems/tasker/main/spec/blog/post_01_ecommerce_reliability/setup-scripts/blog-setup.sh | bash
# Or with custom app name
curl -fsSL https://raw.githubusercontent.com/tasker-systems/tasker/main/spec/blog/post_01_ecommerce_reliability/setup-scripts/blog-setup.sh | bash -s -- --app-name my-ecommerce-demoRequirements: Docker and Docker Compose only
Local Setup
If you prefer to run the setup script locally:
# Download the script
curl -fsSL https://raw.githubusercontent.com/tasker-systems/tasker/main/spec/blog/post_01_ecommerce_reliability/setup-scripts/blog-setup.sh -o blog-setup.sh
chmod +x blog-setup.sh
# Run with options
./blog-setup.sh --app-name ecommerce-demo --output-dir ./demos๐ ๏ธ How It Works
Docker-Based Architecture
The setup script creates a complete Docker environment with:
Rails application with live code reloading
PostgreSQL 15 database
Redis 7 for background job processing
Sidekiq for workflow execution
All tested code examples from the GitHub repository
Integration with Tasker Repository
All code examples are downloaded directly from the tested repository:
This ensures the examples are always up-to-date and have passed integration tests.
๐ What Gets Created
Application Structure
API Endpoints
POST /checkout- Start checkout workflowGET /order_status/:task_id- Monitor order processing
๐งช Testing the Reliability Features
Start the Application
Wait for all services to be ready (you'll see "Ready for connections" messages).
Test Successful Checkout
Test Payment Failure (Retryable)
Monitor Workflow Status
๐ง Key Features Demonstrated
Reliability Patterns
Smart Retry Logic: Different retry strategies for different failure types
Circuit Breaker: Prevents cascading failures
Graceful Degradation: Continues processing when possible
Timeout Handling: Prevents hanging operations
Error Handling
Retryable Errors: Payment timeouts, temporary service unavailability
Permanent Errors: Invalid cart items, insufficient inventory
Escalation: Failed retries trigger alerts and manual intervention
Workflow Orchestration
Step Dependencies: Each step waits for its prerequisites
Parallel Processing: Independent steps run simultaneously
State Management: Complete workflow state tracking
Recovery: Failed workflows can be resumed from last successful step
๐ Monitoring and Observability
Docker Logs
Workflow Monitoring
๐ ๏ธ Customization
Adding New Products
Edit the step handlers to include your product catalog:
Modifying Retry Logic
Update the YAML configuration:
Adding New Failure Scenarios
Create new payment tokens in process_payment_handler.rb:
๐ง Troubleshooting
Common Issues
Docker services won't start:
Ensure Docker is running:
docker --versionCheck for port conflicts:
docker-compose psFree up resources:
docker system prune
Application not responding:
Wait for database initialization (30-60 seconds)
Check logs:
docker-compose logs webVerify all services are healthy:
docker-compose ps
Workflows not processing:
Ensure Sidekiq is running:
docker-compose logs sidekiqCheck Redis connectivity:
docker-compose exec redis redis-cli pingVerify database migrations:
docker-compose exec web rails db:migrate:status
Getting Help
Check service status:
docker-compose psView logs:
docker-compose logs -fRestart services:
docker-compose restartClean restart:
docker-compose down && docker-compose up
๐ฎ Related Examples
Chapter 2: Data Pipeline Resilience - Batch processing patterns
Chapter 3: Microservices Coordination - Service orchestration
๐ Learn More
Code Examples: GitHub Repository
Integration Tests: See how the examples are tested in the repository
๐ Cleanup
When you're done experimenting:
Last updated