Commit e84b7134 authored by Abhishek's avatar Abhishek
Browse files

Merge branch 'new_moodle_file_abhishek' into 'master'

wait added in script

See merge request !13
parents ff13adf3 1f6f5363
Pipeline #11802 passed with stage
in 5 minutes and 50 seconds
...@@ -37,22 +37,23 @@ echo " -> Using Moodle URL: $MOODLE_URL" ...@@ -37,22 +37,23 @@ echo " -> Using Moodle URL: $MOODLE_URL"
echo " -> Using Backend URL: $BACKEND_URL" echo " -> Using Backend URL: $BACKEND_URL"
# --- THIS IS THE FIX --- # --- THIS IS THE FIX ---
# Instead of proceeding immediately, we will loop until the Moodle installation # Instead of checking for a file, we now poll the database directly.
# (run by docker-entrypoint.sh) is complete. We know it's complete when the # The presence of the 'version' record in the config table is the true
# config.php file exists inside the container. # indicator that the initial installation has successfully completed.
echo " -> Waiting for Moodle first-time installation to complete..." echo " -> Waiting for Moodle first-time installation to complete..."
timeout=300 # 5 minute timeout timeout=300 # 5 minute timeout
while ! docker exec "$MOODLE_CONTAINER" [ -f "$MOODLE_ROOT_IN_CONTAINER/config.php" ]; do while ! docker exec "$DB_CONTAINER_NAME" mysql -u root -p"$DB_ROOT_PASSWORD" "$DB_NAME" -e "SELECT * FROM mdl_config WHERE name = 'version';" | grep -q "version"; do
timeout=$((timeout - 5)) timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then if [ $timeout -le 0 ]; then
echo "❌ ERROR: Moodle installation timed out after 5 minutes." echo "❌ ERROR: Moodle installation timed out after 5 minutes."
echo "--- MOODLE CONTAINER LOGS ---"
docker logs "$MOODLE_CONTAINER" docker logs "$MOODLE_CONTAINER"
exit 1 exit 1
fi fi
echo " -> Installation not yet complete, waiting 5 more seconds..." echo " -> Database not yet ready, waiting 5 more seconds..."
sleep 5 sleep 5
done done
echo "✅ Moodle installation complete (config.php found)." echo "✅ Moodle installation complete (database version found)."
# --- Pre-flight Checks & Plugin Install (Step 1) --- # --- Pre-flight Checks & Plugin Install (Step 1) ---
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment