homelab_automation/wait_for_db.py
Bruno Charest 984d06a223
Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
feat: Implement comprehensive database schema with new models, CRUD operations, and documentation for host metrics, Docker management, and terminal sessions, while removing old test files.
2026-03-05 10:16:13 -05:00

20 lines
523 B
Python

import time
import pymysql
print("Waiting for MySQL to boot...")
retries = 30
while retries > 0:
try:
conn = pymysql.connect(host='127.0.0.1', port=3306, user='homelab', password='CHANGE_ME', database='homelab')
conn.close()
print("MySQL is ready!")
break
except Exception as e:
print(f"Not ready yet, retrying in 2 seconds... ({e})")
time.sleep(2)
retries -= 1
if retries == 0:
print("Failed to connect to MySQL after 60 seconds.")
exit(1)