-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from chriswachira/setup-diagram-as-code-with-p…
…ython feat(repo): introduce diagram-as-code with Python for README's Infrastructure section image
- Loading branch information
Showing
4 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from diagrams import Diagram, Edge, Cluster | ||
from diagrams.aws.network import CloudFront | ||
from diagrams.aws.storage import S3 | ||
from diagrams.aws.network import Route53 | ||
from diagrams.aws.general import Users | ||
from diagrams.onprem.vcs import Github | ||
|
||
graph_attr = { | ||
"pad": "0.5" | ||
} | ||
|
||
with Diagram( | ||
"chriswachira.com Infrastructure", | ||
outformat="png", | ||
filename="assets/infrastructure", | ||
graph_attr=graph_attr, | ||
show=False | ||
): | ||
users = Users("Users") | ||
|
||
with Cluster("AWS VPC"): | ||
aws_services = [ | ||
Route53("\nAmazon\nRoute53"), | ||
CloudFront("\nAmazon\nCloudFront"), | ||
S3("\nAmazon S3") | ||
] | ||
|
||
route53 = aws_services[0] | ||
cloudfront = aws_services[1] | ||
s3_bucket = aws_services[2] | ||
|
||
github = Github("\nGitHub\nActions") | ||
|
||
# Users' browsers querying the chriswachira.com domain DNS from Route 53 | ||
users >> Edge(label="chriswachira.com") >> route53 | ||
|
||
# An alias A record on Route 53 mapped to CloudFront distribution's domain | ||
route53 >> Edge(label="alias A record") >> cloudfront | ||
|
||
# S3 bucket acting as the origin for the CloudFront distribution | ||
cloudfront << Edge(label="S3 bucket origin") << s3_bucket | ||
|
||
# Website files pushed from GitHub Actions to S3 bucket | ||
s3_bucket << Edge(label="website static files") << github |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[tool.poetry] | ||
name = "chriswachira-com" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Chris Wachira <chriskane816@gmail.com>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "chriswachira"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
diagrams = "^0.23.4" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |