-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickstart.html
127 lines (114 loc) · 6.12 KB
/
quickstart.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
<!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 class="active"><a href="quickstart.html">Quickstart</a></li>
<li><a href="doc.html">Docs</a></li>
<li><a href="project.html">Project</a></li>
</ul></div>
</div>
<a id="quickstart"></a><div class="row">
<div class="col-lg-12">
<h1>
<a id="getting-started"></a>Quickstart
</h1>
<p>Server Mechanic is about changing a server or virtual machine by applying a migration script once and
only once. So you can checkin setup and adjustments to your infrastructure as scripts into your
preferred source code management system.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>How it works</h2>
<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">
<h2>The Server Mechanic playground</h2>
<p>The Server Mechanic playground (mechanic-playground) is a docker container with a mechanic preinstalled so
you instantly can start playing with mechnic.
</p>
<h4>Pull from dockerhub</h4>
<pre class="code">
docker pull servermechanic/mechanic-playground
</pre>
<h4>Create a playground</h4>
<pre class="code"># create folder to mount as mechanic volume
mkdir srv-mechanic-volume
# create folder mechanic will pickup migrations from
mkdir srv-mechanic-volume/migration.d/
# start the container
docker run -d --name my-mechanic-playground \
-v $PWD/srv-mechanic-volume:/srv/mechanic \
mechanic-playground
</pre>
<p>List migrations already applied</p>
<pre class="code">
docker exec -t my-mechanic-playground mechanic list-migrations
</pre>
<p>This should list an initial migration applied on startup. One migration is part of the container and is
applied on first startup.
</p>
<h2>Add own migration</h2>
<p>A migration can be written as a shell script. This is a simple example migration:</p>
<pre class="code">
#!/bin/bash -ex
echo "# config for hooray" > /srv/mechanic/hooray.conf
exit 0
</pre>
<p>The next command places the migration script in the mechanic migrations folder and makes it executable.
</p>
<pre class="code">
cat - > srv-mechanic-volume/migration.d/20161224_hooray.sh <<EOB
#!/bin/bash -ex
echo "# config for hooray" > /srv/mechanic/hooray.conf
exit 0
EOB
chmod 755 srv-mechanic-volume/migration.d/20161224_hooray.sh
</pre>
<p>Run the Server Mechanic to apply migrations</p>
<pre class="code">
docker exec -t my-mechanic-playground mechanic -v migrate
</pre>
<p>Query Server Mechanic if the migration has been applied</p>
<pre class="code">
docker exec -t my-mechanic-playground mechanic list-migrations
</pre>
<p>Verify that the migration's effect is visible:</p>
<pre class="code">
cat srv-mechanic-volume/hooray.conf
</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>