Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi tenancy #433

Merged
merged 12 commits into from
Oct 26, 2024
Merged

feat: multi tenancy #433

merged 12 commits into from
Oct 26, 2024

Conversation

giangndm
Copy link
Contributor

@giangndm giangndm commented Sep 29, 2024

Description

This PR introduce multi tenancy feature. The original idea is from token generate step, instead of provide configured secret, we can have a list of apps with separated secret which can be pulled from other sources (like control panel).

I created a AppContext for each session for providing more custom behavior in future (now it only have app_id).

Logic:

  • Token need to be build with app context inside. With JWT we use subject for store app_id.
  • At the core, cluster only see anything is some peer or track inside a room hash, which generated from both app_id and room

Depend on node-types, we have difference mechanism:

  • Gateway: sync app lists, validate secret and create token with main secret
  • Connector: sync app lists, build record or send hooks based on app config
  • Media: only use main secret to validate

Related Issue

If this pull request is related to any issue, please mention it here.

Checklist

  • Cluster logic
  • Log logic (connector, hooks, ...)
  • Record logic
  • Custom hooks endpoint for each app
  • I have tested the changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation, if necessary.
  • I have added appropriate tests, if applicable.

Screenshots

If applicable, add screenshots to help explain the changes made.

Additional Notes

Add any additional notes or context about the pull request here.

@giangndm giangndm mentioned this pull request Sep 29, 2024
4 tasks
Copy link

codecov bot commented Sep 29, 2024

Codecov Report

Attention: Patch coverage is 55.07519% with 478 lines in your changes missing coverage. Please review.

Project coverage is 41.43%. Comparing base (27d88bc) to head (c4cd807).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
packages/media_runner/src/worker.rs 0.00% 83 Missing ⚠️
bin/src/server/gateway/local_rpc_handler.rs 0.00% 49 Missing ⚠️
packages/media_connector/src/sql_storage.rs 85.71% 39 Missing ⚠️
bin/src/server/gateway/remote_rpc_handler.rs 0.00% 31 Missing ⚠️
packages/multi_tenancy/src/store.rs 86.41% 22 Missing ⚠️
packages/protocol/src/multi_tenancy.rs 29.03% 22 Missing ⚠️
bin/src/server/gateway.rs 0.00% 13 Missing ⚠️
bin/src/http/api_token.rs 0.00% 12 Missing ⚠️
packages/media_secure/src/lib.rs 20.00% 12 Missing ⚠️
packages/transport_webrtc/src/transport/webrtc.rs 87.05% 11 Missing ⚠️
... and 40 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #433      +/-   ##
==========================================
+ Coverage   40.57%   41.43%   +0.85%     
==========================================
  Files         161      165       +4     
  Lines       17583    18151     +568     
==========================================
+ Hits         7135     7521     +386     
- Misses      10448    10630     +182     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@giangndm giangndm marked this pull request as ready for review September 29, 2024 18:03
@giangndm
Copy link
Contributor Author

giangndm commented Sep 30, 2024

We should have custom config for each apps:

  • Bandwidth threshold
  • Recording prefix-path
  • Hook endpoint

The console also need to show list off apps in each gateways, connectors

@giangndm giangndm merged commit 9505691 into 8xFF:master Oct 26, 2024
11 checks passed
giangndm added a commit to giangndm/8xFF-decentralized-media-server that referenced this pull request Nov 26, 2024
* WIP: works app_sync logic, cluster with multi-tennancy by custom ClusterRoomHash generator

* fix clippy

* WIP: record with app

* fix clippy warns

* WIP: check app is same or not when re-join

* handle app record, more app and record info to console APIs

* update frontend

* fixed: wrong migration script cause postgresql query error

* fix: rtpengine create_answer error with sdp without connection line

* fix sendtry init

* feat: app with hook

* fix warn
@giangndm giangndm deleted the feat-multi-tenancy2 branch November 26, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant