Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

(Re)Introducing Alva, a Nikola Server

Over a year ago (ti­me flie­s!) I pos­ted so­me­thing about a pro­ject ca­lled Al­va. Let me quo­te mysel­f:

Al­va is al­most the oppo­si­te of Niko­la. If Niko­la is about making sta­tic si­tes, Al­va is a dy­na­mic si­te. Ho­we­ve­r, as He­gel su­gges­ts, from the the­sis and the an­ti­the­sis co­mes the syn­the­sis.

So, Al­va is about dy­na­mi­ca­lly crea­ting sta­tic si­tes. If you want to ha­ve Niko­la in your ser­ver ins­tead of in your own com­pu­te­r, and ha­ve the con­ve­nien­ce of an on­li­ne tool, tha­t's the ni­che Al­va tries to fi­ll.

So, you would ins­ta­ll Al­va, and use it like any other we­b-­ba­sed blo­gging tool. Ye­t, be­hind the sce­nes, you would ha­ve Niko­la, and all the per­for­man­ce and se­cu­ri­ty be­ne­fi­ts of sta­tic si­tes.

And ma­y­be so­me­da­y, I (or so­meo­ne) wi­ll put up a mul­ti-u­ser ver­sion of Al­va, and you wi­ll be able to get hos­ted blogs, kno­wing all the da­ta is yours and you can lea­ve an­y­ti­me and do your own thin­g.

The appro­ach I was taking at the ti­me pro­ved to be un­suc­ce­ss­fu­l, and the­re we­re a few other fai­lu­res along the wa­y. Of cour­se, the pro­blem was in how I was appro­aching the ta­sk. So I did the ri­ght thin­g, and lear­ned how to do it "ri­gh­t".

Sti­ll not usa­ble, sti­ll not hos­ted an­ywhe­re, but al­ready se­mi-­func­tio­na­l: Al­va li­ves now

The­re's a lot of wo­rk sti­ll to be do­ne. But I now know how to do it. To pre­vent the usual ar­gu­men­ts, he­re is a li­ttle ex­pla­na­tion of mo­ti­va­tio­n, toolin­g, etc.

Motivation

I want a way to host blogs ve­ry chea­pl­y. How chea­pl­y? I want at least 1000 rea­so­na­bly ac­ti­ve users in a $5 VP­S. That would make Al­va a rea­so­na­ble al­ter­na­ti­ve to hos­ted mul­ti-u­ser wor­dpress, whi­ch means it would be a rea­so­na­ble so­lu­tion (if se­tup is ea­sy enou­gh) for sma­ll-­to­-­me­dium or­ga­ni­za­tions whi­ch do­n't want to se­tup ex­pen­si­ve in­fras­truc­tu­re yet want to own their da­ta (thi­nk school­s, sma­ll bu­si­nesses, FLO­SS pro­jec­ts, etc.) I al­so want to pro­vi­de that ser­vi­ce, for free. Whi­ch is why ano­ther rea­son I want it to be su­per chea­p.

How does Al­va help pro­vi­de this su­pe­r-­cheap blog hos­tin­g?

  1. It nee­­ds to sca­­le fo­­­llo­­wing the nu­m­­ber of edi­­ts not views.

  2. If it ge­­ts too busy wi­­th edi­­ts, chan­­ges take lo­n­­ger to appea­­r, but the si­­te itself does­n't get any slo­­we­­r.

  3. Edi­­ting and se­r­­ving can be pro­­­vi­­ded by se­­pa­­ra­­te se­r­­vi­­ce­s, so I can use so­­­me su­­pe­­r-­­fast sta­­tic fi­­le se­r­­ver and a su­­pe­­r-­­co­n­­fi­­gu­­ra­­ble WS­­GI de­­plo­­­y­­men­­t.

  4. In­­di­­vi­­dual pa­­ges can be hea­­vi­­ly op­­ti­­mi­­zed so that they do­­wn­­load fast

Tools

One of the gui­ding prin­ci­ples he­re is that to de­li­ver this sort of thin­g, in my spa­re ti­me, the de­ve­lo­p­ment pro­ce­ss nee­ds to be stin­gy wi­th the most li­mited re­sour­ce: me. I can't spend a lot of me he­re. I need to be ca­re­ful and not ove­r-­pro­mi­se.

So, whe­ne­ver the­re was a 3r­d-­par­ty tool that saves a sig­ni­fi­cant amount of ti­me, tha­t's what I am usin­g.

Django

Be­cau­se it has a mu­ch stron­ger 3r­d-­par­ty tool­set than Fla­sk or any mi­cro­-­fra­mewo­rk. For exam­ple, the Fla­sk equi­va­lent of djan­go­-a­llau­th bro­ke my wi­ll to li­ve. Be­cau­se the ad­min in­ter­fa­ce means I can start adding da­ta to see if it makes sen­se be­fo­re I wri­te all the re­qui­red views.

Django-allauth

Be­cau­se I do­n't want you to ha­ve to crea­te ac­coun­ts he­re un­le­ss you want to, this pro­vi­des (op­tio­nal) so­cial lo­gin and re­gis­tra­tio­n. This was ea­sy to se­tup and wo­rks al­m­sost ou­t-o­f-­the-­box

Bootstrap and Django-bootstrap-toolkit

Niko­la is al­ready hea­vi­ly in­ves­ted in boots­tra­p, so it just ma­de sen­se to go fur­ther do­wn that road. I un­ders­tand boots­tra­p, and djan­go­-­boos­tra­p-­toolkit is ea­sy enou­gh (al­thou­gh I can't make their date­pi­cker wo­rk)

Django-datetime-widget

Be­cau­se fi­gh­ting is bo­rin­g.

Django-debug-toolbar

Be­cau­se Djan­go­'s me­cha­nis­ms to find tem­pla­tes and sta­tic fi­les are many and con­fu­se 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.

South

Be­cau­se it's ea­sy enou­gh, and allo­ws me so­me free­dom ex­plo­ring da­ta or­ga­ni­za­tion in my mo­dels wi­thout co­m­mi­tting to it fo­re­ver or re­crea­ting da­ta­ba­ses wi­th test da­ta all the ti­me.

Gatling

I wi­ll pro­ba­bly ser­ve the ge­ne­ra­ted si­tes via ga­tling just like my cu­rrent si­tes be­cau­se it has the sim­plest na­med do­main con­fi­gu­ra­tion po­s­si­ble, it's fast and ve­ry li­ght in re­sour­ce usage.

Markitup

A cool, sim­ple edi­tor wi­th li­ve pre­views that su­ppor­ts al­most eve­ry ma­rku­p. Not WY­SIW­YG or even WY­SIW­YM so po­s­si­bly I wi­ll ha­ve to add an al­ter­na­ti­ve. I started using djan­go­-­ma­rki­tup but it's not a good idea (it uses a old ver­sion of ma­rki­tup whi­ch re­qui­res JQue­ry < 1.9) and am in the pro­ce­ss of just using Ma­rki­tup ma­nua­ll­y.

So, feel free to gi­ve Al­va a try an­d/or gi­ve me a han­d, co­m­men­ts wel­co­me.


Contents © 2000-2024 Roberto Alsina