feat: Implement real-time build logging and status updates #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement real-time build logging and status updates
This PR implements a full feedback loop for deployment builds. Users can now see real-time status updates ("Building", "Success", "Failed") and view detailed error logs directly in the UI if a build fails.
Implementation Details
This PR transitions the deployment process from a "fire-and-forget" model to a reactive feedback loop, ensuring users are kept informed of their build status in real-time.
Optimistic Initiation (Frontend)
createfunction immediately marks the new project status asbuildingin the initial payload.Homecomponent initiates a polling mechanism that checks the database every 5 seconds for status updates.Dynamic Environment Injection (Backend)
scripts.tscontroller now injects the backend's running port (PORT_BACKEND) into the shell execution environment, enabling the isolated build scripts to communicate back to the main server.Self-Reporting Workers (Shell Scripts)
container.sh) is no longer silent. It now traps execution errors and utilizescurlto "phone home" to the new/maplogsendpoint, reporting either asuccessorfailedstatus along with the specific error logs.Callback Handling (Backend)
updateBuildStatus, listens for these callbacks. It logs critical failures to Sentry and updates the database record viaupdateMapStatus.User Alerting (Frontend)
failedorsuccess) and updates the UI automatically.LogModalcomponent is triggered, parsing and displaying the raw build logs for immediate debugging.Key Changes
Backend
src/backend/db.ts: AddedupdateMapStatusto update the build status and save failure logs in the database.src/backend/main.ts: CreatedupdateBuildStatuscontroller to handle callbacks from shell scripts and log errors to Sentry.src/backend/server.ts: Registered the new/maplogsendpoint.src/backend/scripts.ts: Updated script execution to pass thePORT_BACKENDenvironment variable to the shell scripts, ensuring dynamic port handling.Shell Scripts
src/backend/shell_scripts/container.sh: Implementedreport_errorandreport_successfunctions. The script now traps errors and sends acurlPOST request to the backend with the build status and logs.Frontend
src/frontend/src/utils/create.ts: Updated the initial payload to set the status to"building"immediately upon submission.src/frontend/src/components/Home.vue:LogModalto display error logs when clicking "Failed".src/frontend/src/components/LogModal.vue: Created a new component to display and copy build failure logs.