diff --git a/.github/workflows/diagrams.yml b/.github/workflows/diagrams.yml index 9835ab3a..70d5f8e2 100644 --- a/.github/workflows/diagrams.yml +++ b/.github/workflows/diagrams.yml @@ -21,7 +21,7 @@ jobs: echo "::set-output name=files::$(git diff --name-only HEAD^ HEAD | grep .puml | xargs)" - name: Generate SVG Diagrams - uses: holowinski/plantuml-github-action@main + uses: holowinski/plantuml-github-action@2e381afb2bae7e169b76bfb068e8d8b2089106ee with: args: -v -tsvg "diagrams/**.puml" -o "../static/diagrams" diff --git a/diagrams/architecture.puml b/diagrams/architecture.puml new file mode 100644 index 00000000..66e608e4 --- /dev/null +++ b/diagrams/architecture.puml @@ -0,0 +1,242 @@ +@startuml +'https://plantuml.com/deployment-diagram + +!define DIRECTION top to bottom direction +skinparam backgroundColor #f8f9fa +skinparam roundCorner 10 +skinparam defaultFontColor #2c3e50 +skinparam defaultFontSize 11 +skinparam linetype ortho + +' ================================ +' STYLING CLASSES +' ================================ + +' Customer Infrastructure Styling +skinparam cloud<> { + BackgroundColor #4a90e2 +} + +skinparam collections<> { + BackgroundColor #6bb6ff +} + +' External Integrations Styling +skinparam cloud<> { + BackgroundColor #50c878 +} + +skinparam node<> { + BackgroundColor #7ed321 +} + +' Cloudflare Styling +skinparam rectangle<> { + BackgroundColor #ff6b35 +} + +skinparam portin<> { + BackgroundColor #ff8c42 +} + +skinparam portout<> { + BackgroundColor #d84315 +} + +skinparam cloud<> { + BackgroundColor #bf360c +} + +skinparam rectangle<> { + BackgroundColor #dd2c00 +} + +skinparam frame<> { + BackgroundColor #ff5722 +} + +skinparam database<> { + BackgroundColor #ffa000 +} + +skinparam queue<> { + BackgroundColor #ff8f00 +} + +' AWS Infrastructure Styling +skinparam rectangle<> { + BackgroundColor #e74c3c +} + +skinparam portin<> { + BackgroundColor #c0392b +} + +skinparam queue<> { + BackgroundColor #e67e22 +} + +skinparam node<> { + BackgroundColor #f39c12 +} + +skinparam rectangle<> { + BackgroundColor #8e44ad +} + +skinparam database<> { + BackgroundColor #9b59b6 +} + +skinparam node<> { + BackgroundColor #3498db +} + +' EdgeDB Styling +skinparam database<> { + BackgroundColor #27ae60 +} + +skinparam portin<> { + BackgroundColor #2ecc71 +} + +' ================================ +' ARROW STYLING +' ================================ + +skinparam arrow { + Color #2c3e50 + FontColor #2c3e50 + FontSize 10 + Thickness 2 +} + +skinparam class { + ArrowColor #2c3e50 + ArrowFontColor #2c3e50 + ArrowThickness 2 +} + +' ================================ +' ARCHITECTURE COMPONENTS +' ================================ + +' Top Layer - Customer and External +together { + cloud "Customer Infrastructure" as customer_infra <> { + collections "Cloud Bucketing SDKs" as customer_cloud_sdks <> + collections "Local Bucketing SDKs" as customer_local_sdks <> + collections "Mobile/Web SDKs" as customer_mobile_web_sdks <> + collections "Management API Clients" as management_api_clients <> + } + + cloud "External Integrations" <> { + node "GitHub Actions" as github_actions <> + node "GitLab CI/CD" as gitlab_ci <> + node "Bitbucket Pipelines" as bitbucket_pipelines <> + node "JIRA" as jira <> + node "Slack" as slack <> + } +} + +' Middle Layer - Cloudflare Edge +rectangle "Cloudflare Edge Layer" <> { + together { + portin "Events API" as event_api_in <> + portin "SDK API" as sdk_api_in <> + portin "Cloud Bucketing API" as cloud_bucketing_api_in <> + portin "Config CDN" as config_cdn_in <> + portin "Management API" as management_api_cf_in <> + } + + cloud "Cloudflare WAF" as cf_waf <> { + rectangle "Core Worker APIs" as cloudflare_workers <> { + frame "Bucketing API" as bucketing_api <> + frame "Events API" as event_api <> + frame "SDK API" as sdk_api <> + } + } + + together { + database "Config R2 Buckets" as config_cdn <> + queue "Events Firehose" as events_firehose <> + } + + together { + portout "Events Out" as events_firehose_out <> + portout "Management Out" as management_api_cf_out <> + } +} + +' Database Layer +database "EdgeDB" as edgedb <> { + portin "Updates/Queries" as edgedb_in <> +} + +' Backend Layer - AWS +rectangle "AWS Backend" <> { + together { + portin "Events In" as events_firehose_in <> + portin "Management In" as management_api_in <> + } + + together { + queue "Kinesis Firehose" as events_firehose_aws <> + node "Snowflake Warehouse" as snowflake <> + } + + node "Management API" as mgmt_api <> + + rectangle "MongoDB Cloud" <> { + database "MongoDB Atlas" as mongodb_db <> + } +} + +' ================================ +' CONNECTIONS - Organized by Layer +' ================================ + +' Customer/External to Cloudflare Entry +customer_cloud_sdks -down-> cloud_bucketing_api_in +customer_mobile_web_sdks -down-> sdk_api_in +customer_local_sdks -down-> config_cdn_in +customer_local_sdks -down-> event_api_in +management_api_clients -down-> management_api_cf_in +jira -down-> management_api_cf_in +slack -down-> management_api_cf_in + +github_actions -down-> management_api_cf_in +gitlab_ci -down-> management_api_cf_in +bitbucket_pipelines -down-> management_api_cf_in + +' Cloudflare Entry Points to Core APIs +config_cdn_in -down-> config_cdn +event_api_in -down-> event_api +sdk_api_in -down-> sdk_api +cloud_bucketing_api_in -down-> bucketing_api +management_api_cf_in -down-> cf_waf + +' Core API to Storage/Events +sdk_api -down-> events_firehose +bucketing_api -down-> events_firehose +event_api -down-> events_firehose + +' Core API to EdgeDB +cloudflare_workers -down-> edgedb_in + +' Events and Management Flow +events_firehose -down-> events_firehose_out +cf_waf -down-> management_api_cf_out + +' Cloudflare to AWS +events_firehose_out -down-> events_firehose_in +management_api_cf_out -down-> management_api_in + +' AWS Internal Flow +events_firehose_in -down-> events_firehose_aws +events_firehose_aws -down-> snowflake +management_api_in -down-> mgmt_api +mgmt_api -down-> mongodb_db + +@enduml \ No newline at end of file diff --git a/static/diagrams/architecture.svg b/static/diagrams/architecture.svg new file mode 100644 index 00000000..b47c419c --- /dev/null +++ b/static/diagrams/architecture.svg @@ -0,0 +1 @@ +«customer»Customer Infrastructure«external»External Integrations«cloudflare»Cloudflare Edge Layer«waf»Cloudflare WAF«workers»Core Worker APIs«edgedb»EdgeDB«aws»AWS Backend«mongodb»MongoDB Cloud«sdk»Cloud Bucketing SDKs«sdk»Local Bucketing SDKs«sdk»Mobile/Web SDKs«sdk»Management API Clients«integration»GitHub Actions«integration»GitLab CI/CD«integration»Bitbucket Pipelines«integration»JIRA«integration»SlackEvents APISDK APICloud Bucketing APIConfig CDNManagement API«storage»Config R2 Buckets«events»Events FirehoseEvents OutManagement Out«api»Bucketing API«api»Events API«api»SDK APIUpdates/QueriesEvents InManagement In«kinesis»Kinesis Firehose«snowflake»Snowflake Warehouse«management»Management API«mongo»MongoDB Atlas \ No newline at end of file diff --git a/static/diagrams/config-manager.svg b/static/diagrams/config-manager.svg index c82ab42e..2a96e68e 100644 --- a/static/diagrams/config-manager.svg +++ b/static/diagrams/config-manager.svg @@ -1 +1 @@ -Config ManagerConstructor/InitializationStart Config Consolidation Threadnooptions.DisableRealtimeUpdatesyesConfig Polling ThreadPolling EnabledyesnoFetch ConfigSuccessyesnoUpdate ConfigSend Config Updated Event to EventHandlerRetry FetchnoRetryable ErroryesReturn error to EventHandlerCancel PollingPolling IntervalPolling EnabledyesConfig Consolidation ThreadEvent TypeNew Config AvailableFetch Config with minimum Last-Modified timestampConfig UpdatedDisable SSEUpdate SSE URLStart SSE ConnectionyesSSE URL is different than existing?noSSE Connection ErrorDisable SSEStart Polling ThreadSSE Connection SuccessDisable PollingEvent Received \ No newline at end of file +Config ManagerConstructor/InitializationStart Config Consolidation Threadnooptions.DisableRealtimeUpdatesyesConfig Polling ThreadPolling EnabledyesnoFetch ConfigSuccessyesnoUpdate ConfigSend Config Updated Event to EventHandlerRetry FetchnoRetryable ErroryesReturn error to EventHandlerCancel PollingPolling IntervalPolling EnabledyesConfig Consolidation ThreadEvent TypeNew Config AvailableFetch Config with minimum Last-Modified timestampConfig UpdatedDisable SSEUpdate SSE URLStart SSE ConnectionyesSSE URL is different than existing?noSSE Connection ErrorDisable SSEStart Polling ThreadSSE Connection SuccessDisable PollingEvent Received \ No newline at end of file diff --git a/static/diagrams/event-manager.svg b/static/diagrams/event-manager.svg index 1bcc349d..37fda364 100644 --- a/static/diagrams/event-manager.svg +++ b/static/diagrams/event-manager.svg @@ -1 +1 @@ -Event ManagerConstructor/InitializationStart Event Flush Threadnooptions.DisableAutomaticEventLogging and options.DisableCustomEventLoggingyesEvent Flush ThreadEvent TypeFlush IntervalForce FlushFlush Eventsnot Flush StopEvent ReceivedFlush Stop \ No newline at end of file +Event ManagerConstructor/InitializationStart Event Flush Threadnooptions.DisableAutomaticEventLogging and options.DisableCustomEventLoggingyesEvent Flush ThreadEvent TypeFlush IntervalForce FlushFlush Eventsnot Flush StopEvent ReceivedFlush Stop \ No newline at end of file diff --git a/static/diagrams/server-sdk-initialization.svg b/static/diagrams/server-sdk-initialization.svg index 0eb67720..968a4f5c 100644 --- a/static/diagrams/server-sdk-initialization.svg +++ b/static/diagrams/server-sdk-initialization.svg @@ -1 +1 @@ -new DevCycleClient(sdkKey, options)Constructor/InitializationValid Server SDK Keyyesnooptions.UseLocalBucketingyesnoInitialize Config ManagerInitialize Config ManagerInitialize Event ManagerInitialize Event Manageroptions.ConfigEventHandler existsyesnoInitial Fetch ThreadFetch Initial ConfigSuccessyesnoInitialize ConfigRetryable ErroryesnoRetry Fetchreturn error to EventHandlerSend Initialized EventFetch Initial ConfigSuccessyesnoInitialize ConfigRetryable ErroryesnoRetry FetchThrow errorStart Config Polling Threadyesoptions.DisableRealtimeUpdatesnoSend Initialized Eventyesoptions.ConfigEventHandler existsnoSDK Key Validation FailedThrow errorReturn DevCycleClient \ No newline at end of file +new DevCycleClient(sdkKey, options)Constructor/InitializationValid Server SDK Keyyesnooptions.UseLocalBucketingyesnoInitialize Config ManagerInitialize Config ManagerInitialize Event ManagerInitialize Event Manageroptions.ConfigEventHandler existsyesnoInitial Fetch ThreadFetch Initial ConfigSuccessyesnoInitialize ConfigRetryable ErroryesnoRetry Fetchreturn error to EventHandlerSend Initialized EventFetch Initial ConfigSuccessyesnoInitialize ConfigRetryable ErroryesnoRetry FetchThrow errorStart Config Polling Threadyesoptions.DisableRealtimeUpdatesnoSend Initialized Eventyesoptions.ConfigEventHandler existsnoSDK Key Validation FailedThrow errorReturn DevCycleClient \ No newline at end of file