Skip to content

feat: wait for MySQL health before starting Scada-LTS - #3283

Closed
katesclau wants to merge 1 commit into
SCADA-LTS:developfrom
katesclau:feat/docker-compose-wait-gates
Closed

feat: wait for MySQL health before starting Scada-LTS#3283
katesclau wants to merge 1 commit into
SCADA-LTS:developfrom
katesclau:feat/docker-compose-wait-gates

Conversation

@katesclau

@katesclau katesclau commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add MySQL healthchecks that require SELECT 1 on the scadalts schema before Tomcat starts
  • Gate scadalts with depends_on: condition: service_healthy in both compose files
  • Keep wait-for-it as a fallback and mark the app healthy once port 8080 is listening

Test plan

  • docker compose up -d starts database first and holds scadalts until MySQL accepts queries
  • First-boot init (empty db_data) still succeeds within the healthcheck window
  • http://localhost:8080/Scada-LTS is reachable after scadalts reports healthy
  • docker compose -f docker-compose-dev.yml up -d applies the same database gate

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Improved Scada-LTS startup reliability by waiting for MySQL to be ready before launching.
    • Increased the database connection wait time from 30 to 60 seconds.
    • Added service readiness checks for database connectivity and HTTP availability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 73e266b0-7e94-445f-9d9c-ff982385f8f8

📥 Commits

Reviewing files that changed from the base of the PR and between f1cf088 and b48bd27.

📒 Files selected for processing (2)
  • docker-compose-dev.yml
  • docker-compose.yml

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Docker Compose now checks MySQL connectivity before marking the database healthy. Scada-LTS waits for that healthy state, uses a 60-second database wait timeout, and reports HTTP readiness on port 8080.

Changes

Container startup readiness

Layer / File(s) Summary
Database health gating
docker-compose-dev.yml, docker-compose.yml
MySQL uses a connectivity healthcheck. Scada-LTS starts only after MySQL becomes healthy.
Application readiness timing
docker-compose-dev.yml, docker-compose.yml
The database wait timeout increases from 30 to 60 seconds. Scada-LTS adds a port 8080 healthcheck with retry and startup timing settings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to b48bd

The PR changes Compose startup behavior and may be incompatible with legacy docker-compose v1 when using health-based dependencies under version 3; confirm both Compose files with the supported CLI before merging.

Suggested reviewers: limraj, softq

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: Scada-LTS waits for MySQL health before starting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@katesclau
katesclau marked this pull request as ready for review August 17, 2026 22:41
@katesclau
katesclau requested review from Limraj and SoftQ as code owners August 17, 2026 22:41
@Limraj

Limraj commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Hi @katesclau,
Thank you for your interest in the project; we welcome further suggestions. Since we use a script that waits for the MySQL server to become available—and because this involves a specific Docker configuration where the administrator has full control over the environment—your proposed change would not, in practice, add significant value. Nevertheless, we encourage you to submit other proposals.

Best regards,
Kamil Jarmusik

@Limraj Limraj closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants