Skip to content

Commit

Permalink
feat: add a new example for deployment diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorin committed Mar 18, 2023
1 parent 7134f48 commit 4421ff8
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 18 deletions.
Binary file modified distribution/c4model/Boundary/DeploymentNodeBoundary.Local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion distribution/c4model/Boundary/DeploymentNodeBoundary.puml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
' definition of the Item c4model/Boundary/DeploymentNodeBoundary

!procedure DeploymentNodeBoundary($id, $name, $tech="")
C4Boundary('Deployment Node', 'Node', $id, $name, $tech)
C4Boundary('Deployment Node', 'Boundary', $id, $name, $tech)
!endprocedure
Binary file modified distribution/c4model/Boundary/InfrastructureNodeBoundary.Local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
' definition of the Item c4model/Boundary/InfrastructureNodeBoundary

!procedure InfrastructureNodeBoundary($id, $name, $tech="")
C4Boundary('Infrastructure Node', 'Node', $id, $name, $tech)
C4Boundary('Infrastructure Node', 'Boundary', $id, $name, $tech)
!endprocedure
7 changes: 6 additions & 1 deletion distribution/c4model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,18 @@ The package provides 2 modules.

# Examples

The package provides 7 examples.
The package provides 8 examples.

## Deployment diagram

![Deployment diagram](../c4model/deployment_diagram.png)<br>
[The source file.](../c4model/deployment_diagram.puml)

## Deployment diagram AWS

![Deployment diagram AWS](../c4model/deployment_diagram_aws.png)<br>
[The source file.](../c4model/deployment_diagram_aws.puml)

## Dynamic diagram

![Dynamic diagram](../c4model/dynamic_diagram.png)<br>
Expand Down
Binary file modified distribution/c4model/deployment_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added distribution/c4model/deployment_diagram_aws.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions distribution/c4model/deployment_diagram_aws.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION=".."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('c4model/bootstrap')

include('c4model/Boundary/DeploymentNodeBoundary')
include('c4model/Element/InfrastructureNode')
include('c4model/Element/Container')
include('c4model/Element/Database')

Title("Spring PetClinic", "Deployment Diagram")
left to right direction

DeploymentNodeBoundary("aws", "Amazon Web Services") {
DeploymentNodeBoundary("region", "US-East-1") {
InfrastructureNode("rout53", "Route 53", "Highly available and scalable cloud DNS service.")
InfrastructureNode("ld", "Elastic Load Balancer", "Automatically distributes incoming application traffic.")
DeploymentNodeBoundary("webapp_ec2_auto", "Autoscaling group") {
DeploymentNodeBoundary("webapp_ec2", "Amazon EC2") {
Container("app", "Web Application", "Allows employee to view and manage information regarding the veterinarians, the clients and their pets.", "Java and Spring Boot")
}
}
DeploymentNodeBoundary("rds", "Amazon RDS") {
DeploymentNodeBoundary("mysql", "MySQL") {
Database("database", "Database", "Stores information regarding the veterinarians, the clients and their pets.", "Relational database schema")
}
}
}
}

rout53 ..> ld : Relationship("Forwards\nrequest to", "HTTPS")
ld ..> app : Relationship("Forwards\nrequest to", "HTTPS")
app ..> database : Relationship("Reads from and \nwrites to", "MySQL Protocol/SSL")

@enduml
Binary file modified distribution/c4model/dynamic_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions distribution/c4model/full.puml
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ skinparam rectangle<<Node>> {
' definition of the Item c4model/Boundary/DeploymentNodeBoundary

!procedure DeploymentNodeBoundary($id, $name, $tech="")
C4Boundary('Deployment Node', 'Node', $id, $name, $tech)
C4Boundary('Deployment Node', 'Boundary', $id, $name, $tech)
!endprocedure
' definition of the Item c4model/Boundary/InfrastructureNodeBoundary

!procedure InfrastructureNodeBoundary($id, $name, $tech="")
C4Boundary('Infrastructure Node', 'Node', $id, $name, $tech)
C4Boundary('Infrastructure Node', 'Boundary', $id, $name, $tech)
!endprocedure
Binary file modified distribution/c4model/level_1_system_context.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified distribution/c4model/level_2_container.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified distribution/c4model/level_3_component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified distribution/c4model/main_artifacts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions distribution/c4model/single.puml
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ skinparam rectangle<<Node>> {
' definition of the Item c4model/Boundary/DeploymentNodeBoundary

!procedure DeploymentNodeBoundary($id, $name, $tech="")
C4Boundary('Deployment Node', 'Node', $id, $name, $tech)
C4Boundary('Deployment Node', 'Boundary', $id, $name, $tech)
!endprocedure
' definition of the Item c4model/Boundary/InfrastructureNodeBoundary

!procedure InfrastructureNodeBoundary($id, $name, $tech="")
C4Boundary('Infrastructure Node', 'Node', $id, $name, $tech)
C4Boundary('Infrastructure Node', 'Boundary', $id, $name, $tech)
!endprocedure
Binary file modified distribution/c4model/system_landscape_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions source/library/packages/c4model/boundaries.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name,stereotype,type
Enterprise,Boundary,Enterprise
System,Boundary,System
Container,Boundary,Container
DeploymentNode,Node,Deployment Node
InfrastructureNode,Node,Infrastructure Node
DeploymentNode,Boundary,Deployment Node
InfrastructureNode,Boundary,Infrastructure Node
7 changes: 4 additions & 3 deletions source/library/packages/c4model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function createBoundaryItems(path: string, urn: string): Array<Item> {
F.readFileSync(path, { encoding: "utf-8" }),
{ columns: true }
)
return boundary_items_as_csv.map(({ name, type,stereotype }) => {
return boundary_items_as_csv.map(({ name, type, stereotype }) => {
return {
urn: `${urn}/Boundary/${name}Boundary`,
templates: {
Expand Down Expand Up @@ -81,8 +81,8 @@ export class C4modelFactory implements PackageFactory {
{
urn: `${this.getUrn()}/Element`,
items: createElementItems(
P.join(__dirname, "elements.csv"),
this.getUrn()
P.join(__dirname, "elements.csv"),
this.getUrn()
),
},
{
Expand All @@ -95,6 +95,7 @@ export class C4modelFactory implements PackageFactory {
],
examples: [
"Deployment diagram",
"Deployment diagram AWS",
"Dynamic diagram",
"Level 1 System Context",
"Level 2 Container",
Expand Down
31 changes: 25 additions & 6 deletions source/templates/c4model/examples/deployment_diagram_aws.tera
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
{% extends "package_example.tera" %}

{% block content %}

C4Legend()
Title("[Deployment] Spring PetClinic")

include('c4model/Boundary/DeploymentNodeBoundary')
include('c4model/Element/InfrastructureNode')
include('c4model/Element/DeploymentNode')
include('c4model/Element/Container')
include('c4model/Element/Database')

Title("Spring PetClinic", "Deployment Diagram")
left to right direction

InfrastructureNode("rout53", "Route 53", "Highly available and scalable cloud DNS service.")
DeploymentNodeBoundary("aws", "Amazon Web Services") {
DeploymentNodeBoundary("region", "US-East-1") {
InfrastructureNode("rout53", "Route 53", "Highly available and scalable cloud DNS service.")
InfrastructureNode("ld", "Elastic Load Balancer", "Automatically distributes incoming application traffic.")
DeploymentNodeBoundary("webapp_ec2_auto", "Autoscaling group") {
DeploymentNodeBoundary("webapp_ec2", "Amazon EC2") {
Container("app", "Web Application", "Allows employee to view and manage information regarding the veterinarians, the clients and their pets.", "Java and Spring Boot")
}
}
DeploymentNodeBoundary("rds", "Amazon RDS") {
DeploymentNodeBoundary("mysql", "MySQL") {
Database("database", "Database", "Stores information regarding the veterinarians, the clients and their pets.", "Relational database schema")
}
}
}
}

rout53 ..> ld : Relationship("Forwards\nrequest to", "HTTPS")
ld ..> app : Relationship("Forwards\nrequest to", "HTTPS")
app ..> database : Relationship("Reads from and \nwrites to", "MySQL Protocol/SSL")
{% endblock content -%}

0 comments on commit 4421ff8

Please sign in to comment.