-
-
Notifications
You must be signed in to change notification settings - Fork 257
autoLayout not working in Deployment Diagrams with relationship between deployment nodes #25
Description
Hello,
I tried to generate a deployment diagram but I had to disable autoLayout to be able to get it as expected. I created a sample DSL code to help me on explaining the issue so you can also reproduce it.
I have a container diagram like this (see #All_Containers):
So, as a summary, a mobile app calls to multiple APIs through an API Gateway. The APIs have integration with database and 3rd party APIs.
For creating the deployment diagram, I added a the API Gateway as an infrastructure node, and enabled relationships between mobile app -> api gw -> apis. On the other hand, I represented a deployment of the APIs in multiple regions.
In the first try, I got the following diagram (See #All_Deployment_1):

That deployment diagram was confusing, as it included all relationships, when some of them are not valid from deployment point of view. e.g., API 1 deployed to US is not connected to the database in EU. On the other hand, once I introduce the API Gateway into the diagram, the direct relationship between mobile app and APIs must be hidden.
I've been able to implement the expected diagram using the feature that allows including/excluding especific relationships (See: #All_Deployment_2):
However, I had to disable autoLayout and manually distribute the elements in the diagram. If I enable autoLayout, I get the following diagram:
I would like to use the autolayout feature, as I do for other diagrams. I would appreciate if you can improve it to allow autolaout in that scenario.
Please let me know if I doing something wrong or I should I take a different approch to generate the deployment diagram as expected.
Thanks for your support.
Sample DSL:
workspace "Amazon Web Services Example" "An example AWS deployment architecture." {
model {
springPetClinic = softwaresystem "Spring PetClinic" "Allows employees to view and manage information regarding the veterinarians, the clients, and their pets." "Spring Boot Application" {
app = container "Mobile App" "Show information regarding the veterinarians, the clients, and their pets." "android" "Mobile App"
api1 = container "API 1" "API 2" "Java and Spring Boot"
api2 = container "API 2" "API 2" "Java and Spring Boot"
database = container "Database" "Stores information regarding the veterinarians, the clients, and their pets." "Relational database schema" "Database"
}
thirdPartyApi1 = softwaresystem "Third-Party API 1"
thirdPartyApi2 = softwaresystem "Third-Party API 2"
app -> api1 "manages data" "AWS API Gateway"
app -> api2 "manages data" "AWS API Gateway"
api1 -> database "Reads from and writes to" "JDBC/SSL"
api1 -> thirdPartyApi1 "Get 3rd pary data" "HTTP"
api2 -> thirdPartyApi2 "Get 3rd pary data" "HTTP"
deploymentEnvironment "Live" {
mobilePhone = deploymentNode "Customer's mobile device" "" "Android" {
appInstance = containerInstance app
}
deploymentNode "Amazon Web Services" "" "" "Amazon Web Services - Cloud" {
apiGw = deploymentNode "API Gateway" "" "" "Amazon Web Services - API Gateway" {
infrastructureNode "API Gateway" "" "" "Amazon Web Services - API Gateway Endpoint"
}
deploymentNode "US-East-1" "" "" "Amazon Web Services - Region" {
apiUsGroup = deploymentNode "Autoscaling group" "" "" "Amazon Web Services - Auto Scaling" {
api1UsDeploymentNode = deploymentNode "Amazon EC2 - API 1" "" "" "Amazon Web Services - EC2" {
containerInstance api1
}
api2UsDeploymentNode = deploymentNode "Amazon EC2 - API 2" "" "" "Amazon Web Services - EC2" {
containerInstance api2
}
}
rdsUs = deploymentNode "Amazon RDS" "" "" "Amazon Web Services - RDS" {
deploymentNode "MySQL" "" "" "Amazon Web Services - RDS_MySQL_instance" {
containerInstance database
}
}
}
deploymentNode "EU-West-1" "" "" "Amazon Web Services - Region" {
apiEuGroup = deploymentNode "Autoscaling group" "" "" "Amazon Web Services - Auto Scaling" {
api1EuDeploymentNode = deploymentNode "Amazon EC2 - API 1" "" "" "Amazon Web Services - EC2" {
containerInstance api1
}
api2EuDeploymentNode = deploymentNode "Amazon EC2 - API 2" "" "" "Amazon Web Services - EC2" {
containerInstance api2
}
}
rdsEu = deploymentNode "Amazon RDS" "" "" "Amazon Web Services - RDS" {
deploymentNode "MySQL" "" "" "Amazon Web Services - RDS_MySQL_instance" {
containerInstance database
}
}
}
}
thirdPartyInfra = deploymentNode "3rd party infrastructure" {
softwareSystemInstance thirdPartyApi1
softwareSystemInstance thirdPartyApi2
}
mobilePhone -> apiGw
apiGw -> apiUsGroup "Forwards requests to" "HTTPS"
apiGw -> apiEuGroup "Forwards requests to" "HTTPS"
api1UsDeploymentNode -> rdsUs
api1UsDeploymentNode -> thirdPartyInfra
api2UsDeploymentNode -> thirdPartyInfra
api1EuDeploymentNode -> rdsEu
api1EuDeploymentNode -> thirdPartyInfra
api2EuDeploymentNode -> thirdPartyInfra
}
}
views {
container springPetClinic "All_Containers" {
include *
autoLayout
}
deployment springPetClinic "Live" "All_Deployment_1" {
include *
autoLayout
}
deployment springPetClinic "Live" "All_Deployment_2" {
include *
exclude * -> *
include mobilePhone -> *
include apiGw -> *
include api1UsDeploymentNode -> *
include api2UsDeploymentNode -> *
include api1EuDeploymentNode -> *
include api2EuDeploymentNode -> *
//autoLayout
}
styles {
element "Element" {
shape roundedbox
background "#ffffff"
}
element "Database" {
shape cylinder
}
element "Mobile App" {
shape MobileDeviceLandscape
}
element "Infrastructure Node" {
shape roundedbox
}
}
themes https://static.structurizr.com/themes/amazon-web-services-2020.04.30/theme.json
}
}


