Refactor docker-compose setup and enhance scheduling components
- Re-enabled Vision API and Media API services in docker-compose.yml, providing necessary configurations for development. - Improved scheduling logic in HorizontalTimelineCalendar and Scheduling components to better manage repetition visibility and database scheduling status. - Updated docker-compose-reset.sh to conditionally wait for Supabase services, enhancing the setup process for local development. - Added isScheduledInDb prop to manage UI states for scheduled repetitions, improving user experience in the scheduling interface.
This commit is contained in:
@@ -60,57 +60,69 @@ echo "4. Rebuilding and starting all services in detached mode..."
|
||||
docker compose up --build -d
|
||||
echo ""
|
||||
|
||||
echo "5. Waiting for Supabase database to be ready..."
|
||||
# Wait for database to be healthy
|
||||
MAX_WAIT=60
|
||||
WAIT_COUNT=0
|
||||
while [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
||||
if docker compose ps supabase-db | grep -q "healthy"; then
|
||||
echo " ✓ Supabase database is healthy"
|
||||
break
|
||||
fi
|
||||
echo " Waiting for database... ($WAIT_COUNT/$MAX_WAIT seconds)"
|
||||
sleep 2
|
||||
WAIT_COUNT=$((WAIT_COUNT + 2))
|
||||
done
|
||||
echo "5. Waiting for Supabase database to be ready (if configured)..."
|
||||
|
||||
if [ $WAIT_COUNT -ge $MAX_WAIT ]; then
|
||||
echo " ⚠ Warning: Database may not be fully ready"
|
||||
# Only wait for Supabase if the supabase-db service exists in docker-compose.yml
|
||||
if docker compose config --services 2>/dev/null | grep -q "^supabase-db$"; then
|
||||
# Wait for database to be healthy
|
||||
MAX_WAIT=60
|
||||
WAIT_COUNT=0
|
||||
while [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
||||
if docker compose ps supabase-db | grep -q "healthy"; then
|
||||
echo " ✓ Supabase database is healthy"
|
||||
break
|
||||
fi
|
||||
echo " Waiting for database... ($WAIT_COUNT/$MAX_WAIT seconds)"
|
||||
sleep 2
|
||||
WAIT_COUNT=$((WAIT_COUNT + 2))
|
||||
done
|
||||
|
||||
if [ $WAIT_COUNT -ge $MAX_WAIT ]; then
|
||||
echo " ⚠ Warning: Database may not be fully ready"
|
||||
fi
|
||||
else
|
||||
echo " - Supabase services are currently disabled in docker-compose.yml; skipping DB wait step."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "6. Waiting for Supabase migrations to complete..."
|
||||
# Wait for migration container to complete (it has restart: "no", so it should exit when done)
|
||||
MAX_WAIT=120
|
||||
WAIT_COUNT=0
|
||||
MIGRATE_CONTAINER="usda-vision-supabase-migrate"
|
||||
echo "6. Waiting for Supabase migrations to complete (if configured)..."
|
||||
|
||||
while [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
||||
# Check if container exists and its status
|
||||
if docker ps -a --format "{{.Names}}\t{{.Status}}" | grep -q "^${MIGRATE_CONTAINER}"; then
|
||||
CONTAINER_STATUS=$(docker ps -a --format "{{.Names}}\t{{.Status}}" | grep "^${MIGRATE_CONTAINER}" | awk '{print $2}')
|
||||
|
||||
if echo "$CONTAINER_STATUS" | grep -q "Exited"; then
|
||||
EXIT_CODE=$(docker inspect "$MIGRATE_CONTAINER" --format='{{.State.ExitCode}}' 2>/dev/null || echo "1")
|
||||
if [ "$EXIT_CODE" = "0" ]; then
|
||||
echo " ✓ Supabase migrations completed successfully"
|
||||
break
|
||||
else
|
||||
echo " ⚠ Warning: Migrations may have failed (exit code: $EXIT_CODE)"
|
||||
echo " Check logs with: docker compose logs supabase-migrate"
|
||||
break
|
||||
# Only wait for the migration container if the supabase-migrate service exists
|
||||
if docker compose config --services 2>/dev/null | grep -q "^supabase-migrate$"; then
|
||||
# Wait for migration container to complete (it has restart: "no", so it should exit when done)
|
||||
MAX_WAIT=120
|
||||
WAIT_COUNT=0
|
||||
MIGRATE_CONTAINER="usda-vision-supabase-migrate"
|
||||
|
||||
while [ $WAIT_COUNT -lt $MAX_WAIT ]; do
|
||||
# Check if container exists and its status
|
||||
if docker ps -a --format "{{.Names}}\t{{.Status}}" | grep -q "^${MIGRATE_CONTAINER}"; then
|
||||
CONTAINER_STATUS=$(docker ps -a --format "{{.Names}}\t{{.Status}}" | grep "^${MIGRATE_CONTAINER}" | awk '{print $2}')
|
||||
|
||||
if echo "$CONTAINER_STATUS" | grep -q "Exited"; then
|
||||
EXIT_CODE=$(docker inspect "$MIGRATE_CONTAINER" --format='{{.State.ExitCode}}' 2>/dev/null || echo "1")
|
||||
if [ "$EXIT_CODE" = "0" ]; then
|
||||
echo " ✓ Supabase migrations completed successfully"
|
||||
break
|
||||
else
|
||||
echo " ⚠ Warning: Migrations may have failed (exit code: $EXIT_CODE)"
|
||||
echo " Check logs with: docker compose logs supabase-migrate"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo " Waiting for migrations... ($WAIT_COUNT/$MAX_WAIT seconds)"
|
||||
sleep 2
|
||||
WAIT_COUNT=$((WAIT_COUNT + 2))
|
||||
done
|
||||
|
||||
echo " Waiting for migrations... ($WAIT_COUNT/$MAX_WAIT seconds)"
|
||||
sleep 2
|
||||
WAIT_COUNT=$((WAIT_COUNT + 2))
|
||||
done
|
||||
|
||||
if [ $WAIT_COUNT -ge $MAX_WAIT ]; then
|
||||
echo " ⚠ Warning: Migration timeout - check logs with: docker compose logs supabase-migrate"
|
||||
echo " Note: Migrations may still be running or the container may not have started yet"
|
||||
if [ $WAIT_COUNT -ge $MAX_WAIT ]; then
|
||||
echo " ⚠ Warning: Migration timeout - check logs with: docker compose logs supabase-migrate"
|
||||
echo " Note: Migrations may still be running or the container may not have started yet"
|
||||
fi
|
||||
else
|
||||
echo " - Supabase migration service is currently disabled in docker-compose.yml; skipping migration wait step."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user