| %s |
| %s |
| `) 24 | sb.WriteString(strconv.Itoa(num)) 25 | sb.WriteString(" |
| ") 31 | sb.WriteString(lab) 32 | sb.WriteString(" |
draft input.yml | dot -Tpng > output.png |
35 | | JPEG | draft input.yml | dot -Tjpg > output.jpg |
36 | | PostScript | draft input.yml | dot -Tps > output.ps |
37 | | SVG | draft input.yml | dot -Tsvg > output.svg |
38 |
39 | To install GraphViz to your favorite OS, please, follow this link [https://graphviz.gitlab.io/download/](https://graphviz.gitlab.io/download/).
40 |
41 | # Installation Steps
42 |
43 | To build the binaries by yourself, assuming that you have `Go` installed, here the steps:
44 |
45 | Clone the repo,
46 | ```psh
47 | git clone https://github.com/lucasepe/draft.git
48 | ```
49 |
50 | Move to the 'cmd' directory:
51 | ```psh
52 | cd draft/cmd
53 | ```
54 |
55 | Generate the static assets
56 | ```psh
57 | go generate ../...
58 | ```
59 |
60 | Build the binary tool
61 | ```psh
62 | go build -o draft
63 | ```
64 |
65 | # Components
66 |
67 | The basic unit of each _draft_ design is the `component`, has these attributes:
68 |
69 | | Name | Required | Scope | Notes |
70 | |:----------|:--------:|:------------------------------|---------------------------------------------------------|
71 | | id | no | used for the connecttions | autogenerated if omitted (read more for details...) |
72 | | kind | yes | identify the component type | see [all available kinds](#list-of-all-available-kinds) |
73 | | provider | no | get the specific provider icon| see [using custom icons](#using-custom-icons) |
74 | | label | no | text below the component icon | can contain basic HTML tags |
75 | | outline | no | tag to group components | |
76 | | impl | no | text above the icon | can use this to specify the provider implementation |
77 | | fontColor | no | the label text color | hex color code - supports transparency too |
78 |
79 | ### Notes about a component `id`
80 |
81 | - you can define your component `id` explicitly (i.e. _id: MY_SERVICE_A_)
82 | - or you can omit the component `id` attribute and it will be autogenerated
83 |
84 | ### How is auto-generated a component `id`?
85 |
86 | An auto-generated component `id` has a prefix and a sequential number
87 |
88 | - the prefix is related to the component `kind`
89 | - examples _waf1, ..., wafN_ or _ser1, ..., serN_ etc.
90 |
91 | # List of all available kinds
92 |
93 | Draft uses a set of symbols independent from the different providers (AWS, Microsoft Azure, GCP).
94 |
95 | Below is a list of all the components currently implemented.
96 |
97 | ## Clients
98 |
99 | Sample YAML file [examples/clients.yml](./examples/clients.yml).
100 |
101 | ```bash
102 | draft -impl -verbose examples/clients.yml | dot -Gdpi=110 -Tpng > examples/clients.png
103 | ```
104 |
105 | 
106 |
107 | ## Networking
108 |
109 | Sample YAML file [examples/networking.yml](./examples/networking.yml).
110 |
111 | ```bash
112 | draft -impl -verbose examples/networking.yml | dot -Gdpi=110 -Tpng > examples/networking.png
113 | ```
114 |
115 | 
116 |
117 | ## Compute
118 |
119 | Sample YAML file [examples/compute.yml](./examples/compute.yml).
120 |
121 | ```bash
122 | draft -impl -verbose examples/compute.yml | dot -Gdpi=110 -Tpng > examples/compute.png
123 | ```
124 |
125 | 
126 |
127 | ## Database
128 |
129 | Sample YAML file [examples/database.yml](./examples/database.yml).
130 |
131 | ```bash
132 | draft -impl -verbose examples/database.yml | dot -Gdpi=110 -Tpng > examples/database.png
133 | ```
134 |
135 | 
136 |
137 | ## Storage
138 |
139 | Sample YAML file [examples/storage.yml](./examples/storage.yml).
140 |
141 | ```bash
142 | draft -impl -verbose examples/storage.yml | dot -Gdpi=110 -Tpng > examples/storage.png
143 | ```
144 |
145 | 
146 |
147 | ## Security
148 |
149 | Sample YAML file [examples/security.yml](./examples/security.yml).
150 |
151 | ```bash
152 | draft -impl -verbose examples/security.yml | dot -Gdpi=110 -Tpng > examples/security.png
153 | ```
154 |
155 | 
156 |
157 | # Using custom icons
158 |
159 | Here how to render components with specific _aws_, _google_ and _azure_ icons.
160 |
161 | 1. Download the PNG icons of your cloud provider [AWS](https://aws.amazon.com/it/architecture/icons/), [GCP](https://cloud.google.com/icons), [Azure](https://www.microsoft.com/en-us/download/details.aspx?id=41937)
162 |
163 | 2. Take only the icons related to the [components supported](#list-of-all-available-kinds) by [draft](https://github.com/lucasepe/draft/releases/latest)
164 |
165 | 3. Make a directory with the provider name (i.e. `/draft/icons/aws`, `/draft/icons/google`, `/draft/icons/azure`)
166 |
167 | 4. Rename each icon as [draft](https://github.com/lucasepe/draft/releases/latest) components `kind` (i.e. `dns.png`, `cdn.png` and so on...)
168 |
169 | 5. Run [draft](https://github.com/lucasepe/draft/releases/latest) specifyng the icons folder using the environment variable `DRAFT_ICONS_PATH`
170 | - example: `DRAFT_ICONS_PATH=/draft/icons draft my-file.yml | dot > ark-aws.png`
171 |
172 | 👉 I have already done all the work for points 1 to 4. So you can avoid it by copying the directory [icons](./icons) 👈
173 |
174 |
175 | # Connections
176 |
177 | The arrows that join the components.
178 |
179 | To connect an _origin_ component with one or more _targets_ component you need to specify at least each `id`.
180 |
181 | A _connection_ has the following properties:
182 |
183 | | Attribute | Type | Required | What is it? |
184 | |:----------|:--------:|:--------:|--------------------------------|
185 | | origin | string | yes | id of the starting component |
186 | | targets | object | yes | one or more destinations |
187 |
188 | Each _target_ has the following properties:
189 |
190 | | Attribute | Type | Required | What is it? |
191 | |:---------------|:--------:|:--------:|---------------------------------------------------|
192 | | id | string | yes | target component id |
193 | | label | string | no | text on the connection |
194 | | labeldistance | float | no | distance of the label from the connection tail |
195 | | labelangle | float | no | determine the label position relative to the tail |
196 | | minlen | float | no | sets the minimum connection length |
197 | | num | int | no | usefult to track an order path on your graph |
198 | | color | string | no | label color (hex color string) |
199 | | dashed | bool | no | if true the connection line will be dashed |
200 | | dir | string | no | arrows direction (forward, back, both, none) |
201 | | highlight | bool | no | if true makes the arrow thicker |
202 |
203 |
204 | Sample YAML file [examples/connections.yml](./examples/connections.yml).
205 |
206 | ```bash
207 | draft examples/connections.yml | dot -Gdpi=110 -Tpng > examples/connections.png
208 | ```
209 |
210 | 
211 |
212 |
213 | [](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Flucasepe%2Fdraft)
214 |
215 | ---
216 |
217 | ## Changelog
218 |
219 | 👉 [Record of all notable changes made to a project](./CHANGELOG.md)
220 |
221 | ---
222 |
223 | ## Examples
224 |
225 | 👉 [Collection of draft architecture descriptor YAML files](./examples/README.md)
226 |
227 | ---
228 |
229 | (c) 2020 Luca Sepe http://lucasepe.it. MIT License
230 |
--------------------------------------------------------------------------------