<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">ajcrowe.io</title>
<subtitle type="text">ajcrowe.io</subtitle>
<generator uri="https://github.com/jekyll/jekyll">Jekyll</generator>
<link rel="self" type="application/atom+xml" href="https://ajcrowe.io/feed.xml" />
<link rel="alternate" type="text/html" href="https://ajcrowe.io" />
<updated>2017-09-30T20:28:12+01:00</updated>
<id>https://ajcrowe.io/</id>
<author>
  <name>Alex Crowe</name>
  <uri>https://ajcrowe.io/</uri>
  <email>alex@ajcrowe.io</email>
</author>


<entry>
  <title type="html"><![CDATA[Kubernetes GCP HTTP Load-Balancer Tips]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2016/04/kubernetes-gcp-http-load-balancing-tips" />
  <id>https://ajcrowe.io/2016/04/kubernetes-gcp-http-load-balancing-tips</id>
  <published>2016-04-26T00:00:00+01:00</published>
  <updated>2016-04-26T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;We are in the midst of deploying a Kubernetes setup for one of our products on &lt;a href=&quot;https://cloud.google.com/&quot;&gt;GCP&lt;/a&gt; using &lt;a href=&quot;https://cloud.google.com/container-engine/&quot;&gt;GKE&lt;/a&gt; and so far it’s been a great experience. I thought I would share a couple of tips around how the &lt;a href=&quot;http://kubernetes.io/docs/user-guide/ingress/&quot;&gt;ingress&lt;/a&gt; resource works with the &lt;a href=&quot;https://cloud.google.com/compute/docs/load-balancing/http/&quot;&gt;GCP HTTP(s) Load-balancer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Google provides some great &lt;a href=&quot;https://cloud.google.com/container-engine/docs/tutorials/http-balancer&quot;&gt;instructions&lt;/a&gt; on getting ingress up and running however we had a couple of things which I thought would be worth sharing to help others.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Custom health check URL for GCP healtcheck resource&lt;/li&gt;
  &lt;li&gt;Ingress with multiple clusters in a GCP project&lt;/li&gt;
  &lt;li&gt;Firewall rules to your services&lt;/li&gt;
  &lt;li&gt;Beware the Backend Services quota&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;health-check--cluster-uid&quot;&gt;Health check &amp;amp; cluster-uid&lt;/h3&gt;

&lt;p&gt;Fortunately the first two of these are features which can be enabled by manually editing the GLBC replication controller, you can the &lt;code class=&quot;highlighter-rouge&quot;&gt;cluster-uid&lt;/code&gt; example &lt;a href=&quot;https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/BETA_LIMITATIONS.md&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kubectl get rc &lt;span class=&quot;nt&quot;&gt;--namespace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;kube-system
NAME                             DESIRED   CURRENT   AGE
elasticsearch-logging-v1         2         2         26m
heapster-v1.0.0                  1         1         26m
kibana-logging-v1                1         1         26m
kube-dns-v11                     1         1         26m
kubernetes-dashboard-v1.0.0      1         1         26m
l7-lb-controller-v0.6.0          1         1         26m
monitoring-influxdb-grafana-v3   1         1         26m

&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kubectl edit rc l7-lb-controller-v0.6.0 &lt;span class=&quot;nt&quot;&gt;--namespace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;kube-system&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can then edit the args array in the yml to include the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;--default-backend-service=kube-system/default-http-backend&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;--sync-period=300s&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;--cluster-uid=uid&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;--health-check-path=/healthcheck/&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Once saved delete the old pod and let the RC recreate it&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;kubectl delete pod &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;glbc &lt;span class=&quot;nt&quot;&gt;--namespace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;kube-system
pod &lt;span class=&quot;s2&quot;&gt;&quot;l7-lb-controller-v0.6.0-ud9ix&quot;&lt;/span&gt; deleted&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;uid&lt;/code&gt; can be anything you like in our case this references the environment. Once this is set all the various resources in your project will have &lt;code class=&quot;highlighter-rouge&quot;&gt;--uid&lt;/code&gt; apended to them allowing meaning cluster wont clash.&lt;/p&gt;

&lt;p&gt;One gotcha about changing the healtcheck here is that this will apply to &lt;em&gt;all&lt;/em&gt; you ingress resources, so you’ll need to make sure all your services return a 200 on this path.&lt;/p&gt;

&lt;h3 id=&quot;firewall&quot;&gt;Firewall&lt;/h3&gt;

&lt;p&gt;The Google guide suggests configuring your firewall by extracting the NodePort assigned by Kubernetes and then creating firewall rules for this, but once you have more than a few services we have found it far easier to statically assign within a range and create a generic firewall rule which covers these and all future services.&lt;/p&gt;

&lt;p&gt;For example if we assign our services to use &lt;code class=&quot;highlighter-rouge&quot;&gt;30000-31000&lt;/code&gt; as their &lt;code class=&quot;highlighter-rouge&quot;&gt;nodePort&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;apiVersion&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;v1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;kind&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Service&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;app-svc&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;labels&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;app&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;spec&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;NodePort&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;ports&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;80&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;nodePort&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;30000&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;app&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We can then create a single run like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;gcloud compute firewall-rules create allow-http-lb &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--source-ranges&lt;/span&gt; 130.211.0.0/22 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--target-tags&lt;/span&gt; &amp;lt;cluster-tag&amp;gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--allow&lt;/span&gt; tcp:30000-31000&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;backend-service-quota&quot;&gt;Backend Service Quota&lt;/h3&gt;

&lt;p&gt;Finally not really a tip as much as a heads up. Google by default gives you 3 &lt;a href=&quot;https://cloud.google.com/compute/docs/load-balancing/http/backend-service&quot;&gt;Backend Services&lt;/a&gt;, however this is really inadequate once you start creating multiple services in your ingress resources.&lt;/p&gt;

&lt;p&gt;You can request more, however it appears there is a cap of 30 per project without special approval.&lt;/p&gt;

&lt;p&gt;I hope some of the manual step and limitations above will soon be replaced with automated options as Ingress moves from beta to production ready in &lt;code class=&quot;highlighter-rouge&quot;&gt;1.3&lt;/code&gt;, but even now in beta we have been impressed with how well everything fit together and works.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2016/04/kubernetes-gcp-http-load-balancing-tips&quot;&gt;Kubernetes GCP HTTP Load-Balancer Tips&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on April 26, 2016.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Managing Your Puppet World with r10k]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2015/11/managing-your-puppet-world-with-r10k" />
  <id>https://ajcrowe.io/2015/11/managing-your-puppet-world-with-r10k</id>
  <published>2015-11-12T21:55:12+00:00</published>
  <updated>2015-11-12T21:55:12+00:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;Puppet is a great tool for managing your infrastructure, most people start of with a few modules to manage various core services. However as the number of modules grows and therefore the complexity better systems are required to keep things running smoothly.&lt;/p&gt;

&lt;p&gt;I’m going to give an overview of how we have structured things. This wont be an extensive technical how-to, more tips and pointers on how we have things setup which will hopefully help out others.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#version-all-the-things&quot; id=&quot;markdown-toc-version-all-the-things&quot;&gt;Version all the things&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#module-versioning&quot; id=&quot;markdown-toc-module-versioning&quot;&gt;Module Versioning&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#environment-management-with-r10k&quot; id=&quot;markdown-toc-environment-management-with-r10k&quot;&gt;Environment Management with r10k&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#the-data-hiera&quot; id=&quot;markdown-toc-the-data-hiera&quot;&gt;The Data (Hiera)&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#config-examples&quot; id=&quot;markdown-toc-config-examples&quot;&gt;Config Examples&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#puppetfile&quot; id=&quot;markdown-toc-puppetfile&quot;&gt;Puppetfile&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#etcr10kyaml&quot; id=&quot;markdown-toc-etcr10kyaml&quot;&gt;/etc/r10k.yaml&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#work-flow--tips&quot; id=&quot;markdown-toc-work-flow--tips&quot;&gt;Work-Flow &amp;amp; Tips&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#new-environment&quot; id=&quot;markdown-toc-new-environment&quot;&gt;New Environment&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#difference-between-environments&quot; id=&quot;markdown-toc-difference-between-environments&quot;&gt;Difference Between Environments&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#development-environment&quot; id=&quot;markdown-toc-development-environment&quot;&gt;Development Environment&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;version-all-the-things&quot;&gt;Version all the things&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/puppet-version.jpg&quot; alt=&quot;Version&quot; /&gt;&lt;/p&gt;

&lt;p&gt;One of the core tenants of DevOps is to version &lt;em&gt;everything&lt;/em&gt;. If you can’t track and trace whats changing in your infrastructure you’re storing up a world of pain as things grow in complexity.&lt;/p&gt;

&lt;p&gt;Git makes branching really easy, some would say &lt;em&gt;too&lt;/em&gt; easy. By using branching and tagging effectively you can still make large changes to your modules and preserve a stable production state (which can be destroyed and rebuilt identically).&lt;/p&gt;

&lt;h4 id=&quot;module-versioning&quot;&gt;Module Versioning&lt;/h4&gt;

&lt;p&gt;We used to operate with a single monolithic git repo which contained all our puppet configuration, but once we moved to multiple environments things started getting a bit out of hand. So start by making sure all your modules are in their own repo and versioned. We went through pulling each module out one at a time and versioning them as we went (&lt;a href=&quot;http://semver.org/&quot;&gt;using semver&lt;/a&gt; of course). These were then moved to our local &lt;a href=&quot;https://about.gitlab.com/&quot;&gt;GitLab&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now you have all your modules source controlled in their own repo, but how do you tie them all together? Enter &lt;a href=&quot;https://github.com/adrienthebo/r10k&quot;&gt;r10k&lt;/a&gt;.&lt;/p&gt;

&lt;h4 id=&quot;environment-management-with-r10k&quot;&gt;Environment Management with r10k&lt;/h4&gt;

&lt;p&gt;To manage our environments we use r10k. This builds on &lt;a href=&quot;https://github.com/rodjek/librarian-puppet&quot;&gt;librarian-puppet&lt;/a&gt; making dynamic environment much easier. r10k will create an environment for each git branch it finds in your r10k repo, you can also selectively build/update environments if needed. The Puppetfile in each branch is then used to build the modules.&lt;/p&gt;

&lt;h4 id=&quot;the-data-hiera&quot;&gt;The Data (Hiera)&lt;/h4&gt;

&lt;p&gt;Finally we need to source control our module data in &lt;a href=&quot;http://docs.puppetlabs.com/hiera/&quot;&gt;Hiera&lt;/a&gt;. This can be either in YAML or JSON, we’ve increasingly found JSON better for our needs. We have a single branch for all our data as we split things based on custom facts, but you can now also have hiera data per environment which is something we are looking at moving to.&lt;/p&gt;

&lt;h2 id=&quot;config-examples&quot;&gt;Config Examples&lt;/h2&gt;

&lt;p&gt;Our r10k structure looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
├── dist &lt;span class=&quot;c&quot;&gt;# contains common bits&lt;/span&gt;
│   ├── base    &lt;span class=&quot;c&quot;&gt;# base classes&lt;/span&gt;
│   ├── profile &lt;span class=&quot;c&quot;&gt;# node profiles&lt;/span&gt;
│   └── role    &lt;span class=&quot;c&quot;&gt;# node roles &lt;/span&gt;
├── manifests
│   └── site.pp &lt;span class=&quot;c&quot;&gt;# single line hiera_include('classes') for ENC&lt;/span&gt;
└── Puppetfile  &lt;span class=&quot;c&quot;&gt;# modules&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;puppetfile&quot;&gt;Puppetfile&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;forge&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'http://forge.puppetlabs.com'&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Puppet Forge Modules&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ajcrowe/supervisord'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.3.1'&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'puppetlabs/firewall'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.4.2'&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'puppetlabs/ntp'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'2.0.1'&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'puppetlabs/stdlib'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'4.1.0'&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ripienaar/concat'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.2.0'&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Public Github Modules&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'my_forked_module'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'https://github.com/ajcrowe/module.git'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ref&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'my_branch'&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'my_public_module'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'https://github.com/pancentric/puppet-logstashforwarder'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Private Gitlab Modules&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'module1'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'git@gitlab.example.org:puppet/module1.git'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ref&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.1.2'&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'module2'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:git&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'git@gitlab.example.org:puppet/module2.git'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ref&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'0.3.5'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;etcr10kyaml&quot;&gt;/etc/r10k.yaml&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;s&quot;&gt;:cachedir&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/var/cache/r10k'&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;:sources&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;:r10k&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;git@gitlab:ops/r10k.git'&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;basedir&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;/etc/puppet/environments'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;work-flow--tips&quot;&gt;Work-Flow &amp;amp; Tips&lt;/h2&gt;

&lt;p&gt;So how does this work in practice?&lt;/p&gt;

&lt;h4 id=&quot;new-environment&quot;&gt;New Environment&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;r10k
git checkout &lt;span class=&quot;nt&quot;&gt;-b&lt;/span&gt; new_environment                &lt;span class=&quot;c&quot;&gt;# create new branch&lt;/span&gt;
vim Puppetfile                                 &lt;span class=&quot;c&quot;&gt;# make changes to module version&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-am&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'updated module x to version x'&lt;/span&gt;
git push origin new_environment	               &lt;span class=&quot;c&quot;&gt;# push new branch&lt;/span&gt;
ssh puppetmaster                             
r10k deploy environment new_environment &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt;     &lt;span class=&quot;c&quot;&gt;# deploy new environment&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also then update a single module with the following:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ssh puppetmaster
r10k deploy module &amp;lt;module&amp;gt; &lt;span class=&quot;nt&quot;&gt;-e&lt;/span&gt; &amp;lt;environment&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also quite easily automate these changes using CI when things are committed to your r10k repo.&lt;/p&gt;

&lt;h4 id=&quot;difference-between-environments&quot;&gt;Difference Between Environments&lt;/h4&gt;

&lt;p&gt;One of the great advantages to this is visibility. Difference between testing and staging:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;git checkout testing
git diff staging
diff &lt;span class=&quot;nt&quot;&gt;--git&lt;/span&gt; a/Puppetfile b/Puppetfile
index f241eef..7dd72c5 100644
&lt;span class=&quot;nt&quot;&gt;---&lt;/span&gt; a/Puppetfile
+++ b/Puppetfile
@@ &lt;span class=&quot;nt&quot;&gt;-12&lt;/span&gt;,7 +12,7 @@ mod &lt;span class=&quot;s1&quot;&gt;'maestrodev/rvm'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'1.5.1'&lt;/span&gt;
 mod &lt;span class=&quot;s1&quot;&gt;'maestrodev/wget'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'1.3.2'&lt;/span&gt;
 mod &lt;span class=&quot;s1&quot;&gt;'pdxcat/collectd'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'1.1.0'&lt;/span&gt;
 mod &lt;span class=&quot;s1&quot;&gt;'puppetlabs/activemq'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'0.2.0'&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;-mod&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'puppetlabs/apache'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'0.10.0'&lt;/span&gt;
+mod &lt;span class=&quot;s1&quot;&gt;'puppetlabs/apache'&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;'1.0.1'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4 id=&quot;development-environment&quot;&gt;Development Environment&lt;/h4&gt;

&lt;p&gt;Another useful tip is to have a bleed edge environment which tracks the &lt;code class=&quot;highlighter-rouge&quot;&gt;master&lt;/code&gt; branch of your modules and potentially the &lt;code class=&quot;highlighter-rouge&quot;&gt;latest&lt;/code&gt; versions from the forge. You can then set this to automatically build and you can test against this for possible problems before bumping your versioned environment.&lt;/p&gt;

&lt;p&gt;The flexibility you gain from r10k’s dynamic environment has certainly help increase the speed and safety of our puppet changes, hopefully the above will help you to as well.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2015/11/managing-your-puppet-world-with-r10k&quot;&gt;Managing Your Puppet World with r10k&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on November 12, 2015.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[CoreOS XenServer Install Fix]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2014/07/coreos-xenserver-fix" />
  <id>https://ajcrowe.io/2014/07/coreos-xenserver-fix</id>
  <published>2014-07-16T22:55:12+01:00</published>
  <updated>2014-07-16T22:55:12+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;I’ve been playing around with the new OS on the block &lt;a href=&quot;http://coreos.com&quot;&gt;CoreOS&lt;/a&gt;. After running it locally with Vagrant I wanted to get it up and running on our XenServer test pool.&lt;/p&gt;

&lt;p&gt;I grabbed the &lt;a href=&quot;https://coreos.com/docs/running-coreos/platforms/iso/&quot;&gt;ISO&lt;/a&gt;, created a new VM and installed it without issue. However after rebooting it just looped indefinity.&lt;/p&gt;

&lt;p&gt;After a chat in the helpful IRC channel it turns out &lt;a href=&quot;http://en.wikipedia.org/wiki/Kexec&quot;&gt;kexec&lt;/a&gt; was not being disabled for Xen installs, the fix below sorts this out post install. This has been &lt;a href=&quot;https://groups.google.com/forum/#!topic/coreos-dev/sU84cRweKk4&quot;&gt;addressed&lt;/a&gt; and should be in the alpha channel shortly but in the mean time hopefully someone finds this useful.&lt;/p&gt;

&lt;p&gt;After the install you’ll need to tweak the boot partition as follows:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt;
mount &lt;span class=&quot;nv&quot;&gt;LABEL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;EFI-SYSTEM /mnt
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;DEFAULT coreos.A&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; /mnt/syslinux/default.cfg
umount /mnt&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This might disappear after an update in which case booting the install os and repeating the above should work, either way this should get you up and running.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2014/07/coreos-xenserver-fix&quot;&gt;CoreOS XenServer Install Fix&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on July 16, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Building Atom on Ubuntu 14.04]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2014/05/atom-on-ubuntu-trusty" />
  <id>https://ajcrowe.io/2014/05/atom-on-ubuntu-trusty</id>
  <published>2014-05-06T00:00:00+01:00</published>
  <updated>2014-05-06T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;Having seen news &lt;a href=&quot;https://github.com&quot;&gt;GitHub&lt;/a&gt; have Open Sourced their take on a text editor I thought I would give it a whirl. There are no pre-build packages available for Linux so lets build it ourselves.&lt;/p&gt;

&lt;h2 id=&quot;installing-node&quot;&gt;Installing Node&lt;/h2&gt;

&lt;p&gt;Ubuntu 14.04 has a pretty up to date version of node bundled which should be fine, but I’ve grabbed the latest version and built it myself.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get install build-essential
...
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
...
&lt;span class=&quot;nb&quot;&gt;tar&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-xzf&lt;/span&gt; node-v0.10.28.tar.gz
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;node-v0.10.28
./configure &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; make &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;make install
...
node &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
0.10.28
npm &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt;
1.4.9&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;build-atom&quot;&gt;Build Atom&lt;/h2&gt;

&lt;p&gt;Now lets follow the instructions in the Atom &lt;a href=&quot;https://github.com/atom/atom/blob/master/README.md&quot;&gt;README&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get install libgnome-keyring-dev
npm config &lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;python /usr/bin/python2 &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# to ensure that gyp uses Python 2&lt;/span&gt;
git clone https://github.com/atom/atom
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;atom
script/build &lt;span class=&quot;c&quot;&gt;# Creates application at /tmp/atom-build/Atom&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;script/grunt install &lt;span class=&quot;c&quot;&gt;# Installs command to /usr/local/bin/atom&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;However when we run the script &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/local/bin/atom&lt;/code&gt; we get nothing, not very useful! However we can see there is a problem missing lib when we run ldd on the binary:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;ldd /usr/local/share/atom/atom | &lt;span class=&quot;nb&quot;&gt;grep&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;not found&quot;&lt;/span&gt;
libudev.so.0 &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; not found&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So lets grab the older &lt;a href=&quot;http://packages.ubuntu.com/precise/libudev0&quot;&gt;libudev0&lt;/a&gt; from the Ubuntu 12.04 package repos&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;wget http://mirrors.kernel.org/ubuntu/pool/main/u/udev/libudev0_175-0ubuntu9_amd64.deb
dpkg &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; libudev0_175-0ubuntu9_amd64.deb&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Atom should have all it needs to launch!&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;atom&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;/images/atom.png&quot; alt=&quot;Atom&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Any questions post them bellow.&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2014/05/atom-on-ubuntu-trusty&quot;&gt;Building Atom on Ubuntu 14.04&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on May 06, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Changing GitLab Repository Access Rights]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2014/02/changing-gitlabs-repository-access-rights" />
  <id>https://ajcrowe.io/2014/02/changing-gitlabs-repository-access-rights</id>
  <published>2014-02-16T00:00:00+00:00</published>
  <updated>2014-02-16T00:00:00+00:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;We love using &lt;a href=&quot;http://gitlab.org&quot;&gt;GitLab&lt;/a&gt; at &lt;a href=&quot;http://www.pancentric.com&quot;&gt;Pancentric&lt;/a&gt;, if you haven’t checked it out you really should. However one minor grip we’ve had is permissions.&lt;/p&gt;

&lt;p&gt;By default only users who are &lt;em&gt;owners&lt;/em&gt; on a project can create milestones and open/close all the issues present. This makes a lot of sense on projects which are available externally, but when you are dealing with trusted colleagues this just gets in the way of getting things done!&lt;/p&gt;

&lt;p&gt;The assignment of permissions is cumulative so each level up gets all the permissions of the previous with some additions. These are defined in the &lt;code class=&quot;highlighter-rouge&quot;&gt;app/models/ability.rb&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Simply shuffling symbols about allow you to change what each level grants the user, in our case we move the &lt;code class=&quot;highlighter-rouge&quot;&gt;:admin_issue&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;:admin_milestone&lt;/code&gt; from the &lt;code class=&quot;highlighter-rouge&quot;&gt;project_master_rules&lt;/code&gt; into the &lt;code class=&quot;highlighter-rouge&quot;&gt;project_report_rules&lt;/code&gt; method.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;project_report_rules&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;project_guest_rules&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:download_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:fork_project&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:write_project_snippet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# moved these from project_master_rules role&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:modify_issue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:admin_issue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;ss&quot;&gt;:admin_milestone&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can shuffle these to suit your own needs, but remember if you want to upgrade you’ll need to revert the change before you can pull newer versions of GitLab.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;*note this is accurate as of GitLab 6.5, YMMV with other versions&lt;/em&gt;&lt;/p&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2014/02/changing-gitlabs-repository-access-rights&quot;&gt;Changing GitLab Repository Access Rights&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on February 16, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[uWSGI Emperor behind Nginx on Debian]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2014/02/nginx-uwsgi-debian" />
  <id>https://ajcrowe.io/2014/02/nginx-uwsgi-debian</id>
  <published>2014-02-15T00:00:00+00:00</published>
  <updated>2014-02-15T00:00:00+00:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;uWSGI is an extremely flexible and fast application server which is rapidly growing in popularity. From its early roots in Python it has quickly adding support for additional languages such as Ruby, PHP and may others.&lt;/p&gt;

&lt;p&gt;I’ll be looking at how we’ve deployed uWSGI behind Nginx using virtual hosting. I will also mention some of the clever features &lt;em&gt;(with names like zerg and broodlord)&lt;/em&gt; to provide dynamic resource allocation depending on load.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#installation&quot; id=&quot;markdown-toc-installation&quot;&gt;Installation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#configuring-the-emperor&quot; id=&quot;markdown-toc-configuring-the-emperor&quot;&gt;Configuring the Emperor&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nginx-virtual-host&quot; id=&quot;markdown-toc-nginx-virtual-host&quot;&gt;Nginx Virtual Host&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#auto-scaling-workers&quot; id=&quot;markdown-toc-auto-scaling-workers&quot;&gt;Auto-Scaling Workers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;There are a few ways to install uWSGI, but I find the best approach is to use pip. This will install the latest &lt;em&gt;stable&lt;/em&gt; version. It’s worth noting development of uWSGI moves at quite a pace so if you want even more stability you can use the LTS &lt;em&gt;(long term support)&lt;/em&gt; release&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;apt-get install build-essential python-dev
...
pip install uwsgi
&lt;span class=&quot;c&quot;&gt;# Or for the LTS&lt;/span&gt;
pip install http://projects.unbit.it/downloads/uwsgi-lts.tar.gz
...
uwsgi &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
1.9.20&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;That was the easy! Remember to make sure the binary &lt;em&gt;(defaults to /usr/local/bin/uwsgi)&lt;/em&gt; is able to be executed by the user you’ll be running your applications as.&lt;/p&gt;

&lt;h2 id=&quot;configuring-the-emperor&quot;&gt;Configuring the Emperor&lt;/h2&gt;

&lt;p&gt;uWSGI supports a mind boggling number of configuration &lt;a href=&quot;http://uwsgi.readthedocs.org/en/latest/Configuration.html#loading-configuration-files&quot;&gt;formats&lt;/a&gt;. We will be using the ini format.&lt;/p&gt;

&lt;p&gt;First task is to create the folder structure where the ini, log, pid and socket files will live.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mkdir &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /etc/uwsgi/apps-&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;available,enabled&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# this allow us to switch apps on and off&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mkdir &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt; /var/&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;log,run&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;/uwsgi&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Create the Emperor configuration&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;nn&quot;&gt;[uwsgi]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;daemonize&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/log/uwsgi/emperor.log &lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;touch-logreopen&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/uwsgi/logrotate.trigger&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;emperor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/etc/uwsgi/apps-enabled&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;pidfile&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/uwsgi/emperor.pid&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;die-on-term&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true  &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;All the above options are detailed in full in the extensive uWSGI &lt;a href=&quot;http://uwsgi-docs.readthedocs.org/en/latest/Options.html&quot;&gt;docs&lt;/a&gt;. You can run the emperor with &lt;code class=&quot;highlighter-rouge&quot;&gt;uwsgi --ini /etc/uwsgi/emperor.ini&lt;/code&gt; and check everything is working by looking at the log file and ensuring the pid has been created.&lt;/p&gt;

&lt;p&gt;Next we need an init script mine is available &lt;a href=&quot;/assets/files/uwsgi_init_script.txt&quot;&gt;here&lt;/a&gt; but you can use something like supervisor if that’s more your thing.&lt;/p&gt;

&lt;p&gt;You can now place your applications ini files in &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/uwsgi/apps-available&lt;/code&gt; and symbolically link them into your &lt;code class=&quot;highlighter-rouge&quot;&gt;apps-enabled&lt;/code&gt; folder. You should end up with a folder structure looking like this.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;# config&lt;/span&gt;
/etc/uwsgi
├── apps-available
│   ├── app1.ini
│   └── app2.ini
├── apps-enabled
│   ├── app1.ini -&amp;gt; ../apps-available/asone-cs.ini
│   └── app2.ini -&amp;gt; ../apps-available/asone.ini
├── emperor.ini
└── logrotate.trigger
&lt;span class=&quot;c&quot;&gt;# logs&lt;/span&gt;
/var/log/uwsgi
├── app1.log
├── app2.log
└── emperor.log
&lt;span class=&quot;c&quot;&gt;# pid and sockets&lt;/span&gt;
/var/run/uwsgi
├── app1.sock
├── app2.sock
└── emperor.pid&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;nginx-virtual-host&quot;&gt;Nginx Virtual Host&lt;/h2&gt;

&lt;p&gt;Configuring Nginx to connect to your uWSGI instance couldn’t be easier. This is due to the native &lt;a href=&quot;http://uwsgi-docs.readthedocs.org/en/latest/Protocol.html&quot;&gt;uwsgi protocol&lt;/a&gt; support.&lt;/p&gt;

&lt;p&gt;The simplest configuration requires just two lines &lt;code class=&quot;highlighter-rouge&quot;&gt;include uwsgi_params;&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;uwsgi_pass unix:/path/to/socket;&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;uwsgi_pass hostname:port&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here is an example complete vhost.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;server {
	listen 80;
	server_name myapp.example.net;

	root /var/www/myapp;

	access_log /var/log/nginx/myapp.access;
	error_log /var/log/nginx/myapp.error;

	location / {
		include uwsgi_params;
		uwsgi_pass unix:/var/run/uwsgi/myapp.sock;
	}

	location /static/ {
		alias /var/www/myapp/assets/static/;
	}
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;You can also do other lovely things like caching but this will get you up and running.&lt;/p&gt;

&lt;h2 id=&quot;auto-scaling-workers&quot;&gt;Auto-Scaling Workers&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;*note, you must be using Linux and TCP sockets for this to work.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;One of the downsides to this configuration is each application has its own processes and does not share a pool of workers. uWSGI has a solution to this which allows your instances to request addition workers processes from their Emperor called &lt;a href=&quot;http://uwsgi-docs.readthedocs.org/en/latest/Zerg.html&quot;&gt;zergs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To configure your Emperor process to service these requests we need to add the following &lt;code class=&quot;highlighter-rouge&quot;&gt;emperor-broodlord = num&lt;/code&gt;; where &lt;code class=&quot;highlighter-rouge&quot;&gt;num&lt;/code&gt; is how many workers are available, to our existing &lt;code class=&quot;highlighter-rouge&quot;&gt;emperor.ini&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next we configure the application to request these &lt;em&gt;zergs&lt;/em&gt;. We need to modify our existing config and add a zerg section. Below is an example of a before and after.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;c&quot;&gt;# exist config
&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;[uwsgi]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;socket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost:3031&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;master&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;myapp.wsgi&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;processes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disable-logging&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;c&quot;&gt;# modified config
&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;[uwsgi]&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;socket&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;localhost:3031&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;master&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;myapp.wsgi&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;processes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disable-logging&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# new zerg config
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;vassal-sos-backlog&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;10&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;zerg-server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/uwsgi/myapp-broodlord.sock&lt;/span&gt;

&lt;span class=&quot;nn&quot;&gt;[zerg]&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# setting to use for the zerg workers
&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;zerg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;/var/run/uwsgi/myapp-broodlord.sock&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;master&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;myapp.wsgi&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;processes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;disable-logging&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;idle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;30&lt;/span&gt;
&lt;span class=&quot;py&quot;&gt;die-on-idle&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This configuration will result in the application asking for reinforcements when it has a backlog of requests greater than 10. The zergs will automatically die when idle for 30 seconds, returning to the pool for other applications to use.&lt;/p&gt;

&lt;p&gt;I suggest you can play around with these settings and tune them to your specific workload. Set your idle time too low and you might find zergs are constantly starting and stopping, set it too high and you’ll not have resources available for other applications.&lt;/p&gt;

&lt;p&gt;There are tons of other great features in uWSGI, I encourage you to explore the &lt;a href=&quot;http://uwsgi-docs.readthedocs.org/en/latest/index.html&quot;&gt;docs&lt;/a&gt;!&lt;/p&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2014/02/nginx-uwsgi-debian&quot;&gt;uWSGI Emperor behind Nginx on Debian&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on February 15, 2014.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Puppet, Hiera and hashes]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2013/10/creating-your-resources-with-hiera-and-hashes" />
  <id>https://ajcrowe.io/2013/10/creating-your-resources-with-hiera-and-hashes</id>
  <published>2013-10-07T00:00:00+01:00</published>
  <updated>2013-10-07T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;Puppet is a rapidly evolving tool, since we started using it a couple of years ago the language and tools have improved hugely and so has the community around it.&lt;/p&gt;

&lt;p&gt;I’ve recently found some more time to moved our data into yaml to be used by &lt;a href=&quot;http://docs.puppetlabs.com/hiera/1/index.html&quot;&gt;hiera&lt;/a&gt; (we might change some of this to JSON shortly). We have have found using the create_resources function combined with hashes from Hiera to be a really clean and simple way to get our resources configured.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;classes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; 
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;role::web::python::staging&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;pythonapps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;myapp&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;appname&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;myapp&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;gitremote&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;git@github.com:pancentric/myapp.git'&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;uwsgiapps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;myapp&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;processes&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;enabled&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;broodlord&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;envs_myapp&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;DJANGO_SETTINGS_MODULE&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;myapp.settings&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;DJANGO_SECRET_KEY&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;secretkey'&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;DJANGO_CONFIGURATION&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;StagingSettings&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mypassword&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# other params...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Then we can query Hiera for the hashes and pass them to the exceedingly useful &lt;a href=&quot;http://docs.puppetlabs.com/references/latest/function.html#createresources&quot;&gt;create_resources&lt;/a&gt; function which will loop over each hash passing the nested hashes to the function specified.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;profile&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;web&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# other classes...&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uwsgi&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pythonenv&lt;/span&gt;
  
  &lt;span class=&quot;vg&quot;&gt;$pythonenvs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiera&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'pythonenvs'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;vg&quot;&gt;$uwsgiapps&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hiera&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'uwsgiapps'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;create_resources&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pythonenv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;$pythonenvs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;create_resources&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;uwsgi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;vg&quot;&gt;$uwsgiapps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This method also a great way of passing a larger number of key/value pairs into your code. In our instance we have a number of common environment variables for our Django app which both pythonenv::app and uwsgi::app need to use. We define these once as a hash in our yaml and then do a &lt;code class=&quot;highlighter-rouge&quot;&gt;hiera_hash('env_myapp')&lt;/code&gt; lookup in the puppet code of both modules. This can then be used by the templates as needed.&lt;/p&gt;

&lt;p&gt;If you had common and node specific environment variables by using the &lt;code class=&quot;highlighter-rouge&quot;&gt;hiera_hash()&lt;/code&gt; function hiera will merge all matching results into one hash with the node specific overriding the common.&lt;/p&gt;

&lt;p&gt;All of this allows for not only great separation of data and code, but a much more DRY configuration.&lt;/p&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2013/10/creating-your-resources-with-hiera-and-hashes&quot;&gt;Puppet, Hiera and hashes&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on October 07, 2013.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[SmartOS as a Monitoring Host]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2013/09/smartos-as-a-monitoring-host" />
  <id>https://ajcrowe.io/2013/09/smartos-as-a-monitoring-host</id>
  <published>2013-09-10T00:00:00+01:00</published>
  <updated>2013-09-10T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;For many in the UNIX world the demise of &lt;a href=&quot;http://en.wikipedia.org/wiki/Sun_Microsystems&quot;&gt;Sun Microsystems&lt;/a&gt; in 2009 was a frustrating experience. Just as Sun appeared to be embracing the Open Source world, they are gobbled up by the juggernaut that is Oracle who swiftly axed the OpenSolaris project.&lt;/p&gt;

&lt;p&gt;However despite their demise Sun open sourced a number of fantastic technologies that have been picked up by new smaller companies (staffed by some of the best ex-Sun engineers) who are committed to continue developing the technologies openly.&lt;/p&gt;

&lt;p&gt;In this post I will talk about some of the experiences I have had with &lt;a href=&quot;http://smartos.org&quot;&gt;SmartOS&lt;/a&gt;. A distribution built on the foundations of Solaris but for a cloudier world.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://joyent.com&quot;&gt;Joyent&lt;/a&gt; are the company that backs SmartOS. The distribution has a number interesting design decisions that make it quite different from other platforms. Joyent’s biggest contribution to the open source Illumos kernel has been porting KVM from Linux, this allow SmartOS (or any Illumos distro) to run Linux and Windows VMs rather than just native SmartOS zones. This in and of itself is nothing special but when you put KVM’s virtualisation capabilities on top &lt;a href=&quot;http://en.wikipedia.org/wiki/ZFS&quot;&gt;ZFS&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/OpenSolaris_Network_Virtualization_and_Resource_Control&quot;&gt;Crossbow&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Solaris_Containers&quot;&gt;Zones&lt;/a&gt; you get a great platform. Joyent’s views on cloud architecture differ from other cloud providers such as Amazon principally in the area of storage. Joyent explores some of the difference &lt;a href=&quot;http://joyent.com/blog/magical-block-store-when-abstractions-fail-us&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;our-usage&quot;&gt;Our Usage&lt;/h2&gt;

&lt;p&gt;Having read about SmartOS awhile ago I was keen to find a good reason to play around with it. Our hosting systems run on top of Xen with a storage SAN, so SmartOS was not a good fit for our general use. However the retirement of our old monitoring server proved an ideal candidate. Rather than simply replace like for like we decided to consolidate a number of our virtual and physical servers onto a dedicated monitoring hypervisor running SmartOS.&lt;/p&gt;

&lt;p&gt;This allow us to improve our security with a more heterogeneous mix of hypervisors. In addition more sensitive services were able to be isolated on a single host. Services such as our Puppet Master, Zabbix monitoring software, Sentry as well as remote log collection. We are also implementing a full packet capture IDS system.&lt;/p&gt;

&lt;p&gt;SmartOS makes it very easy to get up and running quickly with a good number of base templates in both KVM and native flavours. We’ve used a combination of Debian/Ubuntu and native SmartOS VMs for things like PostgreSQL/MySQL where we wanted to get maximum disk performance. With SmartOS leveraging NetBSD’s &lt;a href=&quot;http://www.netbsd.org/docs/software/packages.html&quot;&gt;pkgsrc&lt;/a&gt; you get access to 1000’s of packages, so getting more niche software installed on SmartOS isn’t too much of a chore.&lt;/p&gt;

&lt;p&gt;We are still in the process of deploying the IDS functionality, but early signs are ZFS will save us a huge chunk of space with its built in compression support. While on the topic of ZFS, another great advantage of ZFS is that backup of our VMs becomes extremely simple by rolling a zfs send/recv script we can automate incremental backups easily to other locations.&lt;/p&gt;

&lt;p&gt;A tool which we have found particularly useful to make the process of creating and configuring VMs has been &lt;a href=&quot;http://project-fifo.net&quot;&gt;FiFo&lt;/a&gt;. FiFo is an open-source &lt;em&gt;Cloud Management &amp;amp; Orchestration&lt;/em&gt; system for SmartOS virtualisation environments, it’s still under heavy development but we have found it to be excellent, well worth a look if you fancy a break from the command line and like to see pretty DTrace graphs!&lt;/p&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2013/09/smartos-as-a-monitoring-host&quot;&gt;SmartOS as a Monitoring Host&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on September 10, 2013.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[The Wonderful Evolving Mobile Landscape]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2013/08/evolving-mobile-landscape" />
  <id>https://ajcrowe.io/2013/08/evolving-mobile-landscape</id>
  <published>2013-08-07T00:00:00+01:00</published>
  <updated>2013-08-07T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;For many the battle for the mobile OS is a done deal. Android won and Apple has slipped into 2nd place, Not too dissimilar the battle of the early 90’s when the emerging Microsoft rose to dominate desktop computing. Android has now passed &lt;a href=&quot;http://www.theverge.com/2013/5/15/4333584/total-android-activations-900-million&quot;&gt;900 million&lt;/a&gt; device activations, almost double iOS. So surely it’s a done deal, cue Android hegemony?&lt;/p&gt;

&lt;p&gt;However more now than ever alternatives are springing up. I can imagine thoughts springing to your mind like &lt;em&gt;“how can compete?”&lt;/em&gt;, &lt;em&gt;“They wont have any apps!”&lt;/em&gt; or even simply &lt;em&gt;“Why bother?”&lt;/em&gt;. I’ve certainly wondered the same things, but there is nagging part of my brain saying this time is different.&lt;/p&gt;

&lt;h2 id=&quot;not-your-fathers-os-war&quot;&gt;Not Your Fathers OS War&lt;/h2&gt;

&lt;p&gt;A key difference between now and the last time OS’s were vying for dominance is, of course you’ve guess it the &lt;em&gt;Internet&lt;/em&gt;. This great leveller, doesn’t care if your on Windows, OSX, Linux, Android, iOS. Its open protocols and standards make it an equal opportunities platform. So this begs the question, if the web continues its march to become &lt;em&gt;the&lt;/em&gt; platform for delivering applications, content and connected experiences does the OS even matter in the long run?&lt;/p&gt;

&lt;p&gt;Google has taken this idea the furthest with &lt;a href=&quot;http://en.wikipedia.org/wiki/Google_Chrome_OS&quot;&gt;ChromeOS&lt;/a&gt;, however even the most ardent fan would have a hard time convincing people it’s ready to replace your desktop. But if you, like me subscribe to the view that we are at the end of the beginning and not the beginning of the end of the changes a truly connected world will bring these weakness will slowly fade away. So are we looking at a future where operating systems are reduced to merely glorified browsers?&lt;/p&gt;

&lt;p&gt;Maybe, the pull towards a world driven by the web is undeniable. But I expect the OS to matter for a little longer. So this trend is the first key benefit I see for alternative platforms.&lt;/p&gt;

&lt;h2 id=&quot;people-all-the-people&quot;&gt;People, All the People&lt;/h2&gt;

&lt;p&gt;Mobile technology is an amazing global success story. There are 5 billion mobile phones in use globally of which some 1 billion are smart phones, that’s a lot of dumb phones that’ll be turning smart over the next few years.&lt;/p&gt;

&lt;p&gt;Mozilla for one has explicitly stated it hopes to providing an open source OS built around the web to cater for this emerging demand. But a broader point can be made that the shear numbers involved will create the opportunity for the small to survive, and even flourish.&lt;/p&gt;

&lt;h2 id=&quot;ubiquitous-black-slabs&quot;&gt;Ubiquitous Black Slabs&lt;/h2&gt;

&lt;p&gt;Despite the strongest wishes of Apple, hardware continues to become more commoditised. With each passing year, phones get harder, better, faster, stronger&lt;/p&gt;

&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/gAjR4_CbPpQ&quot; frameborder=&quot;0&quot;&gt;Daft Punk - Harder Better Faster Stronger&lt;/iframe&gt;

&lt;p&gt;As these devices get cheaper and smart phones become simply phones new opportunities will open up in how we use these portable computers. Within a year or two large number of people will be carrying about enough power in their pocket to run the vast majority of the applications. Ubuntu is certainly buying into the converged future where the distinction between desktop, laptop, tablet, phone and everything in between starts to disappear.&lt;/p&gt;

&lt;h2 id=&quot;exciting-times&quot;&gt;Exciting Times&lt;/h2&gt;

&lt;p&gt;It’s incredible to think that only 6 years ago Apple released the first iPhone and Android was racing to catch up. This ushered in an new era of what was possible on a mobile device, opening up new markets and possibilities. I certainly hope the next 6 bring increased choice and the unexpected!&lt;/p&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2013/08/evolving-mobile-landscape&quot;&gt;The Wonderful Evolving Mobile Landscape&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on August 07, 2013.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Nexenta Build]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2013/05/nexenta-build" />
  <id>https://ajcrowe.io/2013/05/nexenta-build</id>
  <published>2013-05-21T00:00:00+01:00</published>
  <updated>2013-05-21T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;&lt;em&gt;*please note I started this post awhile ago, so most of this refers to work from last summer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;From my first experience of ZFS in FreeBSD 7 it was clear this was a game changing approach to storage. It’s mix of features, easy of use, scalability and robustness make it an ideal platform for enterprise storage, and the best part is it’s open source!&lt;/p&gt;

&lt;p&gt;When we were looking at options for a NAS/SAN on a limited budget &lt;em&gt;(when aren’t they&lt;/em&gt;) and offered us something we could grow with, the features of OpenSolaris made a lot of sense. It would allow us to continue to use commodity hardware of our choice (within some limits) and let us customise the system for our needs. But we also wanted support and a real company behind the product, enter &lt;a href=&quot;http://www.nexenta.com/&quot;&gt;Nexenta&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m a big fan of choice, and when it comes to the world of storage the big boys still dominate. The “Big 5” primarily sell storage systems built on their own proprietary combination of hardware and software. This results in high prices, lock-in and lack of flexibility. Increasingly new &lt;em&gt;OpenStorage&lt;/em&gt; companies have begun to emerge to try and take on the big boys and inject some more competition into the market.&lt;/p&gt;

&lt;p&gt;Based on the solid core of OpenSolaris with Debian’s &lt;a href=&quot;http://wiki.debian.org/Apt&quot;&gt;Apt&lt;/a&gt; package manager Nexenta has built a storage based OS distribution which offers ZFS, COMSTAR, Kernel based CIFS/NFS all wrapped in a web based GUI (don’t worry there is a CLI!).&lt;/p&gt;

&lt;p&gt;Below Ill talk talk through how we got on using Nexenta. I hope someone will find some of the tips and information useful if they are setting out on a similar journey.&lt;/p&gt;

&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#initial-kit&quot; id=&quot;markdown-toc-initial-kit&quot;&gt;Initial Kit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#configuration&quot; id=&quot;markdown-toc-configuration&quot;&gt;Configuration&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#thoughts&quot; id=&quot;markdown-toc-thoughts&quot;&gt;Thoughts&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tips&quot; id=&quot;markdown-toc-tips&quot;&gt;Tips&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;initial-kit&quot;&gt;Initial Kit&lt;/h2&gt;

&lt;p&gt;Head-Node&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;HP Proliant DL360G7&lt;/li&gt;
  &lt;li&gt;Intel Xeon E5649 2.56GHz&lt;/li&gt;
  &lt;li&gt;48GB RAM&lt;/li&gt;
  &lt;li&gt;2x 146GB syspool&lt;/li&gt;
  &lt;li&gt;LSI 9200-8e&lt;/li&gt;
  &lt;li&gt;Intel CX4 10GbE NIC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JBOD&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;DataON DNS1600 (Dual Controllers)&lt;/li&gt;
  &lt;li&gt;8x 1TB Toshiba 6G SAS (Data)&lt;/li&gt;
  &lt;li&gt;2x ZeusRAM 8GB 6G SAS (Zil)&lt;/li&gt;
  &lt;li&gt;1x Talos C 230GB SSD (L2Arc)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Network&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;2x HP Procurve 2910al-24G&lt;/li&gt;
  &lt;li&gt;2x HP dual-port 10GbE CX4 al Module&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;

&lt;p&gt;The pool configuration is 4 mirrored vdevs with mirrored Zils and a single L2Arc. We opted for mirrored vdevs rather than raidzX for performance as our use-case was for a write heavy workload. Mirrored vdevs also make rebuild times more predictable and recovery easier should the worst happen easier.&lt;/p&gt;

&lt;p&gt;We accelerated our pool using a mirrored set of ZeusRAM 8GB drives. These ultra fast RAM drives have large super capacitors to protect the data in case of power failure and suffer no write performance degradation over time like some SSDs can. We also added a 230GB OCZ Talos as a L2Arc (read cache).&lt;/p&gt;

&lt;p&gt;This is the pool layout.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmc@nexenta:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;zpool status
pool: tank
 state: ONLINE
 scan: none requested
config:

        NAME                       STATE     READ WRITE CKSUM
        tank                       ONLINE       0     0     0
          mirror-0                 ONLINE       0     0     0
            c0t50000393B8C93020d0  ONLINE       0     0     0
            c0t50000393B8C93064d0  ONLINE       0     0     0
          mirror-1                 ONLINE       0     0     0
            c0t50000393B8C930A8d0  ONLINE       0     0     0
            c0t50000393B8C930ACd0  ONLINE       0     0     0
          mirror-2                 ONLINE       0     0     0
            c0t50000393B8C930DCd0  ONLINE       0     0     0
            c0t50000393B8C930E0d0  ONLINE       0     0     0
          mirror-3                 ONLINE       0     0     0
            c0t50000393B8C93104d0  ONLINE       0     0     0
            c0t50000393E8CAF744d0  ONLINE       0     0     0
        logs
          mirror-4                 ONLINE       0     0     0
            c0t5000A72030044473d0  ONLINE       0     0     0
            c0t5000A72030044478d0  ONLINE       0     0     0
        cache
          c0t5E83A970000020F1d0    ONLINE       0     0     0

errors: No known data errors&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;We created some thinly provisioned zvols which we made available to our hypervisors over iSCSI with COMSTAR. Taking advanced of the MPIO support in COMSTAR to add extra resiliency we used two HP 2910al-24G switches and created two completely separate paths to the storage from the hypervisors. In addition we configured our JBOD to be active/active by connecting each port of the LSI-9200-8e to a SAS port on each controller (see the tips on checking MPxIO is working).&lt;/p&gt;

&lt;h2 id=&quot;thoughts&quot;&gt;Thoughts&lt;/h2&gt;

&lt;p&gt;Since the system went live we’ve had a few blips, most of the solutions to those are covered in the tips sections below. The biggest piece of advice I would give anyone looking a similar build is to find a partner who has experience of deploying such a system, ours has been invaluable when little problems have occurred.&lt;/p&gt;

&lt;p&gt;We have been very pleased with the performance of the system and look forward to having it expand over the coming years.&lt;/p&gt;

&lt;h2 id=&quot;tips&quot;&gt;Tips&lt;/h2&gt;

&lt;p&gt;Few tips if you’re looking at a Nexenta build&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use The HCL!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As NexentaStor is based on an older OpenSolaris build (4.0 will be based on &lt;a href=&quot;http://www.illumos.org/&quot;&gt;Illumos&lt;/a&gt;) it’s driver support can be patchy as Nexenta has to backport drivers, so make sure you stick to kit on the &lt;a href=&quot;http://info.nexenta.com/rs/nexenta/images/nexenta_hardware_supported_list.pdf&quot;&gt;HCL&lt;/a&gt;, Intel &amp;amp; LSI are good choices here.&lt;/p&gt;

&lt;p&gt;We’ve had issues with our Intel CX4 NICs when turning on flow control, this bug is still being investigated by Nexenta and only happens with the mode set to &lt;em&gt;bi&lt;/em&gt; or &lt;em&gt;tx&lt;/em&gt; not &lt;em&gt;rx&lt;/em&gt; (It should be noted this can only be changed from &lt;em&gt;expert mode&lt;/em&gt; so it’s probably debatable whether it’s supported)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don’t Upgrade the Community Edition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you make use of the Community Edition and then choose to go Enterprise make sure you reinstall from scratch, we had issues with missing features and strange performance problems on an upgraded node.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure your network correctly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Make sure you are using decent quality networking kit suitable for iSCSI. Enable jumbo frames, disable spanning tree and enable flow control (this is useful if you’re going to be mixing 1Gbe with 10Gbe).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check your disks are using MPxIO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Assuming you’re using a JBOD that supports active/active controllers you’ll want to make use of &lt;a href=&quot;http://en.wikipedia.org/wiki/Solaris_Multiplexed_I/O&quot;&gt;MPxIO&lt;/a&gt;. However often drives do not get automatically picked up as being multipath capable by the &lt;a href=&quot;http://docs.oracle.com/cd/E19082-01/819-2254/scsi-vhci-7d/index.html&quot;&gt;scsi_vhci&lt;/a&gt; driver. You can check if it’s enabled by looking under the ‘Attach’ column in disks on NMC.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;nmc@muninn:/&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;show lun disk
LUN ID      Device    Type      Size      Volume     Mounted Attach GUID
c0t5&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;020d0  sd50      disk      1TB       tank       no      mpxio  50000393b8c93020
c0t5&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;064d0  sd59      disk      1TB       tank       no      mpxio  50000393b8c93064
c0t5&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;074d0  sd56      disk      1TB       tank       no      mpxio  50000393b8c93074
c0t5&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;0A8d0  sd64      disk      1TB       tank       no      mpxio  50000393b8c930a8&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;If you see mpxio, you’re set. If you see mpt_sas you’ll need append your disk make and model to the &lt;code class=&quot;highlighter-rouge&quot;&gt;/kernel/drv/scsi_vhci.conf&lt;/code&gt; file. This file has a specific format, to make my Toshiba, STEC and OCZ drives work I changed the default:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;scsi-vhci-failover-override &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;&quot;3PARdataVV&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;,
&lt;span class=&quot;s2&quot;&gt;&quot;COMPELNTCompellent Vol&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

becomes

scsi-vhci-failover-override &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;&quot;3PARdataVV&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;,
&lt;span class=&quot;s2&quot;&gt;&quot;COMPELNTCompellent Vol&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;,
&lt;span class=&quot;s2&quot;&gt;&quot;OCZ     TALOS&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;,
&lt;span class=&quot;s2&quot;&gt;&quot;STEC    ZeusRAM&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;,
&lt;span class=&quot;s2&quot;&gt;&quot;TOSHIBA MK1001TRKB&quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&quot;f_sym&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;It’s important to note if the manufacturer name is less than 8 characters you need to add spaces before the module. Once updated you need to reboot for the changes to take effect. You can find your vendor and model by looking at the output of &lt;code class=&quot;highlighter-rouge&quot;&gt;format&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;iostat -E&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hosts file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We had some issues with the management interface appearing to lock up, these turned out to be due to stale information in the &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt; file. Once we updated this to reflect the real primary interface IP the NMC started working again!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XenServer Active/Active MPIO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We use XenServer as our primary hypervisor and found it works really well with NexentaStor when using iSCSI and MPIO. However to get it working in active/active mode you have to tweak the &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/multipath.conf&lt;/code&gt; file as follows&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;...
device &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        vendor                  &lt;span class=&quot;s2&quot;&gt;&quot;NEXENTA&quot;&lt;/span&gt;
        product                 &lt;span class=&quot;s2&quot;&gt;&quot;(COMSTAR|NEXENTASTOR)&quot;&lt;/span&gt;
        path_grouping_policy    group_by_prio
        failback                immediate
        no_path_retry           queue
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
...&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;


  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2013/05/nexenta-build&quot;&gt;Nexenta Build&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on May 21, 2013.&lt;/p&gt;</content>
</entry>


<entry>
  <title type="html"><![CDATA[Welcome to my Blog!]]></title>
  <link rel="alternate" type="text/html" href="https://ajcrowe.io/2013/05/first-post" />
  <id>https://ajcrowe.io/2013/05/first-post</id>
  <published>2013-05-20T00:00:00+01:00</published>
  <updated>2013-05-20T00:00:00+01:00</updated>
  <author>
    <name>Alex Crowe</name>
    <uri>https://ajcrowe.io</uri>
    <email>alex@ajcrowe.io</email>
  </author>
  <content type="html">&lt;p&gt;Over time I hope to be filling this site with some decent content on all the technical things I do day to day to hopefully help others.&lt;/p&gt;

&lt;p&gt;In the mean time here is a picture of a cat.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/cat.jpg&quot; alt=&quot;Cat&quot; /&gt;&lt;/p&gt;

  &lt;p&gt;&lt;a href=&quot;https://ajcrowe.io/2013/05/first-post&quot;&gt;Welcome to my Blog!&lt;/a&gt; was originally published by Alex Crowe at &lt;a href=&quot;https://ajcrowe.io&quot;&gt;ajcrowe.io&lt;/a&gt; on May 20, 2013.&lt;/p&gt;</content>
</entry>

</feed>
