Saturday, November 21, 2020

١. الكود

 

I. Codebase

الكود

One codebase tracked in revision control, many deploys

كود واحد مدرج في نظام المراجعة، وعدة اطلاقات

A twelve-factor app is always tracked in a version control system, such as GitMercurial, or Subversion. A copy of the revision tracking database is known as a code repository, often shortened to code repo or just repo.

التطبيق يجب ان يكون مدرجا في نظام مراجعة مثل git او subversion
ويكون هناك قاعدة بيانات لمراجعات الكود تسمي مستودع الكود، يمكن تسميتها اختصارا : مستودع

codebase is any single repo (in a centralized revision control system like Subversion), or any set of repos who share a root commit (in a decentralized revision control system like Git).

كود التطبيق هو اي مستودع (سواء كان نظام المراجعة مركزيا آو لا)

One codebase maps to many deploys

There is always a one-to-one correlation between the codebase and the app:

  • If there are multiple codebases, it’s not an app – it’s a distributed system. Each component in a distributed system is an app, and each can individually comply with twelve-factor.
  • Multiple apps sharing the same code is a violation of twelve-factor. The solution here is to factor shared code into libraries which can be included through the dependency manager.

هناك دائما ارتباط وثيق بين الكود والتطبيق

- لو كان هناك اكثر من كود-بيز فهذا ليس بتطبيق، وانما هو نظام موزع. حيث يكون كل مكون من مكونات النظام الموزعهو تطبيق مستقل يمكن اخضاعه الي قواعد ال١٢ عامل

- وجود عدة تطبيقات تتشارك في نفس الكودبيز هو خرق لقواعد ال١٢ عامل. والحل في هذه الحالة هو اعادة هيكلة الكود الي مكتبات يمكن ادراجها الي تلك التطبيقات بواسطة مدير الاعتماد

There is only one codebase per app, but there will be many deploys of the app. A deploy is a running instance of the app. This is typically a production site, and one or more staging sites. Additionally, every developer has a copy of the app running in their local development environment, each of which also qualifies as a deploy.

يجب ان يكون هناك كودبيز واحد فقط للتطبيق، ولكن يمكن ان يكون هناك عدة اطلاقات للتطبيق. الاطلاقة هي نسخة عاملة من التطبيق. نعني بذلك وجود نسخة قيد الاستخدام، ونسخة او اكثر لتجريب ما قبل الاستخدام. بالاضافة الي امتلاك كل مطور لنسخة قيد التطوير، كل منها يمكن اعتبارها اطلاقة بذاتها

The codebase is the same across all deploys, although different versions may be active in each deploy. For example, a developer has some commits not yet deployed to staging; staging has some commits not yet deployed to production. But they all share the same codebase, thus making them identifiable as different deploys of the same app.

الكودبيز هو واحد في الاصل عبر كل الاطلاقات، مع الاخذ في الاعتبار احتمالية اختلاف النسخ عبر الاطلاقات المختلفة. علي سبيل المثال، يمكن ان يكون المبرمج لديه بعض المساهمات لو يتم اطلاقها في نسخة تجريب ما قبل الاستخدام، ونسخة التجريب ما قبل الاستخدام فيها بعض المساهمات لم يتم اطلاقها في النسخة قيد الاستخدام. لكن في النهاية كلها تتشارك في أصل الكودبيز، وبالتالي يمكن اعتبارها نسخ/اطلاقات مختلفة من نفس التطبيق

No comments:

Post a Comment