This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 641
/
Copy pathdashboard.html.j2
380 lines (355 loc) · 13.5 KB
/
dashboard.html.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<head>
<title>Drupal VM</title>
<meta charset="utf-8">
<link rel="shortcut icon" href="//cdn.rawgit.com/geerlingguy/drupalvm.github.io/master/favicon.ico" type="image/vnd.microsoft.icon" />
<style>
.section-host {
font-family: monospace;
list-style-type: none;
padding: 0;
margin: 0;
}
/* minor fallback styling for when loaded without an internet connection */
.card, .jumbotron {
margin-bottom: 20px;
}
td, th {
padding: 8px;
}
</style>
</head>
<body>
{# Sets vagrant IP if equals 0.0.0.0 #}
{%- if vagrant_ip == '0.0.0.0' -%}
{%- set vagrant_ip = ansible_all_ipv4_addresses[1] -%}
{%- endif -%}
{# Returns the hosts server name based on the document root #}
{%- macro getServernameFromDocroot(path) -%}
{%- if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{%- if host.documentroot == path -%}
{{ host.servername }}
{%- endif -%}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{%- if host.root == path -%}
{{ host.server_name }}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- macro printSite(servername, docroot) -%}
{%- if docroot not in _devtool_docroots -%}
<tr>
<td><a href="http://{{ servername }}">{{ servername }}</a></td>
<td><code>{{ docroot }}</code></td>
{% if configure_drush_aliases %}
<td><code>drush @{{ vagrant_machine_name }}.{{ servername }}</code></td>
{% endif %}
</tr>
{% endif %}
{%- endmacro %}
{%- macro printHostsEntry(ip, servername) -%}
{%- if servername != ip -%}
<li>{{ ip }} {{ servername }}</li>
{%- endif -%}
{%- endmacro %}
{%- macro sectionHost() -%}
<ul class="section-host">
{% if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{{ printHostsEntry(vagrant_ip, host.servername) }}
{% if host.serveralias is defined -%}
{%- for alias in host.serveralias.split() -%}
{{ printHostsEntry(vagrant_ip, alias) }}
{%- endfor -%}
{%- endif %}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{% for server_name in host.server_name.split(' ') -%}
{{ printHostsEntry(vagrant_ip, server_name) }}
{%- endfor %}
{% if host.server_name_redirect is defined -%}
{%- for server_name in host.server_name_redirect.split(' ') -%}
{{ printHostsEntry(vagrant_ip, server_name) }}
{%- endfor -%}
{%- endif %}
{%- endfor -%}
{%- endif %}
</ul>
{%- endmacro -%}
{%- macro sectionSiteList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Hostname</th>
<th>Document Root</th>
{% if configure_drush_aliases -%}
<th>Drush alias*</th>
{%- endif %}
</tr>
</thead>
<tbody>
{% if drupalvm_webserver == 'apache' -%}
{%- for host in apache_vhosts -%}
{%- if host.documentroot is defined -%}
{{ printSite(host.servername, host.documentroot) }}
{%- endif -%}
{%- endfor -%}
{%- elif drupalvm_webserver == 'nginx' -%}
{%- for host in nginx_vhosts -%}
{%- if host.root is defined -%}
{%- for hostname in host.server_name.split() -%}
{{ printSite(hostname, host.root) }}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endif %}
<tr><td colspan=3><small>*Note: If Ansible isn't installed on your host, Drush aliases are only created inside the VM.</small></td></tr>
</tbody>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDevelopmentTools() -%}
<div class="table-responsive">
<table class="table">
{% if not installed_extras -%}
<tr>
<td>There are no development tools installed inside the VM.</td>
</tr>
{%- endif -%}
{% if 'adminer' in installed_extras -%}
{% macro servername() %}{{ getServernameFromDocroot(adminer_install_dir) }}/{{ adminer_install_filename }}{% endmacro %}
{%- if servername() != "/{{ adminer_install_filename }}" -%}
<tr>
<th>Adminer</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/mysql/#connect-using-adminer" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
{% if 'mailhog' in installed_extras -%}
{% macro servername() %}{{ vagrant_hostname }}:8025{% endmacro %}
{%- if servername() != ":8025" -%}
<tr>
<th>MailHog</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/mailhog/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
{% if 'solr' in installed_extras -%}
{% macro servername() %}{{ vagrant_hostname }}:{{ solr_port }}/solr/{% endmacro %}
<tr>
<th>Solr</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/solr/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif %}
{% if 'xhprof' in installed_extras -%}
{% macro servername() %}{{ getServernameFromDocroot(php_xhprof_html_dir) }}{% endmacro %}
{%- if servername() -%}
<tr>
<th>XHProf</th>
<td><a href="http://{{ servername() }}">{{ servername() }}</a>
</br>
<a href="http://{{ servername() }}" class="btn btn-success btn-xs" role="button">Open</a>
<a href="http://docs.drupalvm.com/en/latest/extras/xhprof/" target="_blank" class="btn btn-info btn-xs" role="button">Documentation</a>
</td>
</tr>
{%- endif -%}
{%- endif %}
</table>
</div>
{%- endmacro -%}
{%- macro sectionPhpInformation() -%}
<div class="table-responsive">
<table class="table">
<tr>
<th>PHP Version</th>
<td><code>{{ php_version }}</code></td>
</tr>
<tr>
<th>Webserver</th>
<td><code>{{ drupalvm_webserver|capitalize }}</code></td>
</tr>
<tr>
<th>Memory limit</th>
<td><code>{{ php_memory_limit }}</code></td>
</tr>
<tr>
<th>PHP-FPM enabled</th>
<td><code>{{ 'yes' if php_enable_php_fpm else 'no' }}</code></td>
</tr>
<tr><td colspan=2><small><a href="/server-info.php">View more details in the server's phpinfo() report</a>.</small></td></tr>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDatabaseConnection() -%}
<div class="table-responsive">
<table class="table">
<tr>
<th>MySQL Hostname</th>
<td><code>127.0.0.1</code></td>
</tr>
<tr>
<th>MySQL Port</th>
<td><code>{{ mysql_port }}</code></td>
</tr>
<tr>
<th>MySQL Username</th>
<td><code>{{ mysql_root_username }}</code></td>
</tr>
<tr>
<th>MySQL Password</th>
<td><code>{{ mysql_root_password }}</code></td>
</tr>
<tr>
<th>SSH Hostname</th>
<td><code>{{ vagrant_ip }}</code></td>
</tr>
<tr>
<th>SSH Username</th>
<td><code>{{ vagrant_user }}</code></td>
</tr>
<tr>
<th>SSH Private Key</th>
<td><code>~/.vagrant.d/insecure_private_key</code></td>
</tr>
</table>
</div>
{%- endmacro -%}
{%- macro sectionDatabaseList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<tbody>
{% for database in mysql_databases -%}
{% if 'adminer' in installed_extras -%}
<tr>
<td>
<a href="http://{{ getServernameFromDocroot(adminer_install_dir) }}/{{ adminer_install_filename }}?username={{ mysql_root_username }}&db={{ database.name }}" class="btn btn-success btn-xs" role="button">{{ database.name }}</a>
</td>
</tr>
{% else -%}
<tr>
<td>{{ database.name }}</td>
</tr>
{%- endif %}
{%- endfor %}
</tbody>
</table>
</div>
{%- endmacro -%}
{%- macro SectionDatabaseListLabel() -%}
{% if 'adminer' in installed_extras -%}
Databases using Adminer
{% else -%}
Databases
{%- endif %}
{%- endmacro -%}
{%- macro sectionDatabaseUserList() -%}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Username</th>
<th>Password</th>
</tr>
</thead>
<tbody>
{% for user in mysql_users -%}
<tr>
<td><code>{{ user.name }}</code></td>
<td><code>{{ user.password }}</code></td>
</tr>
{%- endfor %}
</tbody>
</table>
</div>
{%- endmacro -%}
<div class="container">
<div class="row">
<div class="col-md-12">
<section class="jumbotron text-center">
<a href="https://www.drupalvm.com/"><img src="http://docs.drupalvm.com/en/latest/images/drupal-vm-logo.png" alt="Drupal VM" title="Welcome to Drupal VM" class="img-responsive center-block"></a>
<p class="lead"><a href="https://github.com/geerlingguy/drupal-vm">Drupal VM</a> is a VM for local Drupal development, built with Vagrant + Ansible.</p>
<p><small>Machine name: <strong>{{ vagrant_machine_name }}</strong></small></p>
<p><a class="btn btn-primary btn-lg" href="http://docs.drupalvm.com/en/latest/" role="button">Read the documentation</a></p>
</section>
</div>
</div>
<div class="row">
<div class="col-md-9">
<section class="card">
<div class="card-header">Your sites</div>
<div class="card-body">
{{ sectionSiteList() }}
</div>
</section>
</div>
<div class="col-md-3">
<section class="card">
<div class="card-header"> {{ SectionDatabaseListLabel() }}</div>
<div class="card-body">
{{ sectionDatabaseList() }}
{{ sectionDatabaseUserList() }}
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-md-3">
<section class="card">
<div class="card-header">PHP information</div>
<div class="card-body">
{{ sectionPhpInformation() }}
</div>
</section>
</div>
<div class="col-md-6">
<section class="card">
<div class="card-header">MySQL connection information</div>
<div class="card-body">
{{ sectionDatabaseConnection() }}
</div>
</section>
</div>
<div class="col-md-3">
<section class="card">
<div class="card-header">Development tools</div>
<div class="card-body">
{{ sectionDevelopmentTools() }}
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-md-12">
<section class="card">
<div class="card-header">/etc/hosts</div>
<div class="card-body">
<section class="card small">
{{ sectionHost() }}
</section>
<small>Unless you're using the <a href="https://github.com/cogitatio/vagrant-hostsupdater" target="_blank">vagrant-hostsupdater</a> or <a href="https://github.com/smdahlen/vagrant-hostmanager" target="_blank">vagrant-hostmanager</a> plugin, add the lines above to your host machine's hosts file.</small>
</div>
</section>
</div>
</div>
</div>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</body>
</html>