55
Bugzilla Mojolicious How I made Bugzilla run on Mojolicious Dylan Hardison @dylan_hardison https://dylan.hardison.net

Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Bugzilla ❤ MojoliciousHow I made Bugzilla run on Mojolicious

Dylan Hardison@dylan_hardisonhttps://dylan.hardison.net

Page 2: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Background Information

Page 3: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

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

Page 4: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

bugzilla.mozilla.org (“BMO”) is bigger

Page 5: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

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

Page 6: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Has a lot of real users

Page 7: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Active usersThis excludes anyone that uses tracking protection

or has “DNT” set.

Page 8: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

And better UX

Page 9: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 10: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 11: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 12: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

“Bugzilla Harmony”

Page 13: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

So now I’m just talking about

bugzilla.mozilla.org (BMO)

Page 14: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

https://github.com/mozilla-bteam/bmo

Page 15: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

So why Mojo?

Page 16: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

mod_perl

• Requires a system perl (or, well, a lot of extra pain)

• Has weird bugs

• Not a lot of support

• Everything is pain

Page 17: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Bugs

Page 18: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Like delete $ENV{MOD_PERL}

Page 19: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

local delete $ENV{MOD_PERL}

Page 20: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 21: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

WTF

Page 22: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Maybe I can fix itJust a bit of XS

Page 23: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Or maybe...

Page 24: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

replace mod_perl with Mojolicious

Page 25: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

How hard can that be?

Page 26: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

A note on the CGI Mojolicious plugin

Page 27: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Limited scope

Page 28: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

This is the idealBut there are edge cases

Page 29: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

This bit is generated by the modelit makes me sad

Page 30: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Two parts: Input and Output

Page 31: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

InputPretending to be a CGI

Page 32: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

%ENV

Page 33: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 34: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 35: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 36: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

STDIN

Page 37: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 38: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Output

Page 39: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Headersthe print there, does nothing in mod_perl

Page 40: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 41: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

But we need outputI guess this means $c->write()?

Page 42: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

STDOUT

Page 43: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 44: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

binmode STDOUT, ‘:utf8’

Page 45: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 46: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various
Page 47: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

• 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.

Page 48: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

one last bit: exit() must be trapped

Page 49: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

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.

Page 50: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Now what?

Page 51: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

What we consider superpowers

Page 52: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Three Big Reasons

• Plugins (Chiefly, the OAuth provider)

• Server Sent Events and Websockets

• Hooks around requests

Page 53: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

MinionFleeing from TheSchwartz

Page 54: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various

Lots of other things

Page 55: Bugzilla on Mojolicious - WordPress.com · bugzilla vs bugzilla.mozilla.org • “Bugzilla” is an open source bug tracker developed largely by a community of volunteers from various