示例#1
0
from diagrams import Cluster, Diagram
from diagrams.aws.database import Dynamodb
from diagrams.aws.storage import S3
from diagrams.aws.security import KMS
# from diagrams.aws.general import User
from diagrams.onprem.client import User
from diagrams.onprem.iac import Terraform

with Diagram("AWS S3 Backend", show=False):

    tf = Terraform("")
    user = User("DevOps")

    with Cluster("AWS"):
        aws = [S3("TF State"), Dynamodb("TF LockTable"), KMS("Encryption Key")]

    user >> tf >> aws
示例#2
0
                Firewall("oauth"),
            ]
        )

    with Cluster("Media Node"):
        media_services = [
            Server("plex"),
            Server("ombi"),
            Server("calibre"),
            Server("calibre-web"),
            Server("nzbget"),
            Server("radarr"),
            Server("sonarr"),
            Server("lazylibrarian"),
            Server("tautulli"),
        ]
        ingress >> Edge(color="green") >> media_services

    (
        ingress
        >> Edge(color="gray", style="dashed")
        >> LetsEncrypt("LetsEncrypt")
        >> Edge(color="gray", style="dashed")
        >> ingress
    )
    bastionDroplet = Terraform("DigitalOcean")
    Cloudflare("proxy") - Edge(color="gray") - ingress
    workstation >> Edge(color="blue", style="dashed") >> ingress
    workstation >> Edge(color="blue", style="dashed") >> bastionDroplet
    bastionDroplet >> Edge(color="blue", style="dashed") >> Rack("bastion")
示例#3
0
                PrivateSubnet("Subnet zone d"),
                ]
            with Cluster("Kubernetes cluster"):
                autoscaling_group = AutoScaling("Autoscaling group")
                autoscaling_group_instances = [
                    EC2("K8s worker zone a"),
                    EC2("K8s worker zone b"),
                    EC2("K8s worker zone c"),
                    EC2("K8s worker zone d"),
                ]
                ingress = Ingress("Ingress gateway")
                services = Service("Services")
                pods = Pod("Container pods")

    ci_pipeline = GitlabCI("CI pipeline")
    terraform_repo = Terraform("Infra as code")
    remote_state = S3("Remote state")

    ssl_certificate - dns_name
    dns_name - load_balancer
    load_balancer - public_subnets
    public_subnets - nat_gateway
    nat_gateway - private_subnets
    private_subnets - autoscaling_group
    autoscaling_group - autoscaling_group_instances
    autoscaling_group_instances - ingress
    ingress - services
    services - pods
    ci_pipeline - terraform_repo
    terraform_repo - remote_state
示例#4
0
from diagrams import Cluster, Diagram
from diagrams.onprem.cd import Tekton
from diagrams.onprem.gitops import Argocd
from diagrams.onprem.iac import Terraform
from diagrams.programming.flowchart import Action

with Diagram("Lorem Ipsum Cloud Native CI/CD",
             show=True,
             filename='lorem_ipsum_cloud_native_cidcd'):
    with Cluster('CI/CD - Kube'):
        cd = Tekton('cd')
        iac = Terraform('iac')
        gitops = Argocd('gitops')
        with Cluster('Pipeline'):
            build = Action('build')
            unit_test = Action('unit test')
            deploy_test = Action('deploy test')
            e2e_test = Action('integration/e2e test')
            deploy_prod = Action('deploy prod')
            build >> unit_test >> deploy_test >> e2e_test >> deploy_prod
        gitops << [deploy_test, deploy_prod]
        iac >> [deploy_test, deploy_prod]
示例#5
0
from diagrams import Diagram, Cluster
from diagrams.onprem.compute import Server
from diagrams.onprem.network import Internet
from diagrams.oci.network import LoadBalancer
from diagrams.onprem.iac import Terraform
from diagrams.onprem.client import User

with Diagram("Load balanced application on droplets",
             show=False,
             direction="LR"):

    internet = Internet("Internet")
    internet

    with Cluster("home"):
        user = User("you")
        terraform = Terraform("terraform apply")
        user >> terraform >> internet

    with Cluster("DigitalOcean"):
        pub_lb = LoadBalancer("pub-lb-burrito-prod")
        web0 = Server("web0-burrito-prod")
        web1 = Server("web1-burrito-prod")

        internet >> pub_lb
        pub_lb >> web0
        pub_lb >> web1
示例#6
0
        nfsv4 = [
            FileStorage("ESXI Datastore"),
            FileStorage("Packer RAW images"),
            FileStorage("Controller configuration and Data files")
        ]

    ci << repo
    repo << nfsv4[2]
    proxy << nfsv4[2]
    switch << proxy

    with Cluster("ESXI Host"):
        # ESXI Host
        esxi = Vmware("ESXI")
        # Terraform
        tf = Terraform("Terraform")
        tf << ci

        with Cluster("K8s (Kubespray) - Ubuntu VM's"):
            control = Ubuntu("Control plane")
            control - Ubuntu("Worker")

        with Cluster("OpenStack - Ubuntu VM's"):
            openstack = Ubuntu("DevStack")

        # ESXI external interactions
        esxi << tf
        esxi << proxy
        esxi << nfsv4[0]
        esxi << repo[0]
from diagrams import Diagram, Cluster, Edge

from diagrams.onprem.container import Docker
from diagrams.onprem.iac import Terraform, Ansible
from diagrams.custom import Custom

graph_attr = {"fontsize": "45", "bgcolor": "transparent", "dpi": "300"}

with Diagram("", show=False, filename="value_stream", graph_attr=graph_attr):

    image = Docker("Docker Image")
    docker_role = Ansible("Ansible Role Docker")
    app_role = Ansible("Ansible Role App")
    packer_ami = Custom("AMI", "packer.png")

    terrafor_module = Terraform("Module")
    terrafor_stack = Terraform("Deployment")

    image >> app_role >> packer_ami
    docker_role >> packer_ami >> terrafor_module >> terrafor_stack
示例#8
0
from diagrams import Cluster, Diagram
from diagrams.aws.management import Organizations
from diagrams.aws.security import SingleSignOn
from diagrams.onprem.client import User
from diagrams.onprem.iac import Terraform
from diagrams.aws.general import General

graph_attr = {"fontsize": "40", "bgcolor": "transparent"}

with Diagram("\nAWS Multi Account", show=False, graph_attr=graph_attr):
    org = Organizations("Master Account")
    sso = SingleSignOn("SSO")
    tf = Terraform("0.14")
    user = User("DevOps")

    with Cluster("AWS Accounts"):
        accounts = [
            General("Shared Account"),
            General("Dev Account"),
            General("Prod Account")
        ]

    user >> tf >> org >> sso >> accounts
示例#9
0
from diagrams import Diagram, Cluster
from diagrams.gcp.compute import GCF
from diagrams.gcp.storage import GCS

from diagrams.onprem.iac import Terraform
from diagrams.programming.language import Python

Terraform._height = 0.9
Python._height = 0.9

diagram_kwargs = dict(direction="LR", filename="docs/diagram", show=False)


with Diagram("GCF Data Mining Example", **diagram_kwargs):

    with Cluster("DevOps & Source Code") as devops:
        source_code = GCS("Source Code Bucket")
        python = Python()

        state = GCS("Terraform State Bucket")
        terraform = Terraform()

    with Cluster("Application") as app:
        function = GCF("Data Mining Service")
        data = GCS("Data Bucket")

    source_code >> python >> function
    state >> terraform >> function
    function >> data
示例#10
0
# diagram.py
from diagrams import Diagram
from diagrams.onprem.iac import Terraform
from diagrams.onprem.client import User, Users

with Diagram("Terraform Cloud Organization", show=False, direction="RL"):
    Terraform("tfe organization") << [User("admin"), Users("membership")]
示例#11
0
    devops_team = Custom("DevOps Team", "./resources/devops.png")

    with Cluster("Tools Chain"):
        openldap = Custom("OpenLDAP", "./resources/openldap.png")

        with Cluster("CI / CD & Automation"):
            continous_integration = Jenkins("Jenkins Job and Pipeline")
            continous_integration - [
                Custom("Bitbucket CI", "./resources/bitbucket.png")
            ] << openldap

            devops_team >> continous_integration

        with Cluster("Provisioning"):
            provisioning = Terraform("Terraform")
            provisioning - [
                Custom("Packer", "./resources/packer.png"),
                Custom("Helm", "./resources/helm.png")
            ]

            devops_team >> provisioning

        with Cluster("Secret Management"):
            secret_management = Vault("Vault")
            secret_management << Edge(
                label="collect key/value") << [Consul("Consul")] << openldap

            devops_team >> secret_management

        with Cluster("Edge Stack", direction="LR"):
示例#12
0
graph_attr = {
    # "fontsize": "45",
    # "bgcolor": "transparent"
}

with Diagram(
    "'Kitchen Sink' Sample on AWS",
    show=False,
    filename="diagram",
    graph_attr=graph_attr,
    direction="TB",
):

    with Cluster("Admin"):
        tf = Terraform("IAC")
        # docker = Docker("Docker")
        admin = User("Admin User")

    with Cluster("End Users"):
        users = Users("End Users")

    with Cluster("AWS"):

        with Cluster("VPC"):

            routetable = network.RouteTable("Route Tables")
            firewall = network.VPC("VPC Firewall Rules")

            with Cluster("Public Subnets") as public1:
                rs1 = database.Redshift("Redshift\nCluster")