Tue, 24 Feb 2015

A new blog entry in Markdown format

I took the markdown plugin from here and fixed a few issues, most notably making it an entry parser, losely based on the rst.py plugin.

This is awesome, because now I can use github to actually write blog entries in the browser - maybe, just maybe making the hurdle a bit less to write a few posts.

The resulting code can be found in my new github repository.

And yes, I know, version 1.5 will bring this by default - but I am on Debian Wheezy which runs 1.4.

posted at 23:42 | path: /web | permanent link to this entry

Wed, 03 Dec 2014

Installing a StartSSL certificate with haproxy

haproxy since version 1.5 supports native SSL. It uses a combined PEM file for encrypting connections.

StartSSL is a popular provider of free SSL certificates (which I happen to use), but only provides separate ssl.crt and ssl.key files.

To install these with haproxy they need to be combined into a single PEM file. It is helpful to also present the intermediary certificates, which can be downloaded on the StartSSL website as well. Otherwise clients might not recognize the certificate as valid because they cannot verify the certificate chain.

To combine them into one, cat works just fine:

cat ssl.crt sub.class2.server.ca.pem ca.pem ssl.key > ssl.pem

Install it in haproxy by adding a bind option to the frontend block, e.g.

bind :443 ssl crt /etc/haproxy/ssl.pem bind :::443 ssl crt /etc/haproxy/ssl.pem

This is what I'm running on l4x.org.

posted at 01:00 | path: /unix | permanent link to this entry

Tue, 03 Jun 2014

Running Pyblosxom with gevent.wsgi

The gevent wsgi server is very easy to use from Python. I wrote a convenient wrapper which starts pyblosxom under gevent. This can be used to either serve your blog locally for testing or to serve the live system. The nice thing is that it doesn't require an extra apache or nginx server just to start serving it.

Full source code is located here.

The important piece:

from gevent import monkey; monkey.patch_all()
from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from Pyblosxom import pyblosxom

def start(host='127.0.0.1', port=8007, threads=8):
  pool = Pool(threads)
  application = pyblosxom.PyBlosxomWSGIApp()
  server = WSGIServer((host, port), application, spawn=pool)
  server.serve_forever()

posted at 23:00 | path: /python | permanent link to this entry