www.nico.schottelius.org/software/cdist/man/latest/man7/cdist-bootstrap.html
2017-06-13 18:09:25 +02:00

77 lines
8.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>cdist-bootstrap(7)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="article" title="cdist-bootstrap(7)" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id528433"></a>cdist-bootstrap(7)</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Nico</span> <span class="surname">Schottelius</span></h3><code class="email">&lt;<a class="email" href="mailto:nico-cdist--@--schottelius.org">nico-cdist--@--schottelius.org</a>&gt;</code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="section"><a href="#_name">1. NAME</a></span></dt><dt><span class="section"><a href="#_introduction">2. INTRODUCTION</a></span></dt><dt><span class="section"><a href="#_location">3. LOCATION</a></span></dt><dt><span class="section"><a href="#_setup_working_directory_and_branch">4. SETUP WORKING DIRECTORY AND BRANCH</a></span></dt><dt><span class="section"><a href="#_publishing_the_configuration">5. PUBLISHING THE CONFIGURATION</a></span></dt><dt><span class="section"><a href="#_updating_from_origin">6. UPDATING FROM ORIGIN</a></span></dt><dt><span class="section"><a href="#_see_also">7. SEE ALSO</a></span></dt><dt><span class="section"><a href="#_copying">8. COPYING</a></span></dt></dl></div><div class="section" title="1. NAME"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. NAME</h2></div></div></div><p>cdist-bootstrap - setup cdist environment</p></div><div class="section" title="2. INTRODUCTION"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_introduction"></a>2. INTRODUCTION</h2></div></div></div><p>This document describes the usual steps recommended for a new
cdist setup. It is recommended that you have read and understood
cdist-quickstart(7) before digging into this.</p></div><div class="section" title="3. LOCATION"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_location"></a>3. LOCATION</h2></div></div></div><p>First of all, you should think about where to store your configuration
database and who will be accessing or changing it. Secondly you have to
think about where to configure your hosts from, which may be a different
location.</p><p>For starters, having cdist (which includes the configuration database) on
your notebook should be fine.
Additionally an external copy of the git repository the configuration
relies in is recommended, for use as backup as well to allow easy collaboration
with others.</p><p>For more sophisticated setups developing cdist configurations with multiple
people, have a look at cdist-best-practice(7).</p></div><div class="section" title="4. SETUP WORKING DIRECTORY AND BRANCH"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_setup_working_directory_and_branch"></a>4. SETUP WORKING DIRECTORY AND BRANCH</h2></div></div></div><p>I assume you have a fresh copy of the cdist tree in ~/cdist, cloned from
one of the official urls (see cdist-quickstart(7) if you dont).
Entering the command "git branch" should show you "* master", which indicates
you are on the <span class="strong"><strong>master</strong></span> branch.</p><p>The master branch reflects the latest development of cdist. As this is the
development branch, it may or may not work. There are also version branches
available, which are kept in a stable state. Lets use <span class="strong"><strong>git branch -r</strong></span>
to list all branches:</p><pre class="screen">cdist% git branch -r
origin/1.0
origin/1.1
origin/1.2
origin/1.3
origin/1.4
origin/1.5
origin/1.6
origin/1.7
origin/2.0
origin/HEAD -&gt; origin/master
origin/archive_shell_function_approach
origin/master</pre><p>So <span class="strong"><strong>2.0</strong></span> is the latest version branch in this example.
All versions (2.0.x) within one version branch (2.0) are compatible to each
other and wont break your configuration when updating.</p><p>Its up to you decide on which branch you want to base your own work:
master contains more recent changes, newer types, but may also break.
The versions branches are stable, but thus may miss the latest features.
Your decision can be changed later on, but may result in merge conflicts,
which youd have to solve.</p><p>Lets assume you want latest stuff and select the master branch as base for
your own work. Now its time to create your branch, which contains your
local changes. I usually name it by the company/area I am working for:
ethz-systems, localch, customerX, … But this is pretty much up to you.</p><p>In this tutorial I use the branch <span class="strong"><strong>mycompany</strong></span>:</p><pre class="screen">cdist% git checkout -b mycompany origin/master
Branch mycompany set up to track remote branch master from origin.
Switched to a new branch 'mycompany'
cdist-user% git branch
master
* mycompany</pre><p>From now on, you can use git as usual to commit your changes in your own branch.</p></div><div class="section" title="5. PUBLISHING THE CONFIGURATION"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_publishing_the_configuration"></a>5. PUBLISHING THE CONFIGURATION</h2></div></div></div><p>Usually a development machine like a notebook should be considered
temporary only. For this reason and to enable shareability, the configuration
should be published to another device as early as possible. The following
example shows how to publish the configuration to another host that is
reachable via ssh and has git installed:</p><pre class="screen"># Create bare git repository on the host named "loch"
cdist% ssh loch "GIT_DIR=/home/nutzer/cdist git init"
Initialized empty Git repository in /home/nutzer/cdist/
# Add remote git repo to git config
cdist% git remote add loch loch:/home/nutzer/cdist
# Configure the mycompany branch to push to loch
cdist% git config branch.mycompany.remote loch
# Configure mycompany branch to push into remote master branch
cdist% git config branch.mycompany.merge refs/heads/master
# Push mycompany branch to remote branch master initially
cdist% git push loch mycompany:refs/heads/master</pre><p>Now you have setup the git repository to synchronise the <span class="strong"><strong>mycompany</strong></span>
branch with the <span class="strong"><strong>master</strong></span> branch on the host <span class="strong"><strong>loch</strong></span>. Thus you can commit
as usual in your branch and push out changes by entering <span class="strong"><strong><span class="strong"><strong>git push</strong></span></strong></span>.</p></div><div class="section" title="6. UPDATING FROM ORIGIN"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_updating_from_origin"></a>6. UPDATING FROM ORIGIN</h2></div></div></div><p>Whenever you want to update your cdist installation, you can use git to do so:</p><pre class="screen"># Update git repository with latest changes from origin
cdist% git fetch origin
# Update current branch with master branch from origin
cdist% git merge origin/master
# Alternative: Update current branch with 2.0 branch from origin
cdist% git merge origin/2.0</pre></div><div class="section" title="7. SEE ALSO"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>7. SEE ALSO</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
cdist(1)
</li><li class="listitem">
cdist-tutorial(7)
</li></ul></div></div><div class="section" title="8. COPYING"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_copying"></a>8. COPYING</h2></div></div></div><p>Copyright (C) 2012 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).</p></div></div></body></html>