My First Blog Post

Posted by Brad on Sun 10 September 2017

Well, ghost was a nice idea but just didn't work out. So here we are trying things with Pelican. I realize everyone and their mom have already written the "how I set up my blog" article, but here we are and hopefully with some ansible goodness that most others lacked.

First things First: Testing

I've already made a mess of my EC2 server with the node.js troubleshooting so this time we're going to do it right and test things before I mess with the real one. The plan will be to set up a git-controlled content directory so we have version control, and so that I can write articles locally and then "upload" them with a git pull.

Set up a Vagrant VM

I won't go into the details on setting up vagrant here, as its really straightforward enough (and the project's documentation is good enough) that some trial and error will get you farther than a random blog post. In any case for my test VM we're going with a simple CentOS 7 VM since its stable and doesn't completely suck. If I get real ambitious I'll put my Vagrant environments in git and link to it here, we'll see.

Pre-Requisites

In case its not clear these commands will need some form of sudo power.

  • I should probably run my ansible common role, but not too worried about with vagrant just being for testing
  • yum install epel-release
  • yum install python-pip
  • useradd -m bloguser
  • pip install pelican
  • pip install markdown

Creating the blog

And these should be run as the bloguser, not that it's terribly necessary, but I don't like things even having the potential to run as root if they don't need to.

  • sudo -iu bloguser
  • mkdir myblog
  • cd myblog
  • pelican-quickstart and answer the questions, nothing too crazy difficult
  • cd content
  • vim blog_post.md
  • cd ..
  • pelican content
  • cd output
  • python -m pelican.server

So this is all straight from the quickstart guide so far and really looking pretty good for the modest amount of effort we've put in so far.

Making it Permanent

Next we'll make it a bit more production friendly and throw it behind nginx (or apache, whatever floats your boat).

  • yum install nginx
  • clean up nginx.conf
  • create myblog.conf
  • copy output to /var/www/myblog
  • systemctl enable nginx
  • systemctl start nginx
  • realize SELinux is blocking you and disable it because no matter how many times you get told not to its still easier than setting a context

And here we are with a fancy almost production ready blog. Next we'll force SSL and find a new theme so we can at least pretend to be original. Not bad for a sunday afternoon.