<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.5.2">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2017-10-09T14:30:36+00:00</updated><id>/</id><title type="html">Sean Temple</title><subtitle>Random and seldom deep thoughts cast into ions for the world to see. Yep, you are not getting that minute back.
</subtitle><entry><title type="html">Gitlab Deploy Script For Your Jekyll Blog</title><link href="/gitlab/2017/10/09/Gitlab-Deploy-Script-For-Your-Jekyll-Blog.html" rel="alternate" type="text/html" title="Gitlab Deploy Script For Your Jekyll Blog" /><published>2017-10-09T13:47:04+00:00</published><updated>2017-10-09T13:47:04+00:00</updated><id>/gitlab/2017/10/09/Gitlab-Deploy-Script-For-Your-Jekyll-Blog</id><content type="html" xml:base="/gitlab/2017/10/09/Gitlab-Deploy-Script-For-Your-Jekyll-Blog.html">&lt;p&gt;The goal here is to deploy our jekyll blog after a push to the master branch. In this example we are deploying to a host running nginx and will need to transfer files after building the site on our gitlab runner. There are quite a few variations of &lt;a href=&quot;https://docs.gitlab.com/runner/&quot;&gt;Gitlab Runners&lt;/a&gt;, but we will be using a Docker Runner in which we will start with one with ruby already installed and then use the &lt;code class=&quot;highlighter-rouge&quot;&gt;before_script&lt;/code&gt; to install anything else we will need.&lt;/p&gt;

&lt;p&gt;Our runner will need ssh access to transfer files, so we will generate a key, add the public key to the &lt;code class=&quot;highlighter-rouge&quot;&gt;authorized_keys&lt;/code&gt; on our “production” host, and add paste the private key as a &lt;code class=&quot;highlighter-rouge&quot;&gt;secret variable&lt;/code&gt; called &lt;code class=&quot;highlighter-rouge&quot;&gt;SSH_PRIVATE_KEY&lt;/code&gt;. Remember our runner is ephemeral and we are basically creating a new machine for every deploy.&lt;/p&gt;

&lt;p&gt;Side note, we could use a &lt;a href=&quot;https://docs.gitlab.com/runner/executors/shell.html&quot;&gt;SSH runner&lt;/a&gt; to simplify this since we would only have to set it up once, which in turn would be faster. But I do prefer the docker method, even with the speed penalty, since the deploy host’s recipe is all contained in the gitlab-ci file.&lt;/p&gt;

&lt;p&gt;Note the use of the &lt;code class=&quot;highlighter-rouge&quot;&gt;tr -d '\r'&lt;/code&gt; exists because the forms used to enter the secret variables can inject carriage returns for multiline values such as a private key.&lt;/p&gt;

&lt;p&gt;Also the &lt;code class=&quot;highlighter-rouge&quot;&gt;when: on_success&lt;/code&gt; is the default, but there as a reminder you can change its value. For example to manual if you want to add an additional step before it deploys.&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;s&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ruby:2.4&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;stages&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;deploy&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;before_script&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# install ssh-agent&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;which&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ssh-agent&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-y&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;openssh-client&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-y&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;)'&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;which&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;rsync&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;||&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-y&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;apt-get&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;rsync&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;-y&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;)'&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# run ssh-agent&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;eval $(ssh-agent -s)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;mkdir -p ~/.ssh&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ssh-add &amp;lt;(echo &quot;$SSH_PRIVATE_KEY&quot; | tr -d '\r')&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;echo -e &quot;Host *\n\tStrictHostKeyChecking no\n\n&quot; &amp;gt; ~/.ssh/config&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gem install bundler&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gem install jekyll&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;bundle install&lt;/span&gt;

&lt;span class=&quot;s&quot;&gt;deploy_prod&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;stage&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;deploy&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;script&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;JEKYLL_ENV=production bundle exec jekyll build&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rsync -avz --delete _site/ ubuntu@seantemple.com:/var/www/seantemple.com&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;environment&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;production&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://seantemple.com&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;when&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;on_success&lt;/span&gt;
  &lt;span class=&quot;s&quot;&gt;only&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;master&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name></name></author><summary type="html">The goal here is to deploy our jekyll blog after a push to the master branch. In this example we are deploying to a host running nginx and will need to transfer files after building the site on our gitlab runner. There are quite a few variations of Gitlab Runners, but we will be using a Docker Runner in which we will start with one with ruby already installed and then use the before_script to install anything else we will need.</summary></entry><entry><title type="html">Jekyll lazy posts</title><link href="/jekyll/scripts/2017/10/04/Jekyll-lazy-posts.html" rel="alternate" type="text/html" title="Jekyll lazy posts" /><published>2017-10-05T02:25:56+00:00</published><updated>2017-10-05T02:25:56+00:00</updated><id>/jekyll/scripts/2017/10/04/Jekyll-lazy-posts</id><content type="html" xml:base="/jekyll/scripts/2017/10/04/Jekyll-lazy-posts.html">&lt;p&gt;Keeping track of dates is hard, why not let the computer do it for you ;-) Previously when I wanted to create a new post I would simply copy an old one and rename it. But the name and date appears in two locations, part of the filename and also in the front matter section. Sounds like a script to me, generally I would go to bash, but I want to brush up on RUBY, pregnant pause be damned.&lt;/p&gt;

&lt;p&gt;The goal here is to create a script in which i would simply pass it the title, and it will use the current time as the date stamp, create the file, populate the front matter section with the same title and date stamp, this time with time, and have some dummy content.&lt;/p&gt;

&lt;p&gt;And while we are at it, adding quotations around the title is way to much work, so we will assume all the arguments are actually the title.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;~/bin/new-post.rb Now is the &lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;to create a post&lt;/code&gt;&lt;/pre&gt;&lt;/figure&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;c1&quot;&gt;#!/usr/bin/ruby&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Create a new post using current time as date stamp&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;NOW&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;now&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;TITLE&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ARGV&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;' '&lt;/span&gt; 
&lt;span class=&quot;no&quot;&gt;DATE&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;%F %T %z&quot;&lt;/span&gt; 
&lt;span class=&quot;no&quot;&gt;FILENAME&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;NOW&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;strftime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;%F-&quot;&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;no&quot;&gt;TITLE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;gsub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/\s+/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'-'&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;s2&quot;&gt;&quot;.markdown&quot;&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;CONTENT&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;=&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
---
layout: post
title: &quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;TITLE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;&quot;
date: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;
categories: new 
---
BODY 

{% highlight shell %}
$ whoami
{% endhighlight %}

[example]: https://example.com
&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOT&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;write&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;FILENAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;CONTENT&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name></name></author><summary type="html">Keeping track of dates is hard, why not let the computer do it for you ;-) Previously when I wanted to create a new post I would simply copy an old one and rename it. But the name and date appears in two locations, part of the filename and also in the front matter section. Sounds like a script to me, generally I would go to bash, but I want to brush up on RUBY, pregnant pause be damned.</summary></entry><entry><title type="html">Gitlab Secret Variables and Carriage Returns</title><link href="/new/2017/10/04/Gitlab-Secret-Variables-and-Carriage-Returns.html" rel="alternate" type="text/html" title="Gitlab Secret Variables and Carriage Returns" /><published>2017-10-05T01:29:36+00:00</published><updated>2017-10-05T01:29:36+00:00</updated><id>/new/2017/10/04/Gitlab-Secret-Variables-and-Carriage-Returns</id><content type="html" xml:base="/new/2017/10/04/Gitlab-Secret-Variables-and-Carriage-Returns.html">&lt;p&gt;Just ran into this while setting up a Gitlab Deploy Runner and wanted to document it before I forget ;-)&lt;/p&gt;

&lt;p&gt;If you use Secret variables in your Gitlab CI/CD and they happen to be multi line, such as a private key, then you might be wondering why you are being asked for a passphrase when you didn’t set one!&lt;/p&gt;

&lt;p&gt;The issue is that multi line values are stored in DOS format, yep “\r\n” vs “\n” which assuming that your runner is UNIX, then ssh-add will want no part of it.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;od -c ~/.ssh/ssh_private_key
0000000   -   -   -   -   -   B   E   G   I   N       O   P   E   N   S
0000020   S   H       P   R   I   V   A   T   E       K   E   Y   -   -
0000040   -   -   -  &lt;span class=&quot;se&quot;&gt;\r&lt;/span&gt;  &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;   c   5   b   w   b   n   T   z   a   C   7&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A quick fix is update you CI configuration to strip out the unwanted passenger. The good news is this will not cause any harm if the carriage returns are not there.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;- ssh-add &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$SSH_PRIVATE_KEY&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;- ssh-add &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$SSH_PRIVATE_KEY&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; | tr -d &lt;span class=&quot;s1&quot;&gt;'\r'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name></name></author><summary type="html">Just ran into this while setting up a Gitlab Deploy Runner and wanted to document it before I forget ;-)</summary></entry><entry><title type="html">Chromebook Air</title><link href="/new/2017/10/03/Chromebook-Air.html" rel="alternate" type="text/html" title="Chromebook Air" /><published>2017-10-03T09:29:56+00:00</published><updated>2017-10-03T09:29:56+00:00</updated><id>/new/2017/10/03/Chromebook-Air</id><content type="html" xml:base="/new/2017/10/03/Chromebook-Air.html">&lt;p&gt;Been looking into &lt;a href=&quot;https://www.google.com/chromebook&quot;&gt;Chromebooks&lt;/a&gt; since the kiddo uses one at school. Apparently Thin is back In, clients that is. To be honest it makes a lot of sense, especially at the school level. Kids are not assigned individual chromebooks, they simply access the ones in the classroom or library. They are free from lugging a device class to class, which means they are less likely to damage or lose it.&lt;/p&gt;

&lt;p&gt;The kiddo already has a 2010 Macbook Air thats actually in great shape. The only thing is next to the iPad she barely uses it. And to be honest, most of todays chromebook do look eerily similar to a 2010 Macbook Air anyway ;-) So with a lot of help from a company called &lt;a href=&quot;https://www.neverware.com&quot;&gt;Neverware&lt;/a&gt; we will convert that bad boy into a chromebook. &lt;a href=&quot;https://www.neverware.com&quot;&gt;Neverware&lt;/a&gt; provides tools to organization to re purpose their older hardware and use them as chromebooks via &lt;a href=&quot;https://www.chromium.org/chromium-os&quot;&gt;chromium OS project&lt;/a&gt;, the open source version of chrome os. They provide &lt;a href=&quot;https://www.neverware.com/freedownload&quot;&gt;distributions&lt;/a&gt; for PC and Mac to create a USB stick. The great part here is that you can simply boot off the USB to take it for a spin, and then install it locally with a few clicks, no shell or dd required.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/chromebook-air.jpg&quot; alt=&quot;chromebook air&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">Been looking into Chromebooks since the kiddo uses one at school. Apparently Thin is back In, clients that is. To be honest it makes a lot of sense, especially at the school level. Kids are not assigned individual chromebooks, they simply access the ones in the classroom or library. They are free from lugging a device class to class, which means they are less likely to damage or lose it.</summary></entry><entry><title type="html">Update all containers</title><link href="/proxmox/bash/admin/2017/10/01/update-all-containers.html" rel="alternate" type="text/html" title="Update all containers" /><published>2017-10-01T15:24:32+00:00</published><updated>2017-10-01T15:24:32+00:00</updated><id>/proxmox/bash/admin/2017/10/01/update-all-containers</id><content type="html" xml:base="/proxmox/bash/admin/2017/10/01/update-all-containers.html">&lt;p&gt;My basement full of random servers has slowly consolidated into containers running on a &lt;a href=&quot;https://www.proxmox.com&quot;&gt;Proxmox&lt;/a&gt; server. Containers are a light weight virtuals leveraging the host kernel, similar to &lt;a href=&quot;https://www.freebsd.org/doc/handbook/jails-build.html&quot;&gt;Jails&lt;/a&gt; on &lt;a href=&quot;https://www.freebsd.org/&quot;&gt;FreeBSD&lt;/a&gt;. &lt;a href=&quot;https://www.proxmox.com&quot;&gt;Proxmox&lt;/a&gt; provides &lt;a href=&quot;https://pve.proxmox.com/pve-docs/pct.1.html&quot;&gt;pct&lt;/a&gt; to manage these containers.&lt;/p&gt;

&lt;p&gt;So the goal here is to script up apt updating and upgrading all containers. This will also provide a template on iterating and executing commands on multiple containers.&lt;/p&gt;

&lt;p&gt;As all things on Unix there are a few ways to skin a cat, so while I could use ssh to get things started on the containers I’m going to defer to &lt;code class=&quot;highlighter-rouge&quot;&gt;pct exec&lt;/code&gt; which takes a container id and execs a command as root inside that container. For example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;sudo pct &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;100 apt update&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next we will need to get a list of container ids to iterate through. Again a couple million ways to do this, some based on file system &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/pve/nodes/sinistar/lxc/&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;/var/lib/lxc/&lt;/code&gt; but again I will defer to &lt;code class=&quot;highlighter-rouge&quot;&gt;pct list&lt;/code&gt; to provide this information. The output looks like this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;VMID       Status     Lock         Name                
100        running                 dvr                 
101        running                 timecapsule         
102        running                 gitlab              
104        running                 wintersetpta        
105        running                 mail                &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So we will need to cut the ids out of it with a little help of &lt;code class=&quot;highlighter-rouge&quot;&gt;cut&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;tail&lt;/code&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;sudo pct list | tail -n +2 | cut -f1 -d&lt;span class=&quot;s1&quot;&gt;' '&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Will do the trick.&lt;/p&gt;

&lt;p&gt;Now since we are issuing commands within another command ( &lt;code class=&quot;highlighter-rouge&quot;&gt;pct exec&lt;/code&gt; ) we will have to find the incantation to escape the code we want executed on the remote machine. After a little googling looks like wrapping them up in bash will do the trick:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;sudo pct &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;100 -- bash -c &lt;span class=&quot;s2&quot;&gt;&quot;apt update &amp;amp;&amp;amp; apt upgrade -y&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now lets assemble all the parts from above and create a little script to do our bidding!&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# update all containers&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# list of container ids we need to iterate through &lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;containers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;pct list | tail -n +2 | cut -f1 -d&lt;span class=&quot;s1&quot;&gt;' '&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;function &lt;/span&gt;update_container&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Updating &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$container&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;...&quot;&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;# to chain commands within one exec we will need to wrap them in bash&lt;/span&gt;
  pct &lt;span class=&quot;nb&quot;&gt;exec&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$container&lt;/span&gt; -- bash -c &lt;span class=&quot;s2&quot;&gt;&quot;apt update &amp;amp;&amp;amp; apt upgrade -y&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;container &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$containers&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;do
  &lt;/span&gt;update_container &lt;span class=&quot;nv&quot;&gt;$container&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name></name></author><summary type="html">My basement full of random servers has slowly consolidated into containers running on a Proxmox server. Containers are a light weight virtuals leveraging the host kernel, similar to Jails on FreeBSD. Proxmox provides pct to manage these containers.</summary></entry><entry><title type="html">Home sweet VPN</title><link href="/vpn/docker/2017/09/28/home-sweet-vpn.html" rel="alternate" type="text/html" title="Home sweet VPN" /><published>2017-09-28T13:25:32+00:00</published><updated>2017-09-28T13:25:32+00:00</updated><id>/vpn/docker/2017/09/28/home-sweet-vpn</id><content type="html" xml:base="/vpn/docker/2017/09/28/home-sweet-vpn.html">&lt;p&gt;Not than I am on the road much but it would be nice to be able to have some semblance of security if I find myself riding some sketchy Wifi. In other words, I needed an excuse to setup a VPN. Added bonus checking in on local services at home no longer require port mapping.&lt;/p&gt;

&lt;p&gt;Originally I was going to fire up yet another container on Proxmox and setup a VPN. After a little coffee and contemplation I stumbled about this little gem,  &lt;a href=&quot;https://github.com/hwdsl2/docker-ipsec-vpn-server&quot;&gt;hwdsl2/docker-ipsec-vpn-server&lt;/a&gt;. A docker image with both &lt;a href=&quot;https://libreswan.org/&quot;&gt;Libreswan&lt;/a&gt; and &lt;a href=&quot;https://github.com/xelerance/xl2tpd&quot;&gt;xl2tpd&lt;/a&gt; that works well with the built in VPN clients for iOS, MacOS and Windows!&lt;/p&gt;

&lt;p&gt;Also the documentation for this project is EXCELLENT!&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;docker pull hwdsl2/ipsec-vpn-server&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name></name></author><summary type="html">Not than I am on the road much but it would be nice to be able to have some semblance of security if I find myself riding some sketchy Wifi. In other words, I needed an excuse to setup a VPN. Added bonus checking in on local services at home no longer require port mapping.</summary></entry><entry><title type="html">Welcome to Jekyll!</title><link href="/jekyll/update/2017/09/21/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll!" /><published>2017-09-21T16:59:32+00:00</published><updated>2017-09-21T16:59:32+00:00</updated><id>/jekyll/update/2017/09/21/welcome-to-jekyll</id><content type="html" xml:base="/jekyll/update/2017/09/21/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;

&lt;p&gt;To add new posts, simply add a file in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory that follows the convention &lt;code class=&quot;highlighter-rouge&quot;&gt;YYYY-MM-DD-name-of-post.ext&lt;/code&gt; and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.&lt;/p&gt;

&lt;p&gt;Jekyll also offers powerful support for code snippets:&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;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hi, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Tom'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#=&amp;gt; prints 'Hi, Tom' to STDOUT.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Check out the &lt;a href=&quot;https://jekyllrb.com/docs/home&quot;&gt;Jekyll docs&lt;/a&gt; for more info on how to get the most out of Jekyll. File all bugs/feature requests at &lt;a href=&quot;https://github.com/jekyll/jekyll&quot;&gt;Jekyll’s GitHub repo&lt;/a&gt;. If you have questions, you can ask them on &lt;a href=&quot;https://talk.jekyllrb.com/&quot;&gt;Jekyll Talk&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.</summary></entry></feed>