Skip to content

[Enhancement] Comprehensive Initialization and Resilience Framework: Robust Error Handling, Logging, and Execution Monitoring in init.sh #46

Open
@Vaibhav701161

Description

@Vaibhav701161

Issue Summary

The ./init.sh script, which initializes the cBioPortal Docker setup, lacks strict error handling. When a sub-script or command fails, the script continues execution silently, making it difficult for users to diagnose issues—especially on non-Linux systems. Improving error handling will enhance reliability and provide better feedback to contributors.

Problem Description

  • The script orchestrates multiple sub-scripts responsible for setting up dependencies, environment variables, and databases.
  • If a sub-script fails, the failure is not always surfaced due to missing error checks, causing the setup to appear successful while being incomplete.
  • This issue is more prominent on Windows/macOS, where certain shell commands behave differently, leading to hidden failures.
  • Logs do not always provide clear error messages, making debugging difficult.

Proposed Solution

To improve the robustness of the ./init.sh script, I propose the following changes:

  1. Fail Fast on Errors

    • Enforce strict error handling using set -e to terminate the script when any command fails.
    • Use trap to capture errors and print meaningful messages before exiting.
  2. Improve Logging and Debugging

    • Implement set -x as an optional debug mode to display executed commands.
    • Add clearer error messages to guide users when failures occur.
  3. Cross-Platform Compatibility Enhancements

    • Identify problematic shell commands that may behave inconsistently across different platforms.
    • Replace or document environment-specific dependencies for better cross-OS support.
  4. Enhance Documentation

    • Update the documentation to include common troubleshooting steps and error-handling mechanisms.

Steps to Reproduce the Issue

  1. Clone the cbioportal-docker-compose repository and follow the setup instructions.
  2. Run ./init.sh on a non-Linux system (e.g., Windows WSL or macOS).
  3. Observe that certain failures occur silently, leading to an incomplete setup.

Expected Behavior

  • The script should halt immediately when an error occurs.
  • The failure reason should be clearly logged.
  • Contributors should be able to diagnose and fix issues more efficiently.

Additional Context

  • This issue is particularly relevant for new contributors who may struggle with silent failures.
  • Improving error handling will make onboarding smoother and debugging easier.
  • Happy to work on this and submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions