<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WAHOOGA</title>
	<atom:link href="https://www.wahooga.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wahooga.com</link>
	<description></description>
	<lastBuildDate>Fri, 26 Jul 2019 14:56:46 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>

<image>
	<url>https://www.wahooga.com/wp-content/uploads/2018/08/cropped-wahooga_icon-32x32.png</url>
	<title>WAHOOGA</title>
	<link>https://www.wahooga.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Deploy Hugo using GitLab-CI, Docker and SSH</title>
		<link>https://www.wahooga.com/hugo-gitlab/</link>
					<comments>https://www.wahooga.com/hugo-gitlab/#respond</comments>
		
		<dc:creator><![CDATA[David Mellors]]></dc:creator>
		<pubDate>Fri, 12 Jul 2019 15:44:26 +0000</pubDate>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[gitlab]]></category>
		<guid isPermaLink="false">https://www.wahooga.com/?p=146</guid>

					<description><![CDATA[<p>I&#8217;m always interested in trying out different things and I thought it was time I had a look at Hugo the open source static site generator. At the same time I was interested to learn about GitLab-CI and decided to combine both in a little mini project. Hugo Hugo is a framework for building static [&#8230;]</p>
The post <a href="https://www.wahooga.com/hugo-gitlab/">Deploy Hugo using GitLab-CI, Docker and SSH</a> first appeared on <a href="https://www.wahooga.com">WAHOOGA</a>.]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m always interested in trying out different things and I thought it was time I had a look at <a href="https://gohugo.io/">Hugo</a> the open source static site generator. At the same time I was interested to learn about <a href="https://about.gitlab.com/product/continuous-integration/">GitLab-CI</a> and decided to combine both in a little mini project.</p>



<h2>Hugo</h2>



<p>Hugo is a framework for building static sites, it claims to be the world fastest and was something I came across whilst learning Go (Golang) last year. After following the Hugo Quick Start pages  I had a small static web site up and running in no time at all.  But I wanted a way of storing the content in version control and automated way of publishing the pages to my NGINX host.</p>



<p class="has-small-font-size">Not sure how to use Hugo? Visit the excellent <a href="https://gohugo.io/documentation/">Hugo documentation</a> and follow the Getting Started guide. </p>



<h2>GitLab-CI</h2>



<p>I&#8217;ve been using a GitLab free account for a while and until now hadn&#8217;t really had an opportunity to try out the CI/CD features provided. The plan was to use the CI features to build the static pages and then find some way of deploying from a successful build.</p>



<p>GitLab-CI is simple to setup, create a file called .gitlab-ci.yml in the root of your repository containing the build instructions.</p>



<pre class="crayon-plain-tag">stages:
  - build
build:
  stage: build
  image: jojomi/hugo
  script:
  - git submodule update --init --recursive
  - hugo -d public_html
  artifacts:
    paths:
    - public_html
  only:
  - master</pre>



<p class="has-small-font-size">Line 5: Use the jojomi/hugo docker image.<br>Line 7: Update the Hugo theme which was added as a git submodule.<br>Line 8: Run hugo telling it to put the generated content into public_html.<br>Lines 9, 10, 11: Define public_html as containing the build artifacts.<br>Lines 12, 13: Only run on the master branch.</p>



<p>With the .gitlab-ci.yml file in place in the repository I needed a gitlab runner to perform the build steps. For this I installed a local runner on my mac, registered the runner to  my project (using Docker as the executor) and ran the pipeline. It works!</p>



<h2>Deploy artifacts using SSH</h2>



<p>I have a successful build job with build artifacts and I need to upload those artifacts to a web server. This involves adding a deploy stage to the .gitlab-ci.yml and adding variables for SSH to the runner configuration. </p>



<pre class="crayon-plain-tag">deploy:
  stage: deploy
  image: alpine:latest
  before_script:
  - apk update &amp;amp;&amp;amp; apk add --no-cache openssh-client
  - eval $(ssh-agent -s)
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
  - echo &quot;${SSH_PRIVATE_KEY}&quot; &amp;gt; ~/.ssh/id_rsa
  - chmod 400 ~/.ssh/id_rsa
  - echo &quot;${SSH_HOST_KEY}&quot; &amp;gt; /etc/ssh/ssh_known_hosts
  script:
  - ssh-add ~/.ssh/id_rsa
  - scp -r public_html/* $SSH_USER@$SSH_HOST:/var/www/html/
  only:
  - master</pre>



<p class="has-small-font-size">Line 3: Use alpine:latest docker image.<br>Line 5: Use Alpine package manager to install the openssh-client. <br>    Note: The ampersand is getting encoded you will need to change this if you copy and paste this line.<br>Line 6: We are going to use ssh-agent for handling SSH Keys.<br>Lines 7 &#8211; 10: Take the SSH_PRIVATE_KEY variable, output to file and set file permissions.<br>Line 11: A lot of example ignore the host key check but it&#8217;s not difficult to setup and should really be used. /etc/ssh/ssh_known_hosts is system-wide and used by all users.<br>Line 13: Add the SSH key to ssh-agent.<br>Line 14: Use SCP to copy the build artifacts to the web server host.<br>Line 16: Only work on the master branch.</p>



<figure class="wp-block-image"><img loading="lazy" width="1024" height="195" src="https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.31.01-1024x195.png" alt="" class="wp-image-185" srcset="https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.31.01-1024x195.png 1024w, https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.31.01-300x57.png 300w, https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.31.01-768x146.png 768w, https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.31.01.png 1174w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>The variables in the file such as $SSH_USER are defined in the projects Settings, CI/CD page. </p>



<figure class="wp-block-image is-resized"><img loading="lazy" src="https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.32.49.png" alt="" class="wp-image-186" width="658" height="302" srcset="https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.32.49.png 877w, https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.32.49-300x138.png 300w, https://www.wahooga.com/wp-content/uploads/2019/07/Screenshot-2019-07-12-at-16.32.49-768x353.png 768w" sizes="(max-width: 658px) 100vw, 658px" /></figure>



<h2>Today I learned</h2>



<p>Now I have to be honest and not everything worked first time. I will outline some of the issues I came across and hope that these might help others who face the same issues.</p>



<pre class="crayon-plain-tag">Running with gitlab-runner 12.0.2 (d0b76032)
  on mango.wahooga.local 5uuZEpux
Using Shell executor...
Running on macosx.wahooga.com...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /Users/davem/builds/5uuZEpux/0/wahooga/hugo-blog/.git/
Checking out 45060b71 as master...
Removing public_html/
Skipping Git submodules setup
Downloading artifacts for build (249828694)...
Runtime platform                                    arch=amd64 os=darwin pid=8401 revision=d0b76032 version=12.0.2
Downloading artifacts from coordinator... ok        id=249828694 responseStatus=200 OK token=Wp3nd8Zx
$ apk update &amp;amp;&amp;amp; apk add openssh-client bash
bash: line 82: apk: command not found
$ eval $(ssh-agent -s)
Agent pid 8418
$ mkdir -p ~/.ssh
$ chmod 700 ~/.ssh
$ echo &quot;${SSH_PRIVATE_KEY}&quot; &gt; ~/.ssh/id_rsa.pub
$ chmod 400 ~/.ssh/id_rsa.pub
$ ssh-add ~/.ssh/id_rsa.pub
Identity added: /Users/davem/.ssh/id_rsa.pub (davem@macosx.wahooga.com)
$ echo &quot;${SSH_HOST_KEY}&quot; &gt; ~/.ssh/known_hosts
$ scp -rp public_html gitlab@178.122.164.146:/var/www/html</pre>



<p><strong>apk: command not found<br></strong>The deploy before_script would give me this error and I wasn&#8217;t sure why. It turns out I had registered my first runner with the shell executor when I needed the docker executor.</p>



<p><strong>Job sits there stuck at the SCP command<br></strong>Adding the -v parameter to SCP showed me that  it was getting stuck with the host key so I confirmed this was the issue by using <code>-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null</code> parameters.  Sure enough things started working so I changed the path in Line 11 from ~/.ssh/known_hosts to /etc/ssh/known_hosts.</p>



<p><strong>hugo posts not showing when deployed<br></strong>The new hugo posts I created were visible when running locally but the pages were missing when I deployed to my web server. This was a face palm moment as I hadn&#8217;t notice the content was set with <code>draft: true</code>. Obviously it would be useful to have drafts visible when previewing locally but you wouldn&#8217;t drafts to be published to production. Changing the content with draft set to false was an easy fix.</p>The post <a href="https://www.wahooga.com/hugo-gitlab/">Deploy Hugo using GitLab-CI, Docker and SSH</a> first appeared on <a href="https://www.wahooga.com">WAHOOGA</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.wahooga.com/hugo-gitlab/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2013 Opening PDF in Office Web App</title>
		<link>https://www.wahooga.com/sharepoint-2013-opening-pdf-in-office-web-app/</link>
					<comments>https://www.wahooga.com/sharepoint-2013-opening-pdf-in-office-web-app/#respond</comments>
		
		<dc:creator><![CDATA[David Mellors]]></dc:creator>
		<pubDate>Wed, 29 Jun 2016 12:44:02 +0000</pubDate>
				<category><![CDATA[IT Pro]]></category>
		<category><![CDATA[SharePoint 2013]]></category>
		<guid isPermaLink="false">https://www.wahooga.com/?p=27</guid>

					<description><![CDATA[<p>One of my colleagues wanted to change the behavior of SharePoint 2013 so that viewing a PDF in a document library on a mobile device opened the PDF in Adobe Acrobat Reader rather than the Word Office Web App. A post on the Office IT Pro blog (link) indicated that this was possible&#160;and just required [&#8230;]</p>
The post <a href="https://www.wahooga.com/sharepoint-2013-opening-pdf-in-office-web-app/">SharePoint 2013 Opening PDF in Office Web App</a> first appeared on <a href="https://www.wahooga.com">WAHOOGA</a>.]]></description>
										<content:encoded><![CDATA[<p>One of my colleagues wanted to change the behavior of SharePoint 2013 so that viewing a PDF in a document library on a mobile device opened the PDF in Adobe Acrobat Reader rather than the Word Office Web App.</p>



<p>A post on the Office IT Pro blog (<a href="https://blogs.technet.microsoft.com/office_resource_kit/2013/07/31/control-whether-pdfs-open-in-word-web-app-or-the-default-pdf-reader/">link</a>) indicated that this was possible&nbsp;and just required us to run:</p>



<pre class="crayon-plain-tag">Get-SPWopiBinding -Action &quot;MobileView&quot; -Application &quot;WordPDF&quot; | Remove-SPWopiBinding -Confirm:$false</pre>



<p>Unfortunately this didn&#8217;t work for us and when I ran <pre class="crayon-plain-tag">Get-SPWopiBinding -Action "MobileView" -Application "WordPDF"</pre>&nbsp; nothing was returned. Further investigation reveals that the MobileView action was removed from SharePoint 2013 in the October 2013 Cummulative Update[1].</p>



<p>Looks like changing the default behavior is going to be for all devices but I will update this post if I find out anymore.</p>



<p>[1]&nbsp;http://www.wictorwilen.se/WACVersions</p>The post <a href="https://www.wahooga.com/sharepoint-2013-opening-pdf-in-office-web-app/">SharePoint 2013 Opening PDF in Office Web App</a> first appeared on <a href="https://www.wahooga.com">WAHOOGA</a>.]]></content:encoded>
					
					<wfw:commentRss>https://www.wahooga.com/sharepoint-2013-opening-pdf-in-office-web-app/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
