انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-050-L02

فحوص الصحة وترتيب البدء

  • الدرس 2 من 5
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

make services start in a usable order.

الموضوعات المخطط لها

  • depends_on alone only waits for the container to start, not to be ready.
  • A healthcheck runs a command repeatedly to mark a service healthy.
  • depends_on: db: condition: service_healthy makes the app wait for a healthy database.
  • Postgres check: pg_isready. Tune interval, timeout, retries.
  • Apps should still retry connections; startup order is a convenience, not a guarantee.
تفاصيل المخطط المبدئي

عرض عملي

yaml
db:
  healthcheck:
    test: ["CMD-SHELL", "pg_isready -U postgres"]
    interval: 5s
    retries: 10
app:
  depends_on:
    db: { condition: service_healthy }

اختبر فهمك

Why is plain depends_on not enough?

أظهر الإجابة

It does not wait until the database accepts connections.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.