Skip to content

Commit

Permalink
Merge branch 'mhmdio/master' into terraform-provider
Browse files Browse the repository at this point in the history
* mhmdio/master:
  bump: up to version 0.21.1
  feat(output): Generate dot file and support multi outformat.(mingrammer#441) Re (mingrammer#592)
  feat: add digitalocean provider (mingrammer#646)
  docs(website): update docs
  bump: up to version 0.21.0
  docs(readme): update badges
  docs(readme): update
  docs(readme): add digital ocean badge
  feat(provider): added DigitalOcean provider (mingrammer#621)
  feat(node): Dremio Service in OnPrem.Analytics (mingrammer#451)
  chore(deps): bump shelljs from 0.8.4 to 0.8.5 in /website (mingrammer#641)
  feat(node): add Nagios in OnPrem monitoring (mingrammer#638)
  feat(node): adding GCP API gateway image (mingrammer#636)
  feat(node): add chatbot icon (mingrammer#633)
  chore(deps): bump graphviz from 0.17 to 0.19.1 (mingrammer#635)
  feat(node): added Dapr programming runtime (mingrammer#591)
  docs: add mac dev guide (mingrammer#576)
  docs(readme): add Python 3.9 to badges (mingrammer#584)
  👌 IMPROVE: HashiCorp Icons
  📦 NEW: Add remaining HashiCorp Icons
  • Loading branch information
haad committed May 12, 2022
2 parents 86870f5 + 27fe779 commit d89326a
Show file tree
Hide file tree
Showing 67 changed files with 18,769 additions and 6,641 deletions.
42 changes: 41 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,44 @@ You should have docker installed in your system, if not click [here](https://doc
docker exec diagrams ./autogen.sh
```
6. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development.
6. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development.
## Mac local development setup
To be able to develop and run diagrams locally on you Mac device, you should have [Python](https://www.python.org/downloads/), [Go](https://golang.org/doc/install) and [brew](https://brew.sh/) installed on your system.
1. Go to diagrams root directory.
2. Install poetry, the Python project management packge used by diagrams.
```shell
pip install poetry
```
3. Install the project's Python dependencies.

```shell
poetry install
```

4. Install diagrams binary dependencies.

```shell
brew install imagemagick inkscape black
go get github.com/mingrammer/round
```

5. Run unit tests to confirm that it's working.
```shell
python -m unittest tests/*.py -v
```
6. Run the bash script `autogen.sh` to test.
```shell
./autogen.sh
```
7. If the unit tests and the bash script `autogen.sh` is working correctly, then your system is now ready for development.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
[![pypi version](https://badge.fury.io/py/diagrams.svg)](https://badge.fury.io/py/diagrams)
![python version](https://img.shields.io/badge/python-3.6%2C3.7%2C3.8-blue?logo=python)
![python version](https://img.shields.io/badge/python-%3E%3D%203.6-blue?logo=python)
![Run tests](https://github.com/mingrammer/diagrams/workflows/Run%20tests/badge.svg?branch=master)
[![todos](https://badgen.net/https/api.tickgit.com/badgen/github.com/mingrammer/diagrams?label=todos)](https://www.tickgit.com/browse?repo=github.com/mingrammer/diagrams)
![contributors](https://img.shields.io/github/contributors/mingrammer/diagrams)
Expand All @@ -26,10 +26,11 @@ Diagrams lets you draw the cloud system architecture **in Python code**. It was
![gcp provider](https://img.shields.io/badge/GCP-orange?logo=google-cloud&color=4285f4)
![ibm provider](https://img.shields.io/badge/IBM-orange?logo=ibm&color=052FAD)
![kubernetes provider](https://img.shields.io/badge/Kubernetes-orange?logo=kubernetes&color=326ce5)
![alibaba cloud provider](https://img.shields.io/badge/AlibabaCloud-orange)
![alibaba cloud provider](https://img.shields.io/badge/AlibabaCloud-orange?logo=alibaba-cloud&color=ff6a00)
![oracle cloud provider](https://img.shields.io/badge/OracleCloud-orange?logo=oracle&color=f80000)
![openstack provider](https://img.shields.io/badge/OpenStack-orange?logo=openstack&color=da1a32)
![firebase provider](https://img.shields.io/badge/Firebase-orange?logo=firebase&color=FFCA28)
![digital ocean provider](https://img.shields.io/badge/DigitalOcean-0080ff?logo=digitalocean&color=0080ff)
![elastic provider](https://img.shields.io/badge/Elastic-orange?logo=elastic&color=005571)
![outscale provider](https://img.shields.io/badge/OutScale-orange?color=5f87bf)
![on premise provider](https://img.shields.io/badge/OnPremise-orange?color=5f87bf)
Expand Down
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
app_root_dir="diagrams"

# NOTE: azure icon set is not latest version
providers=("onprem" "aws" "azure" "gcp" "ibm" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale" "terraform")
providers=("onprem" "aws" "azure" "gcp" "ibm" "digitalocean" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale" "terraform")

if ! [ -x "$(command -v round)" ]; then
echo 'round is not installed'
Expand Down
9 changes: 7 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DIR_TEMPLATE = "templates"

PROVIDERS = (
"base", "onprem", "aws", "azure", "gcp", "ibm", "firebase", "k8s", "alibabacloud", "oci", "programming", "saas", "elastic",
"base", "onprem", "aws", "azure", "gcp", "ibm", "digitalocean", "firebase", "k8s", "alibabacloud", "oci", "programming", "saas", "elastic",
"generic", "openstack", "outscale", "terraform", "tencentcloud")

#########################
Expand All @@ -30,6 +30,7 @@
"onprem": (),
"aws": ("Amazon-", "AWS-"),
"azure": ("Azure-",),
"digitalocean": (),
"gcp": ("Cloud-",),
"firebase": ("Cloud-",),
"ibm": (),
Expand Down Expand Up @@ -63,7 +64,7 @@

UPPER_WORDS = {
"aws": ("aws", "api", "ebs", "ec2", "efs", "emr", "rds", "ml", "mq", "nat", "vpc", "waf", "sdk"),
"azure": ("ad", "b2c", "ai", "api", "cdn", "ddos", "dns", "fxt", "hana", "hd", "id", "sap", "sql", "vm"),
"azure": ("ad", "b2c", "ai", "api", "cdn", "ddos", "dns", "fxt", "hana", "hd", "id", "sap", "sql", "vm", "vpn", "vpc"),
"gcp": ("gcp", "ai", "api", "cdn", "dns", "gke", "gpu", "iap", "ml", "nat", "os", "sdk", "sql", "tpu", "vpn"),
"firebase": ("ab", "fcm", "ml"),
"k8s": (
Expand All @@ -89,6 +90,9 @@
"aws": {
"cloudfront": "CloudFront"
},
"digitalocean": {
"digitalocean": "DigitalOcean"
},
"openstack": {
"openstack": "OpenStack"
},
Expand Down Expand Up @@ -398,6 +402,7 @@
"ObjectTableStore": "OTS",
}
},
"digitalocean": {},
"oci": {
"compute": {
"VM": "VirtualMachine",
Expand Down
40 changes: 18 additions & 22 deletions diagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def setcluster(cluster):
class Diagram:
__directions = ("TB", "BT", "LR", "RL")
__curvestyles = ("ortho", "curved")
__outformats = ("png", "jpg", "svg", "pdf")
__outformats = ("png", "jpg", "svg", "pdf", "dot")

# fmt: off
_default_graph_attrs = {
Expand Down Expand Up @@ -127,8 +127,13 @@ def __init__(
raise ValueError(f'"{curvestyle}" is not a valid curvestyle')
self.dot.graph_attr["splines"] = curvestyle

if not self._validate_outformat(outformat):
raise ValueError(f'"{outformat}" is not a valid output format')
if isinstance(outformat, list):
for one_format in outformat:
if not self._validate_outformat(one_format):
raise ValueError(f'"{one_format}" is not a valid output format')
else:
if not self._validate_outformat(outformat):
raise ValueError(f'"{outformat}" is not a valid output format')
self.outformat = outformat

# Merge passed in attributes
Expand All @@ -155,25 +160,13 @@ def _repr_png_(self):
return self.dot.pipe(format="png")

def _validate_direction(self, direction: str) -> bool:
direction = direction.upper()
for v in self.__directions:
if v == direction:
return True
return False
return direction.upper() in self.__directions

def _validate_curvestyle(self, curvestyle: str) -> bool:
curvestyle = curvestyle.lower()
for v in self.__curvestyles:
if v == curvestyle:
return True
return False
return curvestyle.lower() in self.__curvestyles

def _validate_outformat(self, outformat: str) -> bool:
outformat = outformat.lower()
for v in self.__outformats:
if v == outformat:
return True
return False
return outformat.lower() in self.__outformats

def node(self, nodeid: str, label: str, **attrs) -> None:
"""Create a new node."""
Expand All @@ -188,7 +181,11 @@ def subgraph(self, dot: Digraph) -> None:
self.dot.subgraph(dot)

def render(self) -> None:
self.dot.render(format=self.outformat, view=self.show, quiet=True)
if isinstance(self.outformat, list):
for one_format in self.outformat:
self.dot.render(format=one_format, view=self.show, quiet=True)
else:
self.dot.render(format=self.outformat, view=self.show, quiet=True)


class Cluster:
Expand Down Expand Up @@ -263,9 +260,8 @@ def __exit__(self, exc_type, exc_value, traceback):

def _validate_direction(self, direction: str):
direction = direction.upper()
for v in self.__directions:
if v == direction:
return True
if direction in self.__directions:
return True
return False

def node(self, nodeid: str, label: str, **attrs) -> None:
Expand Down
4 changes: 4 additions & 0 deletions diagrams/aws/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class AutoScaling(_Management):
_icon = "auto-scaling.png"


class Chatbot(_Management):
_icon = "chatbot.png"


class CloudformationChangeSet(_Management):
_icon = "cloudformation-change-set.png"

Expand Down
12 changes: 12 additions & 0 deletions diagrams/digitalocean/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
DigitalOcean provides a set of services for DigitalOcean provider.
"""

from diagrams import Node


class _DigitalOcean(Node):
_provider = "digitalocean"
_icon_dir = "resources/digitalocean"

fontcolor = "#ffffff"
43 changes: 43 additions & 0 deletions diagrams/digitalocean/compute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.

from . import _DigitalOcean


class _Compute(_DigitalOcean):
_type = "compute"
_icon_dir = "resources/digitalocean/compute"


class Containers(_Compute):
_icon = "containers.png"


class Docker(_Compute):
_icon = "docker.png"


class DropletConnect(_Compute):
_icon = "droplet-connect.png"


class DropletSnapshot(_Compute):
_icon = "droplet-snapshot.png"


class Droplet(_Compute):
_icon = "droplet.png"


class K8SCluster(_Compute):
_icon = "k8s-cluster.png"


class K8SNodePool(_Compute):
_icon = "k8s-node-pool.png"


class K8SNode(_Compute):
_icon = "k8s-node.png"


# Aliases
27 changes: 27 additions & 0 deletions diagrams/digitalocean/database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.

from . import _DigitalOcean


class _Database(_DigitalOcean):
_type = "database"
_icon_dir = "resources/digitalocean/database"


class DbaasPrimaryStandbyMore(_Database):
_icon = "dbaas-primary-standby-more.png"


class DbaasPrimary(_Database):
_icon = "dbaas-primary.png"


class DbaasReadOnly(_Database):
_icon = "dbaas-read-only.png"


class DbaasStandby(_Database):
_icon = "dbaas-standby.png"


# Aliases
47 changes: 47 additions & 0 deletions diagrams/digitalocean/network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.

from . import _DigitalOcean


class _Network(_DigitalOcean):
_type = "network"
_icon_dir = "resources/digitalocean/network"


class Certificate(_Network):
_icon = "certificate.png"


class DomainRegistration(_Network):
_icon = "domain-registration.png"


class Domain(_Network):
_icon = "domain.png"


class Firewall(_Network):
_icon = "firewall.png"


class FloatingIp(_Network):
_icon = "floating-ip.png"


class InternetGateway(_Network):
_icon = "internet-gateway.png"


class LoadBalancer(_Network):
_icon = "load-balancer.png"


class ManagedVpn(_Network):
_icon = "managed-vpn.png"


class Vpc(_Network):
_icon = "vpc.png"


# Aliases
27 changes: 27 additions & 0 deletions diagrams/digitalocean/storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This module is automatically generated by autogen.sh. DO NOT EDIT.

from . import _DigitalOcean


class _Storage(_DigitalOcean):
_type = "storage"
_icon_dir = "resources/digitalocean/storage"


class Folder(_Storage):
_icon = "folder.png"


class Space(_Storage):
_icon = "space.png"


class VolumeSnapshot(_Storage):
_icon = "volume-snapshot.png"


class Volume(_Storage):
_icon = "volume.png"


# Aliases
4 changes: 4 additions & 0 deletions diagrams/gcp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class _API(_GCP):
_icon_dir = "resources/gcp/api"


class APIGateway(_API):
_icon = "api-gateway.png"


class Endpoints(_API):
_icon = "endpoints.png"

Expand Down
4 changes: 4 additions & 0 deletions diagrams/onprem/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Dbt(_Analytics):
_icon = "dbt.png"


class Dremio(_Analytics):
_icon = "dremio.png"


class Flink(_Analytics):
_icon = "flink.png"

Expand Down
Loading

0 comments on commit d89326a

Please sign in to comment.