Skip to content

Instantly share code, notes, and snippets.

@atom-tr
Last active December 19, 2023 09:01
Show Gist options
  • Save atom-tr/f4847e530359dfe73582910637403555 to your computer and use it in GitHub Desktop.
Save atom-tr/f4847e530359dfe73582910637403555 to your computer and use it in GitHub Desktop.
HSIA IAM Distributed apps

Thay đổi cách lưu trữ, fix lỗi, phát triển IAM

Bối cảnh

Hiện tại có version 2 của IAM (chỉ là version nâng cấp python, django) để nhằm mục đích dễ dàng phát triển tính năng mới và fix lỗi. Tuy nhiên vẫn tồn đọng:

  • Không đồng nhất code: Hiện vẫn có 2 version lớn: Opera và HMS, ngoài ra các khách triển khai sau vẫn chạy độc lập, chưa được quản lý version tập trung
  • Khó khăn trong việc triển khai fix lỗi ở nhiều khách hàng vì code độc lập

Mô hình Distributed dự kiến

  • Mỗi khách vẫn được quản lý version thay đổi trên gitlab với repo riêng
  • Sử dụng git submodule để include source code các app dùng chung vào IAM khách hàng
  • Theo dõi issue, update chung của mỗi app ở repo riêng
  • Apply xuống khách hàng bằng git submodule update

Lưu ý: Mô hình bên dưới chỉ miêu tả ý tưởng, chưa đầy đủ tất cả tính năng cần

---
title: HSIA IAM Distributed app
---
classDiagram
    class E["Example IAM"]
    <<repo>> E
    note for E "
    - Mỗi khách hàng sẽ được lưu trwx mới 1 repo riêng để lueu lịch sử thay đổi
    - Bắt buộc cần submodule base để hoạt động
    - Add thêm các submodule theo nhu cầu khách hàng
    - Sau khi fix lỗi hoặc thêm tính năng dùng chung, chỉ cần  để update ở EWS khách hàng
      > git submodule update --remote
    - Khách hàng có nhu cầu riêng sẽ không ảnh hưởng khách hàng khác
    
    "
    E <|-- base : git submodule add
    E <.. O : git submodule add
    E <.. HMS : git submodule add
    E <.. EZ : git submodule add
    E <.. C : git submodule add
    E <.. A : git submodule add


    E : ~app ews
    E : #file configuration.py
    E : #file settings.py
    E : -file .gitmodules
    E : +dir static
    E : -dir templates
    E : -dir some_dir
    E : +admin.views()
    E : +EWS.view()
    class base["IAM base"]{
        <<repo>>
        ~app base.ews
        ~app base.QoS
        ~app base.accesscontrol
        ~app base.gateway
        ~dir base.utils
        -file requirements.txt
        +base.views()
        +admin.views()
        +add_account_to_gateway(self, account, mac)
        +delete_account_from_gateway(self, mac)
    }
    base <|-- gateway
    class gateway {
        <<app>>
        -nomadix
        -mikrotik
        ...
        +add_account_to_gateway(self, account, mac)
        +delete_account_from_gateway(self, mac)
    }
    base <|-- ews
    class ews["base.ews"] {
        <<app>>
        -file decorators.py
        -file views.py
        -dir templates
         > default templates cho các base view
        ...
        +class EWS(View)
        +class DefaultView(EWS)
        +class SingleClickView(EWS)
        +class AccessCodeView(EWS)
        +class LoginView(EWS)
        +class LogoutView(EWS)
    }
    class O["Opera PMS"]{
        <<repo>>
        -file requirements.txt
        +model GuestData
        +func extract(record_data)
        +admin.views()
        +process_pms_message.views()
    }
    class C["Opera PMS Client"]{
        <<repo>>
        -model PMSRecord
        -model SendRecord(PMSRecord)
        -model RecivedRecord(PMSRecord)
        -file requirements.txt
        +admin.views()
    }
    class HMS["Vin HMS"]{
        <<repo>>
        -file requirements.txt
        +bool is_wild
        +admin.views()
    }
    class EZ["EZCloud"]{
        <<repo>>
        -file requirements.txt
        +bool is_wild
        +admin.views()
    }
    class A["Function A"]{
        <<repo>>
        -file requirements.txt
        +bool A
        +functionA()
        +functionB()
    }
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment