|
| 1 | +# Kafkaesque Development Commands |
| 2 | + |
| 3 | +> For comprehensive development guide including testing strategies and debugging, see [DEVELOPING.md](DEVELOPING.md) |
| 4 | +
|
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Local Development |
| 8 | +```bash |
| 9 | +# Install dependencies |
| 10 | +mix deps.get |
| 11 | + |
| 12 | +# Run locally in development mode |
| 13 | +iex -S mix phx.server |
| 14 | + |
| 15 | +# Run tests |
| 16 | +mix test |
| 17 | + |
| 18 | +# Run tests with coverage |
| 19 | +mix test --cover |
| 20 | + |
| 21 | +# Run integration tests only |
| 22 | +mix test --only integration |
| 23 | + |
| 24 | +# Format code |
| 25 | +mix format |
| 26 | + |
| 27 | +# Check if code is formatted (CI/CD check) |
| 28 | +mix format --check-formatted |
| 29 | + |
| 30 | +# Run linter |
| 31 | +mix credo --strict |
| 32 | + |
| 33 | +# Check everything (compile, format, lint) |
| 34 | +mix lint |
| 35 | +``` |
| 36 | + |
| 37 | +### Docker Development |
| 38 | +```bash |
| 39 | +# Build and start the container |
| 40 | +docker-compose up --build |
| 41 | + |
| 42 | +# Start in background |
| 43 | +docker-compose up -d |
| 44 | + |
| 45 | +# View logs |
| 46 | +docker-compose logs -f |
| 47 | + |
| 48 | +# Stop the container |
| 49 | +docker-compose down |
| 50 | + |
| 51 | +# Rebuild without cache (if needed) |
| 52 | +docker-compose build --no-cache |
| 53 | +``` |
| 54 | + |
| 55 | +## API Testing |
| 56 | + |
| 57 | +### Inside Docker Container |
| 58 | +```bash |
| 59 | +# Health check |
| 60 | +docker exec kafkaesque-kafkaesque-1 curl http://localhost:4001/healthz |
| 61 | + |
| 62 | +# List topics |
| 63 | +docker exec kafkaesque-kafkaesque-1 curl http://localhost:4001/v1/topics |
| 64 | + |
| 65 | +# Create a topic |
| 66 | +docker exec kafkaesque-kafkaesque-1 curl -X POST http://localhost:4001/v1/topics \ |
| 67 | + -H 'Content-Type: application/json' \ |
| 68 | + -d '{"name":"events","partitions":1}' |
| 69 | + |
| 70 | +# Produce messages |
| 71 | +docker exec kafkaesque-kafkaesque-1 curl -X POST http://localhost:4001/v1/topics/events/records \ |
| 72 | + -H 'Content-Type: application/json' \ |
| 73 | + -d '{"acks":"leader","records":[{"key":"","value":"aGVsbG8="}]}' |
| 74 | + |
| 75 | +# Consume messages |
| 76 | +docker exec kafkaesque-kafkaesque-1 curl "http://localhost:4001/v1/topics/events/records?group=demo&offset=latest" |
| 77 | +``` |
| 78 | + |
| 79 | +### From Host (when ports are exposed) |
| 80 | +```bash |
| 81 | +# Health check |
| 82 | +curl http://localhost:4001/healthz |
| 83 | + |
| 84 | +# API endpoints |
| 85 | +curl http://localhost:4001/v1/topics |
| 86 | +``` |
| 87 | + |
| 88 | +## Build & Release |
| 89 | + |
| 90 | +### Create Production Release |
| 91 | +```bash |
| 92 | +MIX_ENV=prod mix release |
| 93 | +``` |
| 94 | + |
| 95 | +### Run Release Locally |
| 96 | +```bash |
| 97 | +_build/prod/rel/kafkaesque/bin/kafkaesque start |
| 98 | +``` |
| 99 | + |
| 100 | +## Protobuf Generation |
| 101 | +```bash |
| 102 | +mix proto.gen |
| 103 | +``` |
| 104 | + |
| 105 | +## Cleanup |
| 106 | + |
| 107 | +### Stop all services |
| 108 | +```bash |
| 109 | +# Stop Docker containers |
| 110 | +docker-compose down |
| 111 | + |
| 112 | +# Remove volumes (careful - deletes data) |
| 113 | +docker-compose down -v |
| 114 | + |
| 115 | +# Clean build artifacts |
| 116 | +rm -rf _build deps |
| 117 | +``` |
| 118 | + |
| 119 | +## Ports |
| 120 | + |
| 121 | +- **4000**: Phoenix Dashboard (LiveView) |
| 122 | +- **4001**: REST API Server |
| 123 | +- **50051**: gRPC Server |
| 124 | + |
| 125 | +## Environment Variables |
| 126 | + |
| 127 | +See `docker-compose.yml` for full list. Key variables: |
| 128 | +- `SECRET_KEY_BASE`: Required for production |
| 129 | +- `DATA_DIR`: Where log files are stored |
| 130 | +- `OFFSETS_DIR`: Where consumer offsets are stored |
| 131 | +- `RETENTION_HOURS`: How long to keep messages (default: 168) |
| 132 | +- `LOG_LEVEL`: Logging verbosity (debug/info/warn/error) |
0 commit comments