diff --git a/README-dev.md b/README-dev.md new file mode 100644 index 0000000..cb3d83e --- /dev/null +++ b/README-dev.md @@ -0,0 +1,65 @@ +# Development Setup + +This document describes how to set up and run the Markov Economics application in a development environment. + +## Prerequisites + +- Docker +- Docker Compose + +## Development Environment + +For development purposes, we provide a separate Docker Compose configuration that runs the application without Caddy: + +```bash +# Start the development environment +docker-compose -f docker-compose-dev.yml up -d + +# Stop the development environment +docker-compose -f docker-compose-dev.yml down +``` + +The application will be available at http://localhost:5000 + +## Differences from Production + +The development setup differs from the production setup in the following ways: + +1. Direct access to the application on port 5000 (no Caddy reverse proxy) +2. Development mode enabled (FLASK_ENV=development) +3. Source code mounted as a volume for live reloading during development +4. No SSL/TLS encryption (HTTP only) + +## Troubleshooting + +If you encounter port conflicts: + +1. Check what's running on port 5000: + ```bash + lsof -i :5000 + ``` + +2. Stop any conflicting processes: + ```bash + pkill -f "python.*run.py" + ``` + +3. Stop any conflicting Docker containers: + ```bash + docker-compose down + ``` + +## Testing the Wealth Distribution Fix + +The recent fix for the wealth distribution histogram ensures that: + +1. The backend correctly calculates agent wealth using the proper accessor methods +2. The frontend properly handles and displays distribution data +3. Debug logging is available to troubleshoot data flow issues + +To test the fix: + +1. Start the development environment +2. Navigate to http://localhost:5000 +3. Start a simulation with default parameters +4. Observe the wealth distribution histogram populating with data \ No newline at end of file diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml new file mode 100644 index 0000000..e134cc9 --- /dev/null +++ b/docker-compose-dev.yml @@ -0,0 +1,29 @@ +services: + markov-economics-dev: + build: . + ports: + - "5000:5000" + environment: + - FLASK_ENV=development + - FLASK_APP=run.py + - PYTHONUNBUFFERED=1 + volumes: + # Mount source code for development + - .:/app + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5000/health', timeout=2)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + networks: + - markov-network + +networks: + markov-network: + driver: bridge + +volumes: + markov-data: + driver: local \ No newline at end of file