Conversation
… health checks - Fix slow dependency download in development Docker container - Move go mod download to build phase instead of runtime - Add proper dependency caching in Dockerfile - Reduce startup time from several minutes to under 30 seconds - Add database connection retry logic with exponential backoff - Implement NewConnectionWithRetry function - Add retry mechanism for database connection failures - Improve startup reliability in containerized environments - Fix environment variable mismatches in dev-env.sh - Add missing DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_SSL_MODE - Add missing REDIS_HOST, REDIS_PASSWORD, REDIS_DATABASE - Ensure consistency between dev environment and Docker Compose - Improve Docker Compose health check configuration - Increase health check start period from 40s to 60s - Increase retries from 3 to 5 for better reliability - Improve timeout settings for development environment - Add enhanced logging for startup sequence debugging - Add detailed logs for queue manager initialization - Improve error visibility during startup process - Better tracking of startup sequence progression 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…te environment configuration - Add Redis service to docker-compose.test.yml for manual development - Rename Makefile targets: db-* → services-* (PostgreSQL + Redis) - Create service management scripts (start/stop/reset-test-services.sh) - Fix scripts/start-dev.sh to use new services script - Consolidate environment variables across configuration files - Update Docker Compose files with complete environment variable sets - Clean up debug logging in cmd/api/main.go - Update all documentation for services-based workflow Resolves manual development setup issue where Redis was missing, causing API server startup failures in development environment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
Fix Redis support in manual development and test setups and unify environment configuration across the project.
- Add Redis alongside PostgreSQL in Docker Compose, scripts, and Makefile targets
- Rename
db-*targets toservices-*and replace standalone DB scripts with combined service scripts - Expand and consolidate environment variables in
.env.example, dev/prod scripts, and Compose files
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/README.md | Updated integration test instructions to mention Redis and services-* |
| scripts/start-test-services.sh | New script to start both PostgreSQL and Redis for testing |
| scripts/stop-test-services.sh | New script to stop both PostgreSQL and Redis test services |
| scripts/reset-test-services.sh | New script to reset (stop/remove/start) test services |
| scripts/start-dev.sh | Switched dev startup to use services scripts and optional .env.dev |
| scripts/prod-env.sh | Expanded production environment variables for Redis, queue, worker, executor, etc. |
| scripts/dev-env.sh | Expanded development environment variables for Redis, queue, worker, executor, etc. |
| internal/database/connection.go | Added NewConnectionWithRetry with retry logic |
| docker-compose.yml | Added Redis and queue/worker/executor settings; consolidated env vars |
| docker-compose.test.yml | Added redis-test service and volume |
| docker-compose.dev.yml | Expanded Redis and related settings for development |
| config/README.md | Updated test env instructions to make services-start |
| cmd/api/main.go | Switched to NewConnectionWithRetry and removed redundant log line |
| README.md | Updated manual setup steps to use make services-start |
| Makefile | Renamed db-* targets to services-* and updated help text |
| Dockerfile | Improved layer caching (go.mod first) and adjusted healthcheck |
| CLAUDE.md | Updated test commands section to use services-* |
| .env.example | Expanded example for Redis, queue, worker, and executor variables |
Comments suppressed due to low confidence (2)
tests/README.md:377
- The indentation of this list item is inconsistent with the surrounding markdown, which may break the numbered list formatting. Align the bullet level to match the other top-level items.
4. **Service setup issues**
.env.example:86
- The example file now includes Redis, queue, worker, and executor settings but is missing JWT, CORS, logging, and embedded-worker variables that are referenced elsewhere. Consider adding those env variables to keep the example complete.
EXECUTOR_EXECUTION_USER=1000:1000
| fi | ||
|
|
||
| # Check if services are already running | ||
| if docker-compose -f docker-compose.test.yml ps | grep -q "Up"; then |
There was a problem hiding this comment.
The grep -q "Up" check only verifies that at least one container is up, which may miss if Redis or PostgreSQL individually aren’t running. Consider checking both postgres-test and redis-test container statuses explicitly or using docker-compose ps --services --filter "status=running" and confirming both services are listed.
| if docker-compose -f docker-compose.test.yml ps | grep -q "Up"; then | |
| if docker-compose -f docker-compose.test.yml ps --services --filter "status=running" | grep -q "postgres-test" && \ | |
| docker-compose -f docker-compose.test.yml ps --services --filter "status=running" | grep -q "redis-test"; then |
| # Remove any dangling volumes | ||
| echo "Cleaning up dangling volumes..." | ||
| docker volume prune -f |
There was a problem hiding this comment.
[nitpick] Using docker volume prune -f will remove all dangling volumes in the Docker host, which may affect other projects. It’s safer to remove only the named test volumes (e.g., redis_test_data and postgres_test_data).
| # Remove any dangling volumes | |
| echo "Cleaning up dangling volumes..." | |
| docker volume prune -f | |
| # Remove specific test volumes | |
| echo "Removing specific test volumes..." | |
| docker volume rm redis_test_data postgres_test_data || true |
| } | ||
| } | ||
|
|
||
| return nil, fmt.Errorf("failed to establish database connection after %d attempts", maxRetries) |
There was a problem hiding this comment.
This error message omits the underlying error details, making debugging harder. Capture and wrap the last error (e.g., store err and return fmt.Errorf("... after %d attempts: %w", maxRetries, lastErr)).
| return nil, fmt.Errorf("failed to establish database connection after %d attempts", maxRetries) | |
| return nil, fmt.Errorf("failed to establish database connection after %d attempts: %w", maxRetries, lastErr) |
Summary
Fixes the manual development setup where Redis was missing, causing API server startup failures. This PR adds comprehensive Redis support and consolidates environment configuration across all files.
Key Changes
docker-compose.test.ymlalongside PostgreSQLdb-*→services-*to reflect that both PostgreSQL and Redis are managed togetherstart/stop/reset-test-services.shto replace database-only scriptsscripts/start-dev.shto use new services scriptProblem Solved
The manual development setup (
make services-start,make migrate-up,make dev) was failing because:Testing
make services-start→make migrate-up→make devFiles Changed
start-dev.shupdated.env.example, Docker Compose files🤖 Generated with Claude Code