This blog is written by CloudVPS developer Koert van der Veer, it was published earlier this month on his personal blog.
There are a ton of CMS systems for personal blogs. Wordpress is probably the most popular one, but there are many others. These CMSs tend to have an online admin panel, protected by a password. Creating a blog entry is usually pretty easy, although when you're a bit picky about the appearance of your post, you'll end up editing HTML.
While these systems are perfect for non-techsavvy users, they have one major weakness: both the software and the content need to be on the same server. This means that the software you use is exposed to the entire internet. Just google wordpress vulnerability to get a sense of the implications. Moreover, you'll need a server configured for some script language, usually PHP, which has both cost and performance implications. Lastly, if your blog gets slashdotted, there is often no good way to scale your blog, as there are many dynamic components.
If nice wysiwyg editing is not among your requirements, you could decide to switch to a static blog system. These systems live in the safety of your own computer, and only store their output online. In the event of a traffic surge, you can just copy your blog to multiple locations, as there are no dynamic components In this example I'll be looking at pelican, but there are others, such as jeckyl , octopress and middleman. I'll be using the CloudVPS Object Store as a storage medium, but there are many alternatives for that, too.
Setting things up
Make sure CloudVPS openstack is configured for your environment. Add the following to your environment (e.g. in your ~/.bashrc).
# some systems need this, depending on who shipped the ca certificates
Create a virtualenv for all of the blog software. If you don't have virtualenv, your can get it here.
$ . .venv/bin/activate
Now it's time to install the software:
Creating your blog
Once all software is installed, it's time to actually bootstrap the blog. Pelican comes with a nice quickstart tool, pelican-quickstart. It will ask a few questions, and when it's done, you're ready to write content. You can skip (say no) to all questions concerning uploads, we'll be adding our own upload method later on.
Welcome to pelican-quickstart v3.4.0.
This script will help you create a new Pelican-based website.
Please answer the following questions so this script can generate the files needed by Pelican.
> Where do you want to create your new web site? [.]
> What will be the title of this web site? My twenty-fifth blog
> Who will be the author of this web site? John Doe
> What will be the default language of this web site? [en]
> Do you want to specify a URL prefix? e.g., http://example.com (Y/n) n
> Do you want to enable article pagination? (Y/n) n
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y
> Do you want to upload your website using FTP? (y/N)
> Do you want to upload your website using SSH? (y/N)
> Do you want to upload your website using Dropbox? (y/N)
> Do you want to upload your website using S3? (y/N)
> Do you want to upload your website using Rackspace Cloud Files? (y/N)
> Do you want to upload your website using GitHub Pages? (y/N)
Done. Your new project is available at /home/johndoe/blog25
To enable swift uploads, we'll have to add a few lines to the makefile, before the .PHONY target.
swift post "$CONTAINER" --header 'x-container-read: .r:*' -m 'web-index:index.html'
cd "$(OUTPUTDIR)" && swift -v upload -c "$CONTAINER".
The first line indicates a new make targed, named swift_upload dependent on the publish target. If you're not familiar with how make works, don't worry, it's not important.
The second line configures which container to use, edit it to your liking. Make sure to use only DNS-compatible characters (0-9, a-z and dash), so you can set up a nice CNAME later on.
The third line creates the container, and sets up two pieces of metadata. The X-Container-Read: .r:* makes sure your container is publicly accessible. At CloudVPS objectstore containers are secure by default, so we'll need to enable public access. The web-index:index.html sets up some container metadata, so the object storeknows what file to host as the index file.
The last line enters the output directory (where your blog was generated) and simply uploads everything.
Generating and uploading your blog is now simply a matter of typing make swift_upload, and you're done.
Setting up a nice domain name
If you have your own domain name, you can point it to your container, by creating a DNS record like this:
Replacing mycontainer with the container name you chose earlier, and 01234567890abcdef01234567890abcdef with the project id from your authentication data. When you've done this, your blog will be accessible at http://blog.<yourdomain>/, provided you've already uploaded it.
Content is created by adding some .rst documents in the /content folder. I haven't yet found a way to automatically generate high quality content, so for now I just create mediocre content manually.