Build Model
Each build is tracked as a document in the Build collection:pending- Build queued or in progresssuccess- Build completed successfullyfailed- Build encountered an error
Builds are indexed by project and creation time for fast historical queries.
Build Lifecycle
1. Build Creation
A new build is created when deployment starts:2. Build Queuing
Build is added to BullMQ queue:3. Build Processing
Build worker picks up the job:4. Docker Build Logs
Build progress is streamed to stdout:5. Image Push Logs
Image push progress is also streamed:6. Build Completion
Successful builds update the database:7. Build Failure
Failed builds are marked accordingly:Worker Event Logging
Build Worker Events
Deployment Worker Events
Redeployment Worker Events
Retrieving Build History
Get All Builds for Project
Build history is limited to 50 most recent builds per project for performance.
Get Single Build Details
Build Duration Calculation
Calculate build time from timestamps:Container Logs
For Node.js applications, container logs can be retrieved:Build Statistics
Project model tracks total build count:Commit SHA Tracking
Each build stores the Git commit SHA:Redeployment Intelligence
Redeployment worker checks commit history:- Previous build failed
- New commit detected (SHA mismatch)
- Same commit SHA
- Previous build succeeded
Error Handling
Build errors are captured and logged:failed event, which:
- Updates build status to
failed - Updates project status to
failed-deploy - Logs error details
Build Cleanup
Build artifacts are cleaned up automatically:Build directories are removed after processing to conserve disk space.
Monitoring Recommendations
Real-Time Monitoring
Build Status Indicators
Common Build Issues
Build Timeout
Builds may timeout if they take too long:- Optimize dependencies (use npm ci instead of npm install)
- Reduce build output size
- Check for infinite loops in build scripts
Out of Memory
Large builds may exceed memory limits:- Reduce concurrent build processes
- Optimize webpack/vite configuration
- Use smaller dependencies
Docker Build Errors
Common Docker issues:- Missing Dockerfile
- Invalid build arguments
- File permission issues
- Network connectivity problems
Image Push Failures
Push errors usually indicate:- Docker Hub authentication issues
- Network connectivity problems
- Insufficient disk space
- Registry rate limits
API Reference Summary
Get Project Builds
Get Build Details
Future Enhancements
Planned Features
- Real-time WebSocket log streaming
- Build log storage and retrieval
- Build metrics and analytics
- Build performance insights
- Email notifications on build failure
- Slack/Discord integration
Currently, logs are written to stdout/stderr. Log persistence to object storage is planned for future releases.