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.


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


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.


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.


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)


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


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, ./ rqworker and off you go) and they provide a django admin page where I can see the failed jobs, which is awesome.


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.


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.


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.


Es­to es pa­ra ayu­dar­me en una char­la que voy a dar en el Py­Day Ro­sa­rio por fa­vor res­pon­dan ho­nes­ta­men­te!


Endomondo Me Miente

Ha­ce una se­ma­na re­to­mé mi pro­gra­ma de die­ta y ejer­ci­cio. Ya que es­toy muy gor­do, el plan de ejer­ci­cios es bá­si­ca­men­te "an­dá a ca­mi­nar 5km to­dos los día­s, cho­chán". Co­mo soy un ner­d, quie­ro da­ta, así no me mien­to res­pec­to a cuan­to ca­mino.

Ha­bía vis­to En­do­mon­do men­cio­na­do en twi­tter mu­chas ve­ce­s, y los fea­tu­res pa­re­cían ser ca­si exac­ta­men­te lo que ne­ce­si­to:

  • Ra­s­­trear la ca­­mi­­na­­ta

  • Lle­­var his­­to­­­rial

  • Mo­s­­tra­r­­la en Google maps (po­r­­que es li­n­­do)

Has­ta ha­ce co­sas co­mo con­tar ca­lo­rías y co­sas así.

El úni­co pro­ble­ma es que ... es una ba­zo­fia mi­dien­do. Con­sis­ten­te­men­te so­brees­ti­ma las dis­tan­cias por al­re­de­dor de un 50%, y ya que cal­cu­la la ve­lo­ci­dad pro­me­dio ba­sa­do en tiem­po y dis­tan­cia, y el tiem­po lo mi­de bien, so­brees­ti­ma ve­lo­ci­dad por 50%, lo que ha­ce que a su vez so­brees­ti­me el uso de ca­lo­rías por (a­di­vi­nan­do) 125%.

Co­mo ve­ri­fi­qué que lo que es­tá ro­to es En­do­mon­do y no mi GP­S?

  1. Me tra­­ckeé usan­­do En­­do­­­mo­n­­do y Google Trails al mis­­mo tie­m­­po.

  2. Co­n­­té pa­­sos es­­ti­­lo mi­­lla ro­­­ma­­na (co­n­­tar ca­­da "de­­re­­cha-i­­z­­quie­r­­da", mu­l­­ti­­pli­­car por 1.6)

  3. Me­­dí el ca­­mino en Google Maps y Bing Maps

To­das esas me­di­das me di­cen que una ca­mi­na­ta de 1100 +/- 150m es me­di­da por En­do­mon­do co­mo 1.68k­m.

Ver mapa más grande

¿Por qué pa­sa eso? Po­dría asu­mir que En­do­mon­do es una ba­su­ra y tal vez ten­ga ra­zó­n, pe­ro tra­tan­do de en­con­trar una ex­pli­ca­cion "in­te­re­san­te", me in­clino ha­cia me­di­cio­nes con mu­cho rui­do. Por ejem­plo, si En­do­mon­do vie­ra mi po­si­ción cam­bian­do 0 o 15 me­tros a la iz­quier­da o de­re­cha al azar ca­da tan­to, agre­ga­ría su­fi­cien­te rui­do co­mo pa­ra jus­ti­fi­car el error (pa­ra un ejem­plo muy bue­no de es­to, lean es­te pa­per (de na­da me­nos que Be­noit Man­del­bro­t) pe­ro eso no ex­pli­ca por qué Trails mi­de me­jor (a me­nos que Trails ha­ga al­go as­tu­to con an­tia­lia­sing e in­ter­po­la­ció­n).

¿Si usás En­do­mon­do, me con­tás si te pa­sa lo mis­mo o no? No quie­ro me­ter­ne un re­view ma­lo en Google Play sin con­fir­ma­ción in­de­pen­dien­te.

Contents © 2000-2023 Roberto Alsina