<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Segfaulted's Blog</title><link href="http://segfaulted.com/" rel="alternate"></link><link href="http://segfaulted.com/feeds/all.atom.xml" rel="self"></link><id>http://segfaulted.com/</id><updated>2017-05-25T22:51:00-05:00</updated><entry><title>Pelican on GitLab Pages</title><link href="http://segfaulted.com/pelican-on-gitlab-pages.html" rel="alternate"></link><published>2017-05-25T22:51:00-05:00</published><updated>2017-05-25T22:51:00-05:00</updated><author><name>Segfaulted</name></author><id>tag:segfaulted.com,2017-05-25:/pelican-on-gitlab-pages.html</id><summary type="html">&lt;p&gt;This guide assumes you know how to install software on the computer operating
system you are using and you are familiar with the basics of using GitLab.&lt;/p&gt;
&lt;div class="section" id="getting-started"&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;div class="section" id="required-software"&gt;
&lt;h3&gt;Required Software&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Git - &lt;a class="reference external" href="http://git-scm.com"&gt;Git&lt;/a&gt; or any other Git client.&lt;/li&gt;
&lt;li&gt;Python 2.7 or 3.3+ - &lt;a class="reference external" href="http://www.python.org"&gt;Python.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;virtualenv - install covered below …&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;This guide assumes you know how to install software on the computer operating
system you are using and you are familiar with the basics of using GitLab.&lt;/p&gt;
&lt;div class="section" id="getting-started"&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;div class="section" id="required-software"&gt;
&lt;h3&gt;Required Software&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Git - &lt;a class="reference external" href="http://git-scm.com"&gt;Git&lt;/a&gt; or any other Git client.&lt;/li&gt;
&lt;li&gt;Python 2.7 or 3.3+ - &lt;a class="reference external" href="http://www.python.org"&gt;Python.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;virtualenv - install covered below&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="project-setup"&gt;
&lt;h3&gt;Project Setup&lt;/h3&gt;
&lt;p&gt;Create a repository on GitLab for your new website. It can be public or private,
your website will be viewable publicly either way. There are a couple options when
creating your site on GitLab. If you create your repository under
&amp;lt;username&amp;gt;/&amp;lt;username&amp;gt;.gitlab.io, your website will be available at
&lt;a class="reference external" href="http:/"&gt;http:/&lt;/a&gt;/&amp;lt;username&amp;gt;.gitlab.io. This also works for groups, just replace &amp;lt;username&amp;gt;
with your groups name. If you create your repository at
&amp;lt;username&amp;gt;/&amp;lt;projectname&amp;gt; your website will be available at
&lt;a class="reference external" href="http:/"&gt;http:/&lt;/a&gt;/&amp;lt;username&amp;gt;.gitlab.io/&amp;lt;projectname&amp;gt;. Again, this always works with groups,
just replace &amp;lt;username&amp;gt; with the name of your group.&lt;/p&gt;
&lt;p&gt;Now clone the repository you just created.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ git clone git@gitlab.com:&amp;lt;username&amp;gt;/&amp;lt;reponame&amp;gt;.git reponame
$ &lt;span class="nb"&gt;cd&lt;/span&gt; reponame
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Replace &amp;lt;username&amp;gt; and &amp;lt;reponame&amp;gt; with your username or group name and the name
of the repository you created earlier.&lt;/p&gt;
&lt;p&gt;If you are using a GUI Git client you need to open a terminal/console window and
navigate to the folder you cloned the repository to.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="pelican"&gt;
&lt;h2&gt;Pelican&lt;/h2&gt;
&lt;p&gt;After you have your repository created and the required software installed its time to install Pelican.&lt;/p&gt;
&lt;div class="section" id="install-virtualenv"&gt;
&lt;h3&gt;Install virtualenv&lt;/h3&gt;
&lt;div class="section" id="linux-and-os-x"&gt;
&lt;h4&gt;Linux and OS X&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ sudo pip install virtualenv
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Restart your terminal&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ virtualenv &amp;lt;path&amp;gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where &amp;lt;path&amp;gt; is the directory you want to save the virtualenv files. Usually something like /home/&amp;lt;username&amp;gt;/virtualenvs/pelican on Linux
or /Users/&amp;lt;UserName&amp;gt;/virtualenvs/pelican on OS X.&lt;/p&gt;
&lt;p&gt;Whenever you need work in the virtualenv:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ &lt;span class="nb"&gt;source&lt;/span&gt; &amp;lt;path&amp;gt;/bin/activate
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="windows"&gt;
&lt;h4&gt;Windows&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;c&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nl"&gt;\&lt;/span&gt;&lt;span class="c1"&gt;&amp;gt;pip install virtualenv&lt;/span&gt;
c&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nl"&gt;\&lt;/span&gt;&lt;span class="c1"&gt;&amp;gt;virtualenv &amp;lt;path&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where &amp;lt;path&amp;gt; is the directory you want to save the virtual env files. Usually something like c:Users&amp;lt;Username&amp;gt;virtualenvspelican&lt;/p&gt;
&lt;p&gt;Whenever you need to work in the virtualenv:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;c&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nl"&gt;\&lt;/span&gt;&lt;span class="c1"&gt;&amp;gt; &amp;lt;path&amp;gt;\Scripts\activate&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="install-pelican"&gt;
&lt;h3&gt;Install Pelican&lt;/h3&gt;
&lt;p&gt;Make sure your virtualenv is activated and install pelican.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pip install pelican markdown
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="generate-the-base-site"&gt;
&lt;h3&gt;Generate the Base Site&lt;/h3&gt;
&lt;p&gt;With your virtualenv still active.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ mkdir blogname
$ &lt;span class="nb"&gt;cd&lt;/span&gt; blogname
$ pelican-quickstart
Welcome to pelican-quickstart v3.7.1.
This script will &lt;span class="nb"&gt;help&lt;/span&gt; you create a new Pelican-based website.
Please answer the following questions so this script can generate the files
needed by Pelican.

&amp;gt; Where &lt;span class="k"&gt;do&lt;/span&gt; you want to create your new web site? &lt;span class="o"&gt;[&lt;/span&gt;.&lt;span class="o"&gt;]&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; What will be the title of this web site? My Blog &amp;lt;enter&amp;gt;
&amp;gt; Who will be the author of this web site? My Name &amp;lt;enter&amp;gt;
&amp;gt; What will be the default language of this web site? &lt;span class="o"&gt;[&lt;/span&gt;en&lt;span class="o"&gt;]&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to specify a URL prefix? e.g., http://example.com   &lt;span class="o"&gt;(&lt;/span&gt;Y/n&lt;span class="o"&gt;)&lt;/span&gt; n &amp;lt;enter&amp;gt;
&amp;gt; Do you want to &lt;span class="nb"&gt;enable&lt;/span&gt; article pagination? &lt;span class="o"&gt;(&lt;/span&gt;Y/n&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; How many articles per page &lt;span class="k"&gt;do&lt;/span&gt; you want? &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; What is your &lt;span class="nb"&gt;time&lt;/span&gt; zone? &lt;span class="o"&gt;[&lt;/span&gt;Europe/Paris&lt;span class="o"&gt;]&lt;/span&gt; America/Chicago &amp;lt;enter&amp;gt;
&amp;gt; Do you want to generate a Fabfile/Makefile to automate generation and publishing? &lt;span class="o"&gt;(&lt;/span&gt;Y/n&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want an auto-reload &lt;span class="p"&gt;&amp;amp;&lt;/span&gt; simpleHTTP script to assist with theme and site development? &lt;span class="o"&gt;(&lt;/span&gt;Y/n&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using FTP? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using SSH? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using Dropbox? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using S3? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using Rackspace Cloud Files? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
&amp;gt; Do you want to upload your website using GitHub Pages? &lt;span class="o"&gt;(&lt;/span&gt;y/N&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;enter&amp;gt;
Done. Your new project is available at /home/&amp;lt;username&amp;gt;/blogname
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For most the most part you can leave all the defaults to the yes and now questions. Make sure to fill in the title of the website,
author of the website and time zone.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setup-for-gitlab"&gt;
&lt;h3&gt;Setup for GitLab&lt;/h3&gt;
&lt;p&gt;By default Pelican outputs the generated files to a folder named &amp;quot;output&amp;quot;, this
won't work with GitLab. Open the file pelicanconf.py and add the following line.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;OUTPUT_PATH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;public&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also customize any other options you wish in this file.&lt;/p&gt;
&lt;p&gt;Navigate to your repository's Settings, and go to CI/CD Pipelines. Make sure
&amp;quot;Shared Runners&amp;quot; is enabled.&lt;/p&gt;
&lt;p&gt;In order to tell GitLab we need Pelican installed to build out site, we need to
add a requirements.txt file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pelican
markdown
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Next we need to make the configuration file to actually build and deploy our site to
GitLab. Create a new file named .gitlab-ci.yml and add the following lines to it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;image&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;python:3.6-alpine&lt;/span&gt;

&lt;span class="l l-Scalar l-Scalar-Plain"&gt;pages&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;script&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;pip install -r requirements.txt&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;pelican -s publishconf.py&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;artifacts&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="l l-Scalar l-Scalar-Plain"&gt;paths&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
    &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;public/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Since we don't have any content written yet, we need to add a .gitkeep file to
out content folder. Because Git doesn't track empty directories we add a blank
file to our content folder so that it exists when the build tool runs on GitLab's
servers. On windows simply make a empty text file and rename it .gitkeep. On Linux
or OS X you can do &lt;code&gt;touch content/.gitkeep&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally we are ready to test. We must stage the new/changed files, commit them
to Git then push them to GitLab where the site is built and published.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ git add .
$ git commit -m &lt;span class="s2"&gt;&amp;quot;Inital Commit&amp;quot;&lt;/span&gt;
$ git push origin master
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Navigate to your project on GitLab and go to &amp;quot;Pipelines&amp;quot;. You should either see
a task running or completed or possibly failed. If the task is still running just
wait till it is complete. If the task fails you can click the &amp;quot;Failed&amp;quot; button and
go to &amp;quot;Failed Jobs&amp;quot; and get a build log to help you figure out where it went wrong.&lt;/p&gt;
&lt;p&gt;Once the task as completed successfully you should be able to view your site at
&lt;a class="reference external" href="http:/"&gt;http:/&lt;/a&gt;/&amp;lt;username/groupname&amp;gt;.gitlab.io or &lt;a class="reference external" href="http:/"&gt;http:/&lt;/a&gt;/&amp;lt;username/groupname&amp;gt;.gitlab.io/projectname.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="adding-new-editing-posts"&gt;
&lt;h3&gt;Adding New/Editing Posts&lt;/h3&gt;
&lt;p&gt;To add or edit posts just repeat the final step.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ git add .
$ git commit -m &lt;span class="s2"&gt;&amp;quot;Some Descriptive Message&amp;quot;&lt;/span&gt;
$ git push origin master
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thats it! I hope you found this guide useful.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="Pelican"></category><category term="GitLab"></category></entry></feed>