bugzilla on mojolicious - wordpress.com · bugzilla vs bugzilla.mozilla.org • “bugzilla” is...
TRANSCRIPT
Bugzilla ❤ MojoliciousHow I made Bugzilla run on Mojolicious
Dylan Hardison@dylan_hardisonhttps://dylan.hardison.net
Background Information
bugzilla vs
bugzilla.mozilla.org• “Bugzilla” is an open source bug tracker developed
largely by a community of volunteers from various places, initially by Mozilla.
• “bugzilla.mozilla.org” is a fork of the above, developed by Mozilla employees for the betterment of Firefox development.
• I’m responsible for both... somehow
bugzilla.mozilla.org (“BMO”) is bigger
Comparison of Code sizes
Project Perl Javascript Templates
BMO 155,000 24,000 72,000
Bugzilla 85,000 4,000 32,000Types of Perl
Project .cgi .pm .pl
BMO 15,498 123,260 16,043
Bugzilla 13,476 63,343 8,343
Has a lot of real users
Active usersThis excludes anyone that uses tracking protection
or has “DNT” set.
And better UX
“Bugzilla Harmony”
https://github.com/mozilla-bteam/bmo
So why Mojo?
mod_perl
• Requires a system perl (or, well, a lot of extra pain)
• Has weird bugs
• Not a lot of support
• Everything is pain
Bugs
Like delete $ENV{MOD_PERL}
local delete $ENV{MOD_PERL}
WTF
Maybe I can fix itJust a bit of XS
Or maybe...
replace mod_perl with Mojolicious
How hard can that be?
A note on the CGI Mojolicious plugin
Limited scope
This is the idealBut there are edge cases
This bit is generated by the modelit makes me sad
Two parts: Input and Output
InputPretending to be a CGI
%ENV
STDIN
Output
Headersthe print there, does nothing in mod_perl
But we need outputI guess this means $c->write()?
STDOUT
binmode STDOUT, ‘:utf8’
• in perl, exit() is the real C exit() function.
• it would take out the entire (worker) process (or the engine server for the simple daemon)
• exit() must be trapped too.
one last bit: exit() must be trapped
Summary
• $cgi->header() is called once and can map to manipulating the response object ($c->res)
• printing to STDOUT is pretty much just like $c->write($bytes) modulo some encoding.
• exit() needs to be trapped.
Now what?
What we consider superpowers
Three Big Reasons
• Plugins (Chiefly, the OAuth provider)
• Server Sent Events and Websockets
• Hooks around requests
MinionFleeing from TheSchwartz
Lots of other things