Index | Archives | Atom

My (almost) perfect Pelican Workflow

My Pelican workflow consists mainly of three components

  • Sublime Text
  • Git (Bitbucket)
  • Jenkins

The whole Pelican-Project lives in a git repository on Bitbucket. After checking it out to a new machine I simply install all of its depedencies by running pip install -r requirements.txt. Now I am able to run the devserver by typing make deserver and check the output in a browser on ‘http://localhost:8080’.

For editing content and managing git commits and pushes I use Sublime Text, a texteditor with a lot of plugins, which are called ‘packages’, to install separately. My content files are written in Markdown and Sublime Text offers highlighting for it by default. Managing the git repo can also be done out of the editor. There are some plugins for that. I use the ‘Git’ and ‘GitGutter’ packages. This makes it easy to commit and push by using keyboard shortcuts.

And it comes to deploying the new content to the webserver it’s time for Jenkins which I have installed on another server. Jenkins is an open source Continous Integration and Continous Delivery server. Or in other words it runs tasks automatically. Jenkins itself is extensible by a lot plugins which will give you better integration for Bitbucket or support for python’s virtualenv.

Jenkins plugins I use:

  • Bitbucket Plugin
  • Bitbucket Build Status Notifier Plugin
  • ShiningPanda Plugin (supports python virtualenv)

The ‘Bitbucket Plugin’ provides an endpoint which you can add as a webhook in Bitbucket. So a new build is triggered whenever I push my code to the repository. And that is where the Jenkins magic starts: the build process.

Here is what’s in my build process:

  • pull git repo from Bitbucket
  • create a new virtual env
  • install pelican and dependencies in virtual env
  • run pelican -s (which creates static files with different settings than for development)
  • delete files on webserver
  • copy new files to webserver

In the end all I have to do is to write a new Markdown file and push it to the repo on Bitbucket. The rest will be done automatically for me.

If you have any specific questions about my workflow, feel free to ask in comments.

© Matthias. Built using Pelican. Theme inspired by Giulio Fidente on github.