-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.html
604 lines (593 loc) · 24 KB
/
doc.html
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta name="robots" content="index,follow">
<meta name="keywords" content="devops,migration,server,virtual machine,docker,container,alternative,chef,puppet,ansible,saltstack,lightweight,python,open source,github">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Server Mechanic is a tool to apply migration scripts to your machine step by step in a reliable way.">
<meta name="author" content="Cornelius Buschka, Server Mechanic Team">
<link rel="icon" href="../../favicon.ico">
<title>Server Mechanic - Server Evolution Made Easy</title>
<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="server-mechanic.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"><a id="logo" href="/"><img alt="Logo" src="images/mechanic_logo.png"></a></div>
<div class="navbar col-xs-10 col-sm-10 col-md-10 col-lg-10"><ul class="nav nav-pills">
<li><a href="index.html">Home</a></li>
<li><a href="quickstart.html">Quickstart</a></li>
<li class="active"><a href="doc.html">Docs</a></li>
<li><a href="project.html">Project</a></li>
</ul></div>
</div>
<a id="doc"></a><div class="row">
<div class="col-lg-12">
<h1>
<a id="documentation"></a>Documentation</h1>
<p>If you want to manage your machines (bare metal, virtual machines, containers or simply workspaces) in a
reproducable way, one strategy is the creation of "infrastructure as code". Server Mechanic executes
this code and so your infrastructure is created or changed.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>How it works</h2>
<h4>Server Mechanic for servers and virtual machines</h4>
<p>With Server Mechanic you author changes to your machines as scripts in your favorite language, e.g. shell
scripts. Server Mechanic collects these migration scripts, executes them and records them as applied in
an internal database. Next time only new migrations will be executed. In case of an error you fix the
problem and start over.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h4>Server Mechanic for Docker containers</h4>
<p>Docker already utilizes the step by step approach with the commands in your Dockerfile. These commands
are run at container image build time. So you have full access to the container's internal state. But
external volumes cannot be manipulated by Dockerfile commands. Here Server Mechanic comes into play.
</p>
<p>Server Mechanic is started on container startup, applies your migration which migrates the state in your
volumes, then container startup proceeds. So you can roll out adjustments to external volumes with new
container versions and containers and volumes stay in sync.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>Supported Platforms</h2>
<table class="table table-bordered table-striped" id="platform-support">
<tr>
<td>OS</td>
<td>Dist.</td>
<td>Version</td>
<td>Arch.</td>
<td>Supported</td>
<td>Notes</td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>xenial (16.04)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>xenial (16.04)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>yakkety (16.10)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>yakkety (16.10)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>zesty (17.04)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>zesty (17.04)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>artful (17.10)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>artful (17.10)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>bionic (18.04)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Ubuntu</td>
<td>bionic (18.04)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>wheezy (7)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>wheezy (7)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>jessie (8)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td>
<a href="https://github.com/server-mechanic/mechanic/issues/5" target="_blank">Package install
broken!
</a>
</td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>jessie (8)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td>
<a href="https://github.com/server-mechanic/mechanic/issues/5" target="_blank">Package install
broken!
</a>
</td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>stretch (9)</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>stretch (9)</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>sid (10)</td>
<td>i386</td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Debian</td>
<td>sid (10)</td>
<td>amd64</td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>25</td>
<td>i386</td>
<td class="unsupported">EOL</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>25</td>
<td>amd64</td>
<td class="unsupported">EOL</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>26</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>26</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>27</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>27</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>28</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Fedora</td>
<td>28</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Centos</td>
<td>7</td>
<td>i386</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Centos</td>
<td>7</td>
<td>amd64</td>
<td class="supported">Yes</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>SuSE</td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>Linux</td>
<td>Arch</td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>BSD</td>
<td></td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>OSX</td>
<td></td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>Solaris</td>
<td></td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
<tr>
<td>Windows</td>
<td></td>
<td></td>
<td></td>
<td class="unsupported">Not yet</td>
<td></td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>
<a id="installation"></a>Installation</h2>
<p>The easiest way to install Server Mechanic is the installer script. No magic, the installer script</p>
<ul>
<li>adds a package repository to your system</li>
<li>and installs the mechanic package.</li>
</ul>
<p>Execute the install script via the following command:</p>
<pre class="code">
curl -s https://raw.githubusercontent.com/server-mechanic/packages/master/install-mechanic.sh | sudo bash -s unstable
</pre>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>CLI - Sub Commands and Options</h2>
<table class="table table-striped table-bordered">
<tr>
<td>Command</td>
<td>Option</td>
<td>Since</td>
<td>Example</td>
<td>Description</td>
</tr>
<tr>
<td>(all)</td>
<td>-v</td>
<td>0.1</td>
<td></td>
<td>Be verbose, increase logging output.</td>
</tr>
<tr>
<td>migrate</td>
<td></td>
<td>0.1</td>
<td>mechanic migrate</td>
<td>Apply pending migrations.</td>
</tr>
<tr>
<td></td>
<td></td>
<td>0.1</td>
<td>mechanic -v migrate -- /entrypoint.sh param=value</td>
<td>Execute follow up command if all migrations have been successfully applied.</td>
</tr>
<tr>
<td>list-migrations</td>
<td></td>
<td>0.1</td>
<td>mechanic list-migrations</td>
<td>List migrations with status as if recorded in internal database.</td>
</tr>
<tr>
<td></td>
<td>--order-by=id|start_date</td>
<td>0.1</td>
<td>mechanic list-migrations --order-by=id</td>
<td>Specify order for migrations list.
<br>
If unspecified, order is by start_date.
</td>
</tr>
<tr>
<td>help</td>
<td></td>
<td>0.1</td>
<td>mechanic help</td>
<td>Print sub commands and options.</td>
</tr>
<tr>
<td>version</td>
<td></td>
<td>0.1</td>
<td>mechanic version</td>
<td>Print version information.</td>
</tr>
</table>
<h3>Environment Variables</h3>
<table class="table table-striped table-bordered">
<tr>
<td>Environment Variable</td>
<td>Since</td>
<td>Example</td>
<td>Description</td>
</tr>
<tr>
<td>MECHANIC_ROOT_DIR</td>
<td>0.1</td>
<td>/home/developer/test-dir</td>
<td>Root directory for execution. This is mainly used for integration testing.</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>The Configuration - /etc/mechanic.conf</h2>
<pre class="code"># /etc/mechanic.conf
[main]
log_file=/mechanic.volume/log/mechanic.log
pre_migration_dirs=/var/lib/mechanic/pre-migration.d/
migration_dirs=/var/lib/mechanic/migration.d/
post_migration_dirs=/var/lib/mechanic/post-migration.d/
run_dir=/mechanic.volume/tmp/
state_dir=/mechanic.volume/state
</pre>
<h3>Configuration Options</h3>
<table class="table table-striped table-bordered">
<tr>
<td>Option</td>
<td>Since</td>
<td>Default</td>
<td>Example</td>
<td>Description</td>
</tr>
<tr>
<td>log_file</td>
<td>0.1</td>
<td>${MECHANIC_ROOT_DIR}/var/log/mechanic.log</td>
<td>/var/log/mechanic.log<br>/dev/stderr
</td>
<td>File mechanic writes log messages to.</td>
</tr>
<tr>
<td>pre_migration_dirs</td>
<td>0.4</td>
<td>${MECHANIC_ROOT_DIR}/etc/mechanic/pre-migration.d/: \<br>
${MECHANIC_ROOT_DIR}/var/lib/mechanic/pre-migration.d
</td>
<td></td>
<td>Colon seperated list of pathes mechanic collects pre migration scripts from.</td>
</tr>
<tr>
<td>migration_dirs</td>
<td>0.1</td>
<td>${MECHANIC_ROOT_DIR}/etc/mechanic/migration.d/: \<br>
${MECHANIC_ROOT_DIR}/var/lib/mechanic/migration.d
</td>
<td></td>
<td>Colon seperated list of pathes mechanic collects the migration scripts from.</td>
</tr>
<tr>
<td>post_migration_dirs</td>
<td>0.4</td>
<td>${MECHANIC_ROOT_DIR}/etc/mechanic/post-migration.d/: \<br>
${MECHANIC_ROOT_DIR}/var/lib/mechanic/post-migration.d
</td>
<td></td>
<td>Colon seperated list of pathes mechanic collects post migration scripts from.</td>
</tr>
<tr>
<td>run_dir</td>
<td>0.4</td>
<td>${MECHANIC_ROOT_DIR}/var/lib/mechanic/tmp</td>
<td>/var/lib/mechanic/tmp<br>/tmp
</td>
<td>Location for migration execution directories.<br>When a migration failed diagnostic data can be
found here. (So /tmp is a moderate choice.)
</td>
</tr>
<tr>
<td>state_dir</td>
<td>0.1</td>
<td>${MECHANIC_ROOT_DIR}/var/lib/mechanic/state</td>
<td></td>
<td>Location where Server Mechanic stores the migration state. Currently the migration state is
stored in a sqlite database named inventory.db below this directory.
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h1>
<a id="development"></a>Development
</h1>
<p>Server Mechanic is written in python. (Early versions where based on Go, C and C++.)</p>
<p>Unit tests are written with the python mock lib. (Everything testable <i>should</i> be tested via a unit
test.)
</p>
<p>Integration tests are currently based on a set of custom shell scripts performing the following steps to
verify several scenarios (There is a real chance that we switch to docker containers in the near future
- for now the setup is sufficient.):
</p>
<ul>
<li>Setup a test scenario based on files in a temporary folder.</li>
<li>Run the mechanic in this temporary folder utilizing MECHANIC_ROOT_DIR to change mechanic root.</li>
<li>Then exit code, contents of the test file system, the internal state of the mechanic database are
merged into an output listing.
</li>
<li>The output listing is compared to the expected output.</li>
</ul>
<h2>Prerequesites</h2>
<h3>Install system packages</h3>
<pre class="code"># RedHat/ CentOS/ Fedora
yum -y install python sqlite sqlite-devel make git
# Debian/ Ubuntu
apt-get install -y python2.7 sqlite3 sqlite3-dev make
</pre>
<h3>Install python packages</h3>
<pre class="code">pip install mock coverage</pre>
<h3>Install docker</h3>
<p>For docker installation refer to <a target="_blank" href="https://docs.docker.com/engine/installation/linux/">docker
installation instructions</a>.
</p>
<h3>Build the project</h3>
<p>This is the make target you probably will use for development.</p>
<ul>
<li>Precompiles the python code</li>
<li>runs unit tests</li>
<li>runs integration tests.</li>
</ul>
<pre class="code">make</pre>
<p>or</p>
<pre class="code">make default</pre>
<h3>Build all</h3>
<ul>
<li>Precompiles the python code</li>
<li>runs unit tests</li>
<li>runs integration tests</li>
<li>generates coverage report</li>
<li>build installation packages.</li>
</ul>
<pre class="code">make all</pre>
</div>
</div>
<footer class="footer"><div class="row">
<div class="col-md-6 col-lg-6"><p>Copyright © 2016, 2017 by the Server Mechanic Team.</p></div>
<div class="col-md-4 col-lg-4"><p class="pull-right"><a href="privacy.html">Privacy Statement</a> <a href="project.html#license">License</a></p></div>
<div class="col-md-2 col-lg-2"><p class="pull-right"><a target="_blank" href="https://github.com/server-mechanic/mechanic"><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></p></div>
</div>
<div class="row"><div class="col-lg-12"><p class="trademarks">Docker is a trademark or registered trademark of Docker, Inc.; Puppet is a trademark or registered trademark of Puppet, Inc.; Ansible is a trademark or registered trademark of Red Hat, Inc.; SaltStack is a trademark or registered trademark of SaltStack Inc.</p></div></div></footer>
</div>
<script src="jquery-1.12.1/jquery.min.js"></script><script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</body>
</html>