-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
245 lines (218 loc) · 9.43 KB
/
index.php
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lumberjack - Ansible</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/css/bootstrap-theme.min.css" media="all">
<link rel="stylesheet" href="assets/css/bootstrap.min.css" media="all">
<!-- <link rel="stylesheet" type="text/css" href="assets/css/cosmo.bootstrap.min.css"> -->
<link rel="stylesheet" href="assets/css/styles.css" media="all">
<link href="assets/css/select2.css" rel="stylesheet"/>
<script type="text/javascript" src="assets/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/select2.min.js"></script>
<script>
$(document).ready(function() {
$('.select2-tags').select2({tags: []});
$('.select2-simple-select').select2({allowClear: true});
$('form').on('submit', function() {
var $modal = $('#modal-usage');
var hostname = $('#hostname').val();
$modal
.find('.hostname')
.text(hostname)
.parent('a')
.attr('href', 'http://' + hostname + ':1000');
$modal.modal();
});
});
</script>
</head>
<body>
<div class="container">
<div class="page-header">
<img id="logo" class="pull-left" src="assets/img/lumberjack-pattern.jpg" width="100" />
<h1>Lumberjack</h1>
<p class="lead">A custom virtual machine designed for PHP developpement with Vagrant that you can customize</small>.</p>
</div>
<form action="generator.php" method="POST">
<div class="bs-callout bs-callout-info">
<h4>An opinionated package</h4>
<p>This generator is designed to bring a <strong>Debian Wheezy 7.0</strong> virtual machine provided by VirtualBox by default and provisioned with <strong>Ansible</strong>. The couple <strong>PHP-FPM + Nginx</strong> is always included.</p>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h2>
<span class="glyphicon glyphicon-cog"></span>
Virtual machine parameters
</h2>
</div>
<div class="panel-body">
<div class="row">
<div class="form-group col-md-6">
<label for="addressip">Local VM IP address</label>
<input type="text" class="form-control" id="addressip" name="general[address_ip]" value="192.168.10.10">
<p class="help-block">You <em>should</em> use an IP from the <a href="//en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces">reserved private address space</a>.</p>
</div>
<div class="form-group col-md-6">
<label for="hostname">Host name of your application</label>
<input type="text" class="form-control" id="hostname" name="general[hostname]" value="foobar.dev">
<p class="help-block">You will have to add this host into your /etc/hosts file.</p>
</div>
</div>
<div class="row">
<div class="form-group col-md-6">
<label for="vm_name">Local VM name</label>
<input type="text" class="form-control" id="vm_name" name="general[vm_name]" value="foobar-dev">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h2>
<span class="glyphicon glyphicon-cog"></span>
Project parameters
</h2>
</div>
<div class="panel-body">
<div class="row">
<div class="form-group col-md-6">
<label for="project_name">Project name</label>
<input type="text" class="form-control" id="project_name" name="general[project_name]" value="My project">
</div>
<div class="form-group col-md-6">
<label for="framework">Framework</label>
<div>
<label>
<select name="framework" style="width:150px;" class="select2-simple-select form-control" data-placeholder="None" id="framework">
<option></option>
<option value="symfony2">Symfony 2</option>
<option value="drupal7">Drupal 7</option>
</select>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix panel panel-default">
<div class="panel-heading">
<h2><img src="assets/img/php-logo.png" alt="PHP" height="40" /></span></h2>
</div>
<div class="panel-body">
<input name="php5[enabled]" type="hidden" checked readonly value="on"/>
<div class="form-inline">
<div class="form-group">
<label>PHP Version</label>
<div>
<label class="radio-inline">
<input type="radio" name="php5[version]" value="54" checked> 5.4
</label>
<label class="radio-inline">
<input type="radio" name="php5[version]" value="55" disabled> 5.5
<span class="glyphicon glyphicon-exclamation-sign text-danger" data-toggle="tooltip" data-placement="right" title="Not supported yet"></span>
</label>
</div>
</div>
<div class="form-group">
<label>Composer</label>
<div>
<label class="checkbox-inline">
<input name="php5[composer]" type="checkbox" checked/> Install Composer
</label>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix panel panel-default">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-tower"></span> System</h2>
</div>
<div class="panel-body">
<div class="form-group">
<label for="system-package">System packages</label>
<input multiple name="system-packages" class="select2-tags form-control" id="system-package" value="curl,git,vim,htop,ncdu,wget"/>
</div>
</div>
</div>
<?php
$config = json_decode(file_get_contents(__DIR__.'/options.json'));
$options = array();
foreach ($config->components as $component) {
$options[$component->category][] = $component;
}
$i = 0;
foreach ($config->categories as $categorieKey => $categorie) :
?>
<?php if ($i % 2 === 0) : ?>
<div class="row">
<?php endif; ?>
<div class="col-md-6">
<div class="clearfix panel panel-default">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-<?php echo $categorie->glyphicon; ?>"></span> <?php echo $categorie->name; ?></h2>
</div>
<div class="panel-body">
<?php
foreach ($options[$categorieKey] as $component) :
?>
<div class="package">
<h3><img src="<?php echo $component->icon; ?>" alt="<?php echo $component->name; ?>" height="<?php echo $component->icon_height; ?>" /></h3>
<div class="checkbox">
<label>
<?php if (isset($component->supported) && false === $component->supported) : ?>
<input name="<?php echo $component->input_name; ?>[enabled]" type="checkbox" disabled/>
Install <?php echo $component->name; ?>
<span class="glyphicon glyphicon-exclamation-sign text-danger" data-toggle="tooltip" data-placement="right" title="Not supported yet"></span>
<?php else : ?>
<input name="<?php echo $component->input_name; ?>[enabled]" type="checkbox" />
Install <?php echo $component->name; ?>
<?php endif; ?>
</label>
</div>
</div>
<?php
endforeach;
?>
</div>
</div>
</div>
<?php if ($i % 2 === 1) : ?>
</div>
<?php endif; ?>
<?php
$i++;
endforeach;
?>
<p>
<button type="submit" class="btn btn-primary btn-lg">
<span class="glyphicon glyphicon-cloud-download"></span>
Generate your Vagrant/Ansible configuration
</button>
</p>
</form>
</div>
<div id="modal-usage" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Usage of the downloaded archive</h4>
</div>
<div class="modal-body">
<p>The downloaded archive is composed of 2 elements : a <code>Vagrantfile</code> and a folder called <code>ansible</code> that contains all provisionning files.</p>
<h5>What's next ?</h5>
<ul>
<li><code>vagrant up</code></li>
<li>Wait provisioning end…</li>
<li>Go to <em><code><a href="">http://<span class="hostname"></span>:1000</a></code></em>, you will see a dashboard that list tools related to components installed on the virtual machine.</li>
</ul>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>