| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | cdist-bootstrap(7)
 | 
					
						
							|  |  |  | ==================
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | Setup cdist environment
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | INTRODUCTION
 | 
					
						
							|  |  |  | ------------
 | 
					
						
							|  |  |  | 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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | LOCATION
 | 
					
						
							|  |  |  | ---------
 | 
					
						
							|  |  |  | 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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2014-04-30 16:42:35 +02:00
										 |  |  | relies on is recommended, for use as backup as well as to allow easy collaboration
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | with others.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For more sophisticated setups developing cdist configurations with multiple
 | 
					
						
							|  |  |  | people, have a look at cdist-best-practice(7).
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 17:34:16 +01:00
										 |  |  | SETUP WORKING DIRECTORY AND BRANCH
 | 
					
						
							|  |  |  | ----------------------------------
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 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 don't).
 | 
					
						
							|  |  |  | Entering the command "git branch" should show you "* master", which indicates
 | 
					
						
							|  |  |  | you are on the **master** branch.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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. Let's use **git branch -r**
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | to list all branches::
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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 -> origin/master
 | 
					
						
							|  |  |  |       origin/archive_shell_function_approach
 | 
					
						
							|  |  |  |       origin/master
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | So **2.0** 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 won't break your configuration when updating.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-07 12:25:46 +02:00
										 |  |  | It's up to you to decide which branch you want to base your own work on:
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | master contains more recent changes, newer types, but may also break.
 | 
					
						
							| 
									
										
										
										
											2013-07-07 12:25:46 +02:00
										 |  |  | The version branches are stable, but may lack the latest features.
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | Your decision can be changed later on, but may result in merge conflicts,
 | 
					
						
							| 
									
										
										
										
											2013-07-07 12:25:46 +02:00
										 |  |  | which you will need to solve.
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Let's assume you want latest stuff and select the master branch as base for
 | 
					
						
							|  |  |  | your own work. Now it's 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.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | In this tutorial I use the branch **mycompany**::
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     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
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | From now on, you can use git as usual to commit your changes in your own branch.
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | PUBLISHING THE CONFIGURATION
 | 
					
						
							|  |  |  | ----------------------------
 | 
					
						
							|  |  |  | 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
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | reachable via ssh and has git installed::
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # 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/
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Add remote git repo to git config
 | 
					
						
							|  |  |  |     cdist% git remote add loch loch:/home/nutzer/cdist 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Configure the mycompany branch to push to loch
 | 
					
						
							|  |  |  |     cdist% git config branch.mycompany.remote loch
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Configure mycompany branch to push into remote master branch
 | 
					
						
							|  |  |  |     cdist% git config branch.mycompany.merge refs/heads/master
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Push mycompany branch to remote branch master initially
 | 
					
						
							|  |  |  |     cdist% git push loch mycompany:refs/heads/master
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | Now you have setup the git repository to synchronise the **mycompany**
 | 
					
						
							|  |  |  | branch with the **master** branch on the host **loch**. Thus you can commit
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | as usual in your branch and push out changes by entering **git push**.
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | UPDATING FROM ORIGIN
 | 
					
						
							|  |  |  | --------------------
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | Whenever you want to update your cdist installation, you can use git to do so::
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Update git repository with latest changes from origin
 | 
					
						
							|  |  |  |     cdist% git fetch origin
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Update current branch with master branch from origin
 | 
					
						
							|  |  |  |     cdist% git merge origin/master
 | 
					
						
							| 
									
										
										
										
											2012-01-13 22:32:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  |     # Alternative: Update current branch with 2.0 branch from origin
 | 
					
						
							|  |  |  |     cdist% git merge origin/2.0
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SEE ALSO
 | 
					
						
							|  |  |  | --------
 | 
					
						
							| 
									
										
										
										
											2016-05-20 08:50:56 +02:00
										 |  |  | - `cdist(1) <../man1/cdist.html>`_
 | 
					
						
							|  |  |  | - `cdist-tutorial(7) <cdist-tutorial.html>`_
 | 
					
						
							| 
									
										
										
										
											2012-01-13 16:30:46 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | COPYING
 | 
					
						
							|  |  |  | -------
 | 
					
						
							|  |  |  | Copyright \(C) 2012 Nico Schottelius. Free use of this software is
 | 
					
						
							|  |  |  | granted under the terms of the GNU General Public License version 3 (GPLv3).
 |