-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.xml
More file actions
191 lines (129 loc) · 12 KB
/
index.xml
File metadata and controls
191 lines (129 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>TestBlog</title>
<link>LEMarshall.github.io/</link>
<description>Recent content on TestBlog</description>
<generator>Hugo -- gohugo.io</generator>
<lastBuildDate>Wed, 30 Mar 2016 00:00:00 +0000</lastBuildDate>
<atom:link href="LEMarshall.github.io/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Hosting my Hugo Blog on Github Pages</title>
<link>/LEMarshall.github.io/posts/hosting-my-hugo-blog-on-github-pages-2016-03-30/</link>
<pubDate>Wed, 30 Mar 2016 00:00:00 +0000</pubDate>
<guid>/LEMarshall.github.io/posts/hosting-my-hugo-blog-on-github-pages-2016-03-30/</guid>
<description><p>After initially hosting my blog on a virtual machine instance on Google Cloud, I got busy with other things and took my time getting around to finding an alternative hosting solution. The virtual machine instance was a bit too expensive for just hosting a blog when cheaper (or free!) options exist, considering my free trial on Google Cloud ran out. Since I still don&rsquo;t have a whole lot of time for this project, I decided to try <a href="https://pages.github.com">Github Pages</a>, it sounded pretty simple, and in fact it is.</p>
<p>Github Pages is a free service for hosting static sites, all you really need to do is create a repository and upload your site. Since I wanted to use <a href="https://gohugo.io">Hugo</a> to generate my site, I roughly followed their <a href="https://gohugo.io/tutorials/github-pages-blog/">tutorial</a> for hosting on Github Pages. I didn&rsquo;t go as far with configuring Git workflow, and at some point I may still want to make this more automated. At the moment I&rsquo;m updating by running Hugo to generate pages for new content and pushing the files to my github repository.</p>
<p>Github Pages seems like a good way to go, it&rsquo;s free, and fairly easy to use.</p>
</description>
</item>
<item>
<title>Building a Blog with Docker & Hugo, Part 2</title>
<link>/LEMarshall.github.io/posts/building-a-blog-with-docker-and-hugo-part2-2016-02-11/</link>
<pubDate>Thu, 11 Feb 2016 00:00:00 +0000</pubDate>
<guid>/LEMarshall.github.io/posts/building-a-blog-with-docker-and-hugo-part2-2016-02-11/</guid>
<description>
<p>I got started with Linux about a year ago when a colleague recommended trying Ubuntu as an alternative to Windows. So far, I&rsquo;ve gained basic competency in the terminal, and acquired a working knowledge of the operating system. I&rsquo;ve experimented quite a bit with different Linux distributions in Virtual Box - installing and configuring Arch Linux was a great learning experience. But, I think working at an IT company (my role is not technical) and constantly being around web developers and devops engineers was what really got me interested in computing, and pushed me to do a lot more than I otherwise would have - like studying Python, and deploying this site.</p>
<h4 id="settling-on-a-solution:57282d80281252879f13a5f930cb892b">Settling on a solution</h4>
<p>There are a lot of ways to host a static site, but I wanted to do it with Docker. Docker has a few advantages that make it very attractive for many different use cases, but most importantly, container-ized services are really easy to deploy from one linux environments to another. For my purposes, this means I can easily launch my site on a variety of platforms - as long as Docker is installed:</p>
<pre><code>$ docker build .
$ docker run -d -p 80:80 image_name
</code></pre>
<p>The first command builds a docker image using instructions from a Dockerfile; the second launches a pre-configured container serving my site the instant it goes up.</p>
<h6 id="building-the-site:57282d80281252879f13a5f930cb892b">Building the site</h6>
<p>I don&rsquo;t really know my way around html, css, or javascript, so there was no way I was going to build my own site from scratch in a reasonable amount of time. So, I decided to use a static site generator. There are a lot of static site generators out there at the moment, so I sort of arbitrarily picked Hugo. It&rsquo;s written in go, generates pages very quickly, and has it&rsquo;s own web server (no need for Nginx or Apache, unless you want some more advanced features).</p>
<p>Hugo uses a config file like this:</p>
<pre><code>baseurl = &quot;http://localhost/&quot;
title = &quot;TestBlog&quot;
author = &quot;Laurent Marshall&quot;
copyright = &quot;Copyright (c), Laurent Marshall; all rights reserved.&quot;
[params]
sidebartitle = &quot;TestBlog&quot;
sidebartagline = &quot;This is a Test&quot;
</code></pre>
<p>And generates pages from text files with a .toml, .json, or .yaml header. You only need markdwon to format the rest of your post:</p>
<pre><code>+++
date = &quot;2016-02-10&quot;
title = &quot;Title&quot;
tags = [&quot;Hugo&quot;, &quot;Docker&quot;]
+++
Your text here.
</code></pre>
<p>All you need to do is set up a directory tree of folders for the pages you want, and place your content in them; Hugo does the rest.</p>
<h4 id="building-a-docker-image:57282d80281252879f13a5f930cb892b">Building a Docker image</h4>
<p>Docker uses what is called a Dockerfile to create images with pre-installed and configured software. I decided to base mine on Alpine Linux, since it&rsquo;s quite compact. Here is the Dockerfile I developed:</p>
<pre><code># Inspired by ilkka.io/blog/static-sites-with-docker/
# and www.mrsinham.net/create-a-blog-in-2-min/
FROM alpine
MAINTAINER Laurent Marshall
# Install necessary packages:
RUN apk --no-cache add git
# The following packages are only necessary to build the docker image and
# will be purged later:
RUN apk --no-cache add --virtual build-dependencies curl
# If you want more advanced text features you can use the following commands to install pygments:
#RUN apk --no-cache add python git
#RUN apk --no-cache add --virtual build-dependencies python-dev py-pip build-base curl
#RUN pip install pygments
ENV HUGO_VERSION 0.15
ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux_amd64
ENV HUGO_BASEURL http://localhost/
RUN mkdir /blog
WORKDIR /blog
RUN curl -L https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz &gt; /usr/local/${HUGO_BINARY}.tar.gz \
&amp;&amp; tar -xzf /usr/local/${HUGO_BINARY}.tar.gz -C /usr/local/ \
&amp;&amp; ln -s /usr/local/${HUGO_BINARY}/${HUGO_BINARY} /usr/local/bin/hugo \
&amp;&amp; rm /usr/local/${HUGO_BINARY}.tar.gz
RUN apk del build-dependencies
RUN hugo new site .
RUN rm -rf ./content config.toml
RUN git init
RUN git remote add origin https://github.com/LEMarshall/blog.git
RUN git pull origin master
RUN git clone https://github.com/allnightgrocery/hugo-theme-blueberry-detox.git /blog/themes/detox
EXPOSE 80
# start.sh script from www.mrsinham.net/create-a-blog-in-2-min/ - syncs site content with github repository
# and launches hugo server:
ADD start.sh /start.sh
RUN chmod +x /start.sh
ENTRYPOINT /start.sh
</code></pre>
<p>If you&rsquo;re interested in reading more about Hugo and Docker, and taking a look at the Dockerfiles which I based mine on, have a look at <a href="ilkka.io/blog/static-sites-with-docker/">this</a> and <a href="www.mrsinham.net/create-a-blog-in-2-min/">this</a>.</p>
<p>Basically, my Dockerfile borrows an Alpine Linux + Hugo configuration from the first source, and a process for automatic updates using git and github from the second.</p>
<p>The following script launches Hugo Server, and sets it to watch the file system for changes. Meanwhile, git pulls changes from the repository every 60 seconds, and Hugo rebuilds the site and incorporates anything new:</p>
<pre><code>#!/bin/sh
hugo server -t detox -b=$HUGO_BASEURL -s /blog -p 80 --bind=0.0.0.0 --watch --disableLiveReload &amp;
cd /blog/
while true; do
git pull origin master
sleep 60
done
</code></pre>
<h4 id="deployment:57282d80281252879f13a5f930cb892b">Deployment</h4>
<p>I haven&rsquo;t decided if I will permanently host this blog anywhere yet, but I have deployed it on a CoreOS instance (which has Docker pre-installed) on google cloud. Once I had a working docker image, hosting the site itself was super easy - &ldquo;docker build .&rdquo; &ldquo;docker run &hellip;&rdquo; and that was all there was to it. To add content I only need to push new posts to my github repository and they appear on the site within a minute.</p>
<p>Logical next steps would include getting a domain name and leaving the Docker container with the site running on a server. I also need to get a handle on markdown language and learn about more about Hugo, and the features available with my chosen theme.</p>
</description>
</item>
<item>
<title>Building a Blog with Docker and Hugo</title>
<link>/LEMarshall.github.io/posts/building-a-blog-with-docker-and-hugo-2016-02-10/</link>
<pubDate>Wed, 10 Feb 2016 00:00:00 +0000</pubDate>
<guid>/LEMarshall.github.io/posts/building-a-blog-with-docker-and-hugo-2016-02-10/</guid>
<description><p>After hearing and reading about <a href="https://www.docker.com">Docker</a>, I decided to try building a static blog on my own as a learning experience.</p>
<p>I decided to use <a href="https://gohugo.io">Hugo</a> to generate and serve my blog, and I used a short script with git to automatically post updates. Due to its compact size, <a href="www.alpinelinux.org">Alpine Linux</a> was a good base for my docker image.</p>
<p>You can check out the Dockerfile I developed on <a href="https://github.com/LEMarshall/blog">github</a>.</p>
</description>
</item>
<item>
<title>Blogging on IT Topics and More</title>
<link>/LEMarshall.github.io/about/about/</link>
<pubDate>Tue, 09 Feb 2016 00:00:00 +0000</pubDate>
<guid>/LEMarshall.github.io/about/about/</guid>
<description><p>Hi, I&rsquo;m Laurent Marshall. I&rsquo;m a former U.S. Peace Corps volunteer (Ukraine, 2010-2013) currently working at an <a href="https://dtm.io">IT company</a> in customer relations and marketing. I initially created this blog as a way to experiment with <a href="www.docker.com">Docker</a> and the static site generator/web server <a href="https://gohugo.io">Hugo</a>, and just called it &ldquo;TestBlog&rdquo; in the config file. It will probably stay that way unless I can think of something better (I have my doubts).</p>
<p>Over the last year or so I&rsquo;ve become more interested in IT, computing, and programming. At the moment I&rsquo;m doing my best to learn more about Linux systems administration and devops as spare time allows, but I&rsquo;ve also dabbled in Python programming and Go(lang). Beyond IT, my interests are wide and varied and you may see some non-IT themed posts from time to time.</p>
<p>You can find me on <a href="https://ua.linkedin.com/in/LaurentMarshall">LinkedIn</a> or <a href="https://github.com/LEMarshall">Github</a>.</p>
<p>If you like fishing and the outdoors, check out my previous blogging project from way back in 2010: <a href="http://tenkaraadventurer.blogspot.com">Tenkara Adventurer</a>.</p>
</description>
</item>
</channel>
</rss>