2013-05-28 14:26

(Re)Introducing Alva, a Nikola Server

Over a year ago (time flies!) I posted something about a project called Alva. Let me quote myself:

Alva is almost the opposite of Nikola. If Nikola is about making static sites, Alva is a dynamic site. However, as Hegel suggests, from the thesis and the antithesis comes the synthesis.

So, Alva is about dynamically creating static sites. If you want to have Nikola in your server instead of in your own computer, and have the convenience of an online tool, that's the niche Alva tries to fill.

So, you would install Alva, and use it like any other web-based blogging tool. Yet, behind the scenes, you would have Nikola, and all the performance and security benefits of static sites.

And maybe someday, I (or someone) will put up a multi-user version of Alva, and you will be able to get hosted blogs, knowing all the data is yours and you can leave anytime and do your own thing.

The approach I was taking at the time proved to be unsuccessful, and there were a few other failures along the way. Of course, the problem was in how I was approaching the task. So I did the right thing, and learned how to do it "right".

Still not usable, still not hosted anywhere, but already semi-functional: Alva lives now

There's a lot of work still to be done. But I now know how to do it. To prevent the usual arguments, here is a little explanation of motivation, tooling, etc.


I want a way to host blogs very cheaply. How cheaply? I want at least 1000 reasonably active users in a $5 VPS. That would make Alva a reasonable alternative to hosted multi-user wordpress, which means it would be a reasonable solution (if setup is easy enough) for small-to-medium organizations which don't want to setup expensive infrastructure yet want to own their data (think schools, small businesses, FLOSS projects, etc.) I also want to provide that service, for free. Which is why another reason I want it to be super cheap.

How does Alva help provide this super-cheap blog hosting?

  1. It needs to scale following the number of edits not views.
  2. If it gets too busy with edits, changes take longer to appear, but the site itself doesn't get any slower.
  3. Editing and serving can be provided by separate services, so I can use some super-fast static file server and a super-configurable WSGI deployment.
  4. Individual pages can be heavily optimized so that they download fast


One of the guiding principles here is that to deliver this sort of thing, in my spare time, the development process needs to be stingy with the most limited resource: me. I can't spend a lot of me here. I need to be careful and not over-promise.

So, whenever there was a 3rd-party tool that saves a significant amount of time, that's what I am using.

Because it has a much stronger 3rd-party toolset than Flask or any micro-framework. For example, the Flask equivalent of django-allauth broke my will to live. Because the admin interface means I can start adding data to see if it makes sense before I write all the required views.
Because I don't want you to have to create accounts here unless you want to, this provides (optional) social login and registration. This was easy to setup and works almsost out-of-the-box
Bootstrap and Django-bootstrap-toolkit
Nikola is already heavily invested in bootstrap, so it just made sense to go further down that road. I understand bootstrap, and django-boostrap-toolkit is easy enough (although I can't make their datepicker work)
Because fighting is boring.
Because Django's mechanisms to find templates and static files are many and confuse me.
Redis + RQ + django-rq
It's crucial for the whole approach to use job queues in order to detach the rendering from the actual Django app. This combination makes job dispatching ridiculously easy, setup is trivial (install everything, start redis, a few lines of config, ./manage.py rqworker and off you go) and they provide a django admin page where I can see the failed jobs, which is awesome.
Because it's easy enough, and allows me some freedom exploring data organization in my models without committing to it forever or recreating databases with test data all the time.
I will probably serve the generated sites via gatling just like my current sites because it has the simplest named domain configuration possible, it's fast and very light in resource usage.
A cool, simple editor with live previews that supports almost every markup. Not WYSIWYG or even WYSIWYM so possibly I will have to add an alternative. I started using django-markitup but it's not a good idea (it uses a old version of markitup which requires JQuery < 1.9) and am in the process of just using Markitup manually.

So, feel free to give Alva a try and/or give me a hand, comments welcome.


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina