-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
124 lines (95 loc) · 5.22 KB
/
index.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Word of MAOO</title>
<meta name="generator" content="blog.session.it/0.1 | jekyll/0.11.0" />
<meta charset="utf-8" />
<meta name="description" content="Personal Blog of Maurizio Pillitu" />
<meta name="keywords" content="clojure,enlive,moustache,java,alfresco,lambdalf,performance" />
<link rel="stylesheet" href="/stylesheets/styles.css" />
<link rel="stylesheet" href="/stylesheets/pygment_trac.css" />
<link rel="stylesheet" href="/stylesheets/skuro.css" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1><a href="/">Word of maoo</a></h1>
<ul>
<li><a href="/archive">Browse the <strong>Archive</strong></a></li>
<li><a href="/category">Browse by <strong>Categories</strong></a></li>
<li><a target="_blank" href="http://keybase.io/maoo">Learn more <strong>About me</strong></a></li>
</ul>
<p class="persona">
<a href="https://github.com/maoo"><img src="/img/github.png" /></a>
<a href="http://linkedin.com/in/mpillitu"><img src="/img/linkedin.png" /></a>
<a href="https://twitter.com/maoo"><img src="/img/twitter.png" /></a>
<a href="/rss2.xml"><img src="/img/rss.png" /></a>
</p>
</header>
<section>
<div class="post">
<!-- copied from post_header include -->
<h1>
<a href="/2015/06/15/berkshelf-and-packer">Adding Berkshelf feature to Packer</a>
</h1>
<blockquote class="date-wrapper">
<h5 class="date">
June 15, 2015
- tagged
<a href="/category/packer">#packer</a>
<a href="/category/chef">#chef</a>
<a href="/category/berkshelf">#berkshelf</a>
</h5>
</blockquote>
<!-- end copy -->
<img src="/img/post/packer-logo.png" class="primary" />
<p>In order to use Chef (<a href="https://www.youtube.com/watch?v=hYt0E84kYUI">the Berkshelf Way</a>) with <a href="https://packer.io/">Packer</a>, it is a common approach to define a script that wraps the invocation of Packer and runs the <code>berks install</code> (or <code>berks vendor</code>) command that resolves the Chef cookbooks that you need; an interesting discussion can be found on <a href="https://github.com/mitchellh/packer/issues/590">Packer issue #590</a></p>
<p>As others, we ended up with <a href="https://github.com/Alfresco/packer-common">our "own" Packer wrapper script</a>, though it is hard to debug, error-prone and "hacky"; that's why we tried to enhance Packer chef-solo provisioner.</p>
<p>To make the solution a bit more generic, we introduced a <code>pre_local_commands</code> parameter to the <code>chef-solo</code> Packer provisioner, allowing to run commands and resolve cookbooks (and/or databags), as in the following example:</p>
<pre><code>"provisioners": [
{
"type": "chef-solo",
"cookbook_paths": [
"/tmp/berks-vendor"
],
"data_bags_path": "/tmp/databags/data_bags",
"pre_local_commands" : [
"/bin/rm -rf /tmp/databags",
"/usr/bin/git clone [email protected]:maoo/data_bags_test.git /tmp/databags",
"/bin/rm -rf /tmp/berks-vendor",
"/opt/chefdk/bin/berks vendor /tmp/berks-vendor"
],
"run_list": ["nginx::default"]
}
</code></pre>
<p><a href="https://github.com/mitchellh/packer/compare/master...maoo:chef-solo-precommands">https://github.com/mitchellh/packer/compare/master...maoo:chef-solo-precommands</a></p>
<p>To test it, you can:</p>
<ul>
<li>checkout and build <a href="https://github.com/maoo/packer">https://github.com/maoo/packer</a> , branch <code>chef-solo-precommands</code> (follow the README)</li>
<li>checkout <a href="https://github.com/maoo/packer_pre_command_test">https://github.com/maoo/packer_pre_command_test</a></li>
<li><code>packer build packer.json</code></li>
</ul>
<p>If you have the same issue, you may want to test this solution and share your thoughts.</p>
</div>
</section>
</div>
<footer>
<p><a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license"><img src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" style="border-width:0;margin-bottom:10px" alt="Creative Commons License" /></a> licensed under a Creative Commons <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">license</a>
<p><span rel="dct:type" property="dct:title" href="http://purl.org/dc/dcmitype/Text">Word of maoo blog</span> by <a rel="cc:attributionURL" property="cc:attributionName" href="http://session.it">Maurizio Pillitu</a></p>
</footer>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-31737927-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>