falkorlib 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/falkorlib/bootstrap/base.rb +20 -13
  4. data/lib/falkorlib/bootstrap/git.rb +5 -2
  5. data/lib/falkorlib/bootstrap/mkdocs.rb +3 -4
  6. data/lib/falkorlib/bootstrap/vagrant.rb +9 -3
  7. data/lib/falkorlib/cli.rb +34 -175
  8. data/lib/falkorlib/cli/link.rb +5 -1
  9. data/lib/falkorlib/cli/make.rb +15 -1
  10. data/lib/falkorlib/cli/new.rb +22 -5
  11. data/lib/falkorlib/tasks/rspec.rake +29 -9
  12. data/lib/falkorlib/version.rb +1 -1
  13. data/spec/falkorlib/bootstrap_spec.rb +26 -1
  14. data/spec/falkorlib/bootstrap_vagrant_spec.rb +14 -14
  15. data/templates/README/header_readme.erb +18 -21
  16. data/templates/README/readme_pyenv.erb +44 -0
  17. data/templates/mkdocs/docs/README.md.erb +7 -7
  18. data/templates/mkdocs/docs/contributing/setup.md.erb +3 -3
  19. data/templates/mkdocs/docs/layout.md.erb +25 -4
  20. data/templates/mkdocs/docs/setup.md.erb +315 -0
  21. data/templates/mkdocs/docs/vagrant.md.erb +85 -0
  22. data/templates/mkdocs/mkdocs.yml.erb +5 -4
  23. data/templates/vagrant/Vagrantfile.erb +73 -28
  24. data/templates/vagrant/vagrant/config.yaml.sample +8 -4
  25. data/templates/vagrant/vagrant/puppet/Makefile +40 -0
  26. data/templates/vagrant/vagrant/puppet/hiera.yaml +36 -0
  27. data/templates/vagrant/vagrant/puppet/hieradata/.gitignore +2 -0
  28. data/templates/vagrant/vagrant/puppet/hieradata/defaults.yaml +4 -0
  29. data/templates/vagrant/vagrant/puppet/hieradata/roles/example.yaml +13 -0
  30. data/templates/vagrant/vagrant/puppet/manifests/default.pp +23 -0
  31. data/templates/vagrant/vagrant/puppet/modules/.gitignore +3 -0
  32. data/templates/vagrant/vagrant/puppet/site/profiles/manifests/pxe/server.pp +12 -0
  33. data/templates/vagrant/vagrant/{bootstrap.sh → scripts/bootstrap.sh} +27 -30
  34. data/templates/vagrant/vagrant/shared/.gitignore +3 -0
  35. metadata +15 -6
  36. data/templates/mkdocs/docs/setup/README.md.erb +0 -6
  37. data/templates/mkdocs/docs/setup/install.md.erb +0 -61
  38. data/templates/mkdocs/docs/setup/preliminaries.md.erb +0 -73
@@ -10,10 +10,10 @@
10
10
 
11
11
  This is the main page of the documentation for this repository, which relies on [MkDocs](http://www.mkdocs.org/) and the [Read the Docs](http://readthedocs.io) theme. It proposes to detail the following elements:
12
12
 
13
- * The [organization and directory layout](layout.md)
14
- * Complete [Installation](setup/index.md) notes, including:
15
- - [Pre-requisites / Preliminary software](setup/preliminaries.md) to install
16
- * How to [contribute](contributing/index.md) to the development of this project. In particular, we detail:
17
- - the steps to follow to [setup this repository](contributing/setup.md)
18
- - information as regard the [semantic versioning](contributing/versioning.md) of this project
19
- - Apart form the directory layout, we will cover various configuration aspects (mainly the [git-flow](https://github.com/nvie/gitflow) workflow)
13
+ * The general [organization and directory layout](layout.md)
14
+ * Complete [Installation and Setup notes](setup.md) for this repository
15
+ <% if File.exists?(File.join(config[:rootdir], 'Vagrantfile')) %>
16
+ * Overview of the [Vagrant](https://www.vagrantup.com/) configuration proposed
17
+ <% end %>
18
+ * (...)
19
+ * [Contributing notes](contributing/index.md) and [semantic versioning](contributing/versioning.md) information of this project
@@ -1,4 +1,4 @@
1
- There is a number of pre-requisite programs / framework you shall install to be able to correctly contribute to this project.
1
+ There is a number of pre-requisite programs / framework you shall install to be able to correctly contribute to this project -- see [../setup.md](../setup.md) for detailed instructions.
2
2
 
3
3
  <% if config[:gitflow] %>
4
4
  __Git Branching Model__
@@ -15,7 +15,7 @@ Thus you are more than encouraged to install the [git-flow](https://github.com/n
15
15
 
16
16
  __Repository Setup__
17
17
 
18
- As mentioned in the [installation notes](../setup/install.md), to make your local copy of the repository ready to use the [git-flow](https://github.com/nvie/gitflow) workflow
18
+ As mentioned in the [installation notes](../setup.md), to make your local copy of the repository ready to use the [git-flow](https://github.com/nvie/gitflow) workflow, run:
19
19
 
20
20
  <% if config[:make] %>
21
21
  $> make setup
@@ -23,4 +23,4 @@ As mentioned in the [installation notes](../setup/install.md), to make your loca
23
23
  $> rake setup
24
24
  <% end %>
25
25
 
26
- This will also initiate the [Git submodules of this repository](.gitmodules) for this repository.
26
+ Semantic versioning informations happening upon the release operations are detailed in [`versioning.md`](versioning.md).
@@ -1,10 +1,9 @@
1
1
 
2
- This repository is organized as follows:
2
+ This repository is organized as follows (use `tree -L 2` to complete):
3
3
 
4
4
  ~~~bash
5
5
  .
6
- ├── LICENSE.txt # Licence of this project
7
- <% unless options[:rake] %>
6
+ <% if options[:rake] %>
8
7
  ├── Rakefile # Ruby Rake configuration
9
8
  <% else %>
10
9
  ├── Makefile # GNU Make configuration
@@ -13,5 +12,27 @@ This repository is organized as follows:
13
12
  ├── VERSION # /!\ DO NOT EDIT. Current repository version
14
13
  ├── docs/ # [MkDocs](mkdocs.org) main directory
15
14
  ├── mkdocs.yml # [MkDocs](mkdocs.org) configuration
16
- └── src/ # Source Code
15
+ <% if File.exists?(File.join(config[:rootdir], '.ruby-version')) %>
16
+ ├── .ruby-{version,gemset} # [RVM](https://rvm.io/) (Ruby Version Manager) configuration
17
+ <% end %>
18
+ <% if File.exists?(File.join(config[:rootdir], 'Gemfile')) %>
19
+ ├── Gemfile[.lock] # [Bundler](https://bundler.io/) configuration
20
+ <% end %>
21
+ <% if File.exists?(File.join(config[:rootdir], '.envrc')) %>
22
+ ├── .envrc # Local direnv configuration -- see https://direnv.net/
23
+ │ # Assumes you have installed in ~/.config/direnv/direnvrc
24
+ │ # the version proposed on
25
+ │ # https://raw.githubusercontent.com/Falkor/dotfiles/master/direnv/direnvrc
26
+ <% end %>
27
+ <% if File.exists?(File.join(config[:rootdir], '.python-version')) %>
28
+ ├── .python-{version,virtualenv} # Pyenv/Virtualenv configuration
29
+ <% end %>
30
+ <% if File.exists?(File.join(config[:rootdir], 'Vagrantfile')) %>
31
+ ├── Vagrantfile # Vagrant configuration file - see https://www.vagrantup.com/
32
+ └── vagrant/ # Complementary Vagrant configuration
33
+ ├── config.yaml # custom config
34
+ ├── config.yaml.sample
35
+ ├── puppet/ # puppet provisionning
36
+ └── scripts/ # scripts (bootstrap etc.) for vagrant VM provisioning
37
+ <% end %>
17
38
  ~~~
@@ -0,0 +1,315 @@
1
+ # Repository Setup and Preliminaries
2
+
3
+ This projects relies on several components you need to have installed on your system.
4
+
5
+ * [Git](https://git-scm.com/)
6
+ * __On Mac OS__: [Homebrew](http://brew.sh/) (The missing package manager for macOS)
7
+
8
+ The below instructions will help you to configure your local copy of this repository and eventually install software dependencies required for this project.
9
+
10
+ _Note_: in the following instructions, terminal commands are prefixed by a virtual prompt `$>`which obviously **does not** belong to the command.
11
+
12
+ -----------
13
+
14
+ <% unless config[:forge].empty? %>
15
+ This repository is hosted on [<%= FalkorLib::Config::Bootstrap::DEFAULTS[:forge][ config[:forge].to_sym ][:name] %>](<%= config[:project_page] %>).
16
+ <% if (config[:forge] == :gitlab) %>
17
+ Git interactions with this repository (push, pull etc.) are performed over SSH using the port 8022
18
+ <% end %>
19
+ To clone this repository, proceed as follows (adapt accordingly):
20
+
21
+ ```bash
22
+ $> mkdir -p ~/<%= config[:rootdir].gsub(ENV['HOME'] + '/', '').gsub(File.basename(config[:rootdir]), '') %>
23
+ $> cd ~/<%= config[:rootdir].gsub(ENV['HOME'] + '/', '').gsub(File.basename(config[:rootdir]), '') %>
24
+ $> git clone <%= config[:origin] %> <%= File.basename(config[:rootdir]) %>
25
+ $> cd <%= File.basename(config[:rootdir]) %>
26
+ # /!\ IMPORTANT: run 'make setup' only **AFTER** Pre-requisites sofftware are installed
27
+ ```
28
+ <% end %>
29
+ To setup you local copy of this repository (**after** pre-requisites are satisfied), simply run:
30
+
31
+ ```bash
32
+ <% if config[:rake] %>
33
+ $> rake setup # Under Mac OS / Linux
34
+ <% else %>
35
+ $> make setup # Under Mac OS / Linux
36
+ <% end %>
37
+ ```
38
+
39
+ This will initiate the Git submodules of this repository (see `.gitmodules`) and setup the [git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) layout for this repository. Later on, you can update your local branches by running:
40
+
41
+ <% if config[:rake] %>
42
+ $> rake up
43
+ <% else %>
44
+ $> make up
45
+ <% end %>
46
+
47
+ If upon pulling the repository, you end in a state where another collaborator have upgraded the Git submodules for this repository, you'll end in a dirty state (as reported by modifications within the `.submodules/` directory). In that case, just after the pull, you **have to run** `<%= config[:rake] ? 'r' : 'm' %>ake up` to ensure consistency with regards the Git submodules:
48
+
49
+ Finally, you can upgrade the Git submodules to the latest version by running:
50
+
51
+ <% if config[:rake] %>
52
+ $> rake git:submodules:upgrade
53
+ <% else %>
54
+ $> make upgrade
55
+ <% end %>
56
+
57
+
58
+ ## Pre-requisites Software
59
+
60
+ Install the following software, depending on your running platform:
61
+
62
+ | Platform | Software | Description | Usage |
63
+ |----------|-------------------------------------------------------|---------------------------------------|-------------------------|
64
+ | Mac OS | [Homebrew](http://brew.sh/) | The missing package manager for macOS | `brew install ...` |
65
+ | Mac OS | [Brew Cask Plugin](https://caskroom.github.io) | Mac OS Apps install made easy | `brew cask install ...` |
66
+ | Mac OS | [iTerm2](https://www.iterm2.com/) | _(optional)_ enhanced Terminal | |
67
+ | Windows | [Git for Windows](https://git-for-windows.github.io/) | I'm sure you guessed | |
68
+ | Windows | [SourceTree](https://www.sourcetreeapp.com/) | _(optional)_ enhanced git GUI | |
69
+ | Windows | [Virtual Box](https://www.virtualbox.org/) | Free hypervisor provider for Vagrant | |
70
+ | Windows | [Vagrant](https://www.vagrantup.com/downloads.html) | Reproducible environments made easy. | |
71
+
72
+ Follow the below **custom** instructions depending on your running platform and Operating System.
73
+
74
+ #### Mac OS X
75
+
76
+ Once you have [Homebrew](http://brew.sh/) installed:
77
+
78
+ ```bash
79
+ $> brew install git-core git-flow # (newer) Git stuff
80
+ $> brew install mkdocs # (optional) install mkdocs
81
+ $> brew install pyenv pyenv-virtualenv direnv # see https://varrette.gforge.uni.lu/tutorials/pyenv.html
82
+ $> brew tap caskroom/cask # install brew cask -- see https://caskroom.github.io/
83
+ $> brew cask install virtualbox # install virtualbox -- see https://www.virtualbox.org/
84
+ $> brew cask install vagrant # install Vagrant -- see https://www.vagrantup.com/downloads.html
85
+ $> brew cask install vagrant-manager # see http://vagrantmanager.com/
86
+ $> brew cask install docker # install Docker -- https://docs.docker.com/engine/installation/mac/
87
+ ```
88
+
89
+ _Note_: later on, you might wish to use the following shell function to update the software installed using [Homebrew](http://brew.sh/).
90
+
91
+ ```bash
92
+ bup () {
93
+ echo "Updating your [Homebrew] system"
94
+ brew update
95
+ brew upgrade
96
+ brew cu
97
+ brew cleanup
98
+ brew cask cleanup
99
+ }
100
+ ```
101
+
102
+ #### Linux
103
+
104
+
105
+ ```bash
106
+ # Below instructions for Debian/Ubuntu
107
+ # Adapt the package names (and package manager) in case you are using another Linux distribution.
108
+ $> sudo apt-get update
109
+ $> sudo apt-get install git git-flow build-essential
110
+ $> sudo apt-get install rubygems virtualbox vagrant virtualbox-dkms
111
+ ```
112
+
113
+ #### Windows
114
+
115
+ On Windows (10, 7/8 should also be OK) you should download and install the following tools:
116
+
117
+ * [MobaXterm](http://mobaxterm.mobatek.net). You can also check out the [MobaXterm demo](http://mobaxterm.mobatek.net/demo.html) which shows an overview of its features.
118
+ - See also [official ULHPC SSH access instructions](https://hpc.uni.lu/users/docs/access/access_windows.html)
119
+
120
+ * [VirtualBox](https://www.virtualbox.org/wiki/Downloads), download the latest [VirtualBox 'Windows hosts' installer](https://www.virtualbox.org/wiki/Downloads) and [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) .
121
+ - First, install VirtualBox with the default settings. Note that a warning will be issued that your network connections will be temporarily impacted, you should continue.
122
+ - Then, run the downloaded extension pack (.vbox-extpack file), it will open within the VirtualBox Manager and you should let it install normally.
123
+
124
+ * [Vagrant](https://www.vagrantup.com/downloads.html), download the latest [Windows (64 bit) Vagrant installer](https://www.vagrantup.com/downloads.html)
125
+ - Proceed with the installation, no changes are required to the default setup.
126
+
127
+ * [Git](https://git-scm.com/downloads), download the latest [Git installer](https://git-scm.com/download/win)
128
+
129
+ The Git installation requires a few changes to the defaults, make sure the following are selected in the installer:
130
+
131
+ - Select Components: _Use a TrueType font in all console windows)_
132
+ - Adjusting your PATH environment: _Use Git and optional Unix tools from the Windows Command Prompt_
133
+ - Configuring the line ending conversions: _Checkout Windows-style, commit Unix-style line endings)_
134
+ - Configuring the terminal emulator to use with Git Bash: _Use MinTTY (the default terminal of MSYS2)_
135
+ - Configuring extra options: _Enable symbolic links_
136
+
137
+ Please note that to clone a Git repository which contains symbolic links (symlinks), you **must start a shell** (Microsoft PowerShell in this example, but a Command Prompt - cmd.exe - or Git Bash shell should work out fine) **with elevated (Administrator) privileges**. This is required in order for git to be able to create symlinks on Windows:
138
+
139
+ * Start Powershell:
140
+ 1. In the Windows Start menu, type PowerShell
141
+ 2. Normally PowerShell will appear as the first option on the top as **Best match**
142
+ 3. Right click on it and select "Run as administrator"
143
+
144
+ See also the instructions and screenshots provided on this [tutorial](http://rr-tutorials.readthedocs.io/en/latest/setup/#windows).
145
+
146
+ <% if File.exists?(File.join(config[:rootdir], 'Vagrantfile')) %>
147
+ ## Vagrant
148
+
149
+ This repository comes with a `Vagrantfile` at the root of the repository which, together with the associated configuration (under `vagrant/`), pilot the provisioning of Virtual Machine(s) using [Vagrant](http://www.vagrantup.com/).
150
+
151
+ [Vagrant](http://vagrantup.com/) uses [Oracle's VirtualBox](http://www.virtualbox.org/)
152
+ to build configurable, lightweight, and portable virtual machines dynamically.
153
+
154
+ * [Reference installation notes](http://docs.vagrantup.com/v2/installation/) -- assuming you have installed [Oracle's VirtualBox](http://www.virtualbox.org/)
155
+ * [installation notes on Mac OS](http://sourabhbajaj.com/mac-setup/Vagrant/README.html) using [Homebrew](http://brew.sh/) and [Cask](http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html)
156
+
157
+ Once installed, check the list of VMs ready to be deployed using
158
+
159
+ ```bash
160
+ $> vagrant status
161
+ # Follow instructions to (eventually) install the missing plugings
162
+ $> vagrant plugin install
163
+ $> vagrant plugin install vagrant-hosts
164
+ $> vagrant plugin install vagrant-vbguest
165
+ $> vagrant plugin install vagrant-cachier
166
+ $> vagrant plugin install terminal-table deep_merge
167
+ $> vagrant status
168
+ Current machine states:
169
+
170
+ [...]
171
+
172
+ The environment has not yet been created. Run `vagrant up` to
173
+ create the environment. If a machine is not created, only the
174
+ default provider will be shown. So if a provider is not listed,
175
+ then the machine is not created for that environment.
176
+ ```
177
+
178
+ See [`vagrant.md`](vagrant.md) for further details.
179
+ <% end %>
180
+
181
+ <% if File.exists?(File.join(config[:rootdir], '.ruby-version')) %>
182
+ ## Ruby setup with RVM
183
+
184
+ In order to have a consistent Ruby environment among the collaborators of this project, [Bundler](http://bundler.io/) is used in complement to [RVM](https://rvm.io/).
185
+
186
+ * Configuration of [Bundler](http://bundler.io/) is made via the [`Gemfile[.lock]` files](http://bundler.io/gemfile.html).
187
+ * [RVM](https://rvm.io/) gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other projects. Sandboxing with [RVM](https://rvm.io/) is straight-forward via the [notion of gemsets](https://rvm.io/gemsets) and is managed via the `.ruby-{version,gemset}` files.
188
+ - [RVM installation](https://rvm.io/rvm/install)
189
+
190
+ Once RVM is installed, proceed as follows:
191
+
192
+ ```bash
193
+ rvm list # SHow currently installed version
194
+ rvm list know # Show known configuration
195
+ rvm install $(head .ruby-version)
196
+ # Activate the gemset environment by reentering into the directory
197
+ cd ..
198
+ cd -
199
+ rvm current #check current ruby environment -- should match $(head .ruby-version)@head .ruby-gemset)
200
+ ```
201
+ <% end %>
202
+ <% if File.exists?(File.join(config[:rootdir], 'Gemfile')) %>
203
+ Assuming your Ruby environment is correctly setup (again, use `rvm current` to check it), you can install the package dependencies detailed in the [`Gemfile`](Gemfile) through [Bundler](http://bundler.io/) as follows:
204
+
205
+ ```bash
206
+ gem install bundler
207
+ bundle
208
+ ```
209
+
210
+ <% end %>
211
+ <% if File.exists?(File.join(config[:rootdir], 'Rakefile')) %>
212
+ The various operations that can be conducted from this repository are piloted from a [`Rakefile`](https://github.com/ruby/rake) and assumes you have a running [Ruby](https://www.ruby-lang.org/en/) installation
213
+
214
+ If things are fine, you should be able to access the list of available tasks by running:
215
+
216
+ $> rake -T
217
+
218
+ You probably want to activate the bash-completion for rake tasks, such as the one provided [here](https://github.com/ai/rake-completion).
219
+
220
+ <% end %>
221
+ <% if File.exists?(File.join(config[:rootdir], '.envrc')) %>
222
+ ## Python Virtualenv / Pyenv and Direnv
223
+
224
+ In order to have a consistent Python environment among the collaborators of this project, the use of [`virtualenv`](https://pypi.org/project/virtualenv/) (a tool to create isolated virtual Python environments) is strongly encouraged.
225
+ Based on the guidelines of [this blog post](https://varrette.gforge.uni.lu/tutorials/pyenv.html), this project relies on two additional tools facilitating the setup of the python environment expected within this project:
226
+
227
+ * [`pyenv`](https://github.com/pyenv/pyenv)
228
+ * [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv)
229
+ - see [Note on virtualenv and venv](https://github.com/pyenv/pyenv-virtualenv#virtualenv-and-venv):
230
+ `pyenv-virtualenv` uses `python -m venv` if it is available (CPython 3.3 and newer) and the `virtualenv` command is not available.
231
+ * [Direnv](https://direnv.net/) allowing to automatically activate/deactivate the project virtualenv when entering/leaving the directory hosting your local copy of this repository.
232
+ - [direnv](https://direnv.net/) has a standard library of functions / layout (see [direnv-stdlib](https://github.com/direnv/direnv/blob/master/stdlib.sh) or the associated [man page](https://github.com/direnv/direnv/blob/master/man/direnv-stdlib.1.md)), which you can override with your own set of function though [`~/.config/direnv/direnvrc`](https://github.com/Falkor/dotfiles/blob/master/direnv/direnvrc).
233
+ - Below instructions will make you install [this version](https://github.com/Falkor/dotfiles/blob/master/direnv/direnvrc)
234
+
235
+ Installation instructions -- see also [this blog post](https://varrette.gforge.uni.lu/tutorials/pyenv.html)
236
+
237
+ ```bash
238
+ ### Mac OS
239
+ $> brew install pyenv pyenv-virtualenv direnv
240
+ ### Linux
241
+ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
242
+ $> git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
243
+ $> { apt-get | yum } install direnv # direnv install
244
+ ```
245
+
246
+ You then need adapt your environment _i.e._ `~/.{profile | bash* | zsh* etc.}` to support [pyenv shims](https://github.com/yyuu/pyenv#understanding-shims), [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenv
247
+ s/) and [direnv](https://direnv.net/). Ex:
248
+
249
+ ```bash
250
+ # To add in your favorite shell configuration (.bashrc, .zshrc etc.)
251
+ #
252
+ # - pyenv: https://github.com/pyenv/pyenv
253
+ # - pyenv-virtualenv: https://github.com/pyenv/pyenv-virtualenv
254
+ if [ -n "$(which pyenv)" ]; then
255
+ eval "$(pyenv init -)"
256
+ eval "$(pyenv virtualenv-init -)"
257
+ export PYENV_VIRTUALENV_DISABLE_PROMPT=1
258
+ fi
259
+ #
260
+ # - direnv: https://direnv.net/
261
+ if [ -n "$(which direnv)" ]; then
262
+ eval "$(direnv hook $(basename $SHELL))"
263
+ # export DIRENV_WARN_TIMEOUT=100s
264
+ fi
265
+ ```
266
+
267
+ If you're using [oh-my-zsh](http://ohmyz.sh/), you probably want to enable the [pyenv plugin](https://github.com/Falkor/dotfiles/blob/master/oh-my-zsh/.zshrc#L73)
268
+
269
+ Finally, to setup direnv, simply run:
270
+
271
+ ```bash
272
+ make setup-direnv
273
+ ```
274
+
275
+ Running `direnv allow` (this will have to be done only once), you should automatically enable the virtualenv `<%= config[:name].downcase %>` based on the python version specified in `.python-version`. You'll eventually need to install the appropripriate Python version with `pyenv`:
276
+
277
+ ```bash
278
+ pyenv versions # Plural: show all versions
279
+ pyenv install $(head .python-version)
280
+ # Activate the virtualenv by reentering into the directory
281
+ cd ..
282
+ cd -
283
+ ```
284
+ <% end %>
285
+ <% if File.exists?(File.join(config[:rootdir], 'requirements.txt')) %>
286
+ From that point, you should install the required packages using:
287
+
288
+ pip install -r requirements.txt
289
+
290
+ Alternatively, you can use `make setup-python`
291
+
292
+ <% end %>
293
+
294
+ ## Post-Installations checks
295
+
296
+ (Eventually) Make yourself known to Git
297
+
298
+ ```bash
299
+ $> git config –-global user.name "Firstname LastName" # Adapt accordingly
300
+ $> git config –-global user.email "Firstname.LastName@domain.org" # Adapt with your mail
301
+ # Eventually, if you have a GPG key, use the public key to sign your commits/tags
302
+ $> git config --global user.helper osxkeychain # Only on Mac OS
303
+ $> git config --global user.signingkey <fingerprint> # Ex: git config --global user.signingkey 5D08BCDD4F156AD7
304
+ # you can get your key fingerprint (prefixed by 0x) with 'gpg -K --fingerprint | grep sec'
305
+ ```
306
+
307
+ Now you can complete the setup of your copy of this repository by running
308
+
309
+ ```bash
310
+ <% if config[:rake] %>
311
+ $> rake setup # Under Mac OS / Linux
312
+ <% else %>
313
+ $> make setup # Under Mac OS / Linux
314
+ <% end %>
315
+ ```
@@ -0,0 +1,85 @@
1
+ ## Reproducible VM deployment with Vagrant
2
+
3
+ This repository comes with a `Vagrantfile` at the root of the repository which, together with the associated configuration (under `vagrant/`), pilots the provisioning of Virtual Machine(s) using [Vagrant](http://www.vagrantup.com/).
4
+
5
+ [Vagrant](http://vagrantup.com/) uses [Oracle's VirtualBox](http://www.virtualbox.org/)
6
+ to build configurable, lightweight, and portable virtual machines dynamically.
7
+
8
+ * [Reference installation notes](http://docs.vagrantup.com/v2/installation/) -- assuming you have installed [Oracle's VirtualBox](http://www.virtualbox.org/)
9
+ * [installation notes on Mac OS](http://sourabhbajaj.com/mac-setup/Vagrant/README.html) using [Homebrew](http://brew.sh/) and [Cask](http://sourabhbajaj.com/mac-setup/Homebrew/Cask.html)
10
+
11
+ #### Plugins installation
12
+
13
+ Once installed, check the list of VMs ready to be deployed using
14
+
15
+ ```bash
16
+ $> vagrant status
17
+ # Follow instructions to (eventually) install the missing plugings
18
+ $> vagrant plugin install
19
+ $> vagrant plugin install vagrant-hosts
20
+ $> vagrant plugin install vagrant-vbguest
21
+ $> vagrant plugin install vagrant-cachier
22
+ $> vagrant plugin install terminal-table deep_merge
23
+ $> vagrant status
24
+ Current machine states:
25
+
26
+ [...]
27
+
28
+ The environment has not yet been created. Run `vagrant up` to
29
+ create the environment. If a machine is not created, only the
30
+ default provider will be shown. So if a provider is not listed,
31
+ then the machine is not created for that environment.
32
+ ```
33
+
34
+ #### Vagrant VM(s) deployment
35
+
36
+ By default, the following boxes will be deployed upon `vagrant up`:
37
+
38
+ * `default`: default VM
39
+
40
+ To initiate the deployment:
41
+
42
+ ```bash
43
+ $> vagrant status
44
+ $> vagrant up
45
+ [...]
46
+ +--------------|-------------------------|---------|----------|------------|----------------|------------+
47
+ | Virtual environment deployed on Vagrant |
48
+ +--------------|-------------------------|---------|----------|------------|----------------|------------+
49
+ | Name | Hostname | OS | vCPU/RAM | Role | Description | IP |
50
+ +--------------|-------------------------|---------|----------|------------|----------------|------------+
51
+ | <hostname> | <hostname>.vagrant.dev | centos7 | 2/1024 | default | <description> | 10.10.1.2 |
52
+ | [...] | | | | | | |
53
+ +--------------|-------------------------|---------|----------|------------|----------------|------------+
54
+ - Virtual Vagrant infrastructure successfully deployed!
55
+ ```
56
+
57
+ You can ssh into any of the deployed machine afterwards:
58
+
59
+ ```bash
60
+ $> vagrant ssh [<name>]
61
+ ```
62
+
63
+ #### Vagrant boxes provisionning
64
+
65
+ When you run `vagrant up <name>` to boot the VM, the following default provisioning are applied (shell scripts are located in `vagrant/scripts/`):
66
+
67
+ | Script | Type | Description |
68
+ |------------------|--------|---------------------------------------|
69
+ | `bootstrap.sh` | shell | Install puppet and defaults packages |
70
+
71
+ In addition, a [Puppet](https://puppet.com/)-based provisionning in configured, operated by calling `puppet apply` (i.e. without a Puppet Master). To make the best use of it:
72
+
73
+ 1. associate a `role` name to each of your VM (default role: `default`)
74
+ - you can use the `:role: <name>` YAML entry in `vagrant/config.yaml` or add `:role => '<name>'` in the appropriate `:vms` hash table entry within the root `Vagrantfile`
75
+ - use the `:puppet_modules` entry to list the [puppet modules](https://forge.puppet.com/) required for this role
76
+ 2. create a new [hiera](https://puppet.com/docs/puppet/latest/hiera_intro.html) YAML configuration under `vagrant/puppet/hieradata/<name>.yaml`.
77
+ - list the profiles you want to see applied under the `profiles:` key, and append the puppet classes parameters you want to set using [hiera](https://puppet.com/docs/puppet/latest/hiera_automatic.html#class_parameters)
78
+ 3. (eventually) create the [puppet manifest(s)](https://puppet.com/docs/puppet/latest/puppet_language.html) for each declared profile under `vagrant/puppet/site/profiles/manifests/`
79
+ - Ex: `profile::pxe::server` is defined in `vagrant/puppet/site/profiles/manifests/pxe/server.pp`
80
+
81
+ That should be sufficient. You can test on demand the application of puppet provisionning using
82
+
83
+ ```
84
+ vagrant provision --provision-with puppet
85
+ ```