Set up Speedlify on Ubuntu server

Published:

Speedlify is an awesome free piece of software from Zach Leatherman for tracking changes in website performance over time. Before any customer asks, Speedlify is lacking a lot of useful features commercial offerings (like SpeedCurve, which we use on your sites) have to diagnose web performance issues. But for keeping a casual eye on performance regressions Speedlify is a great tool to have to hand.

I track all our clients’ sites using it. However setting up Speedlify on an Ubuntu server isn’t as straightforward as cloning the repository and running npm install.

tl;dr install these packages first:

apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libgbm-dev

How I got here

I find reading the thought process people follow when debugging useful, so here’s mine.

I first tried prepending DEBUG=* when running npm run test-pages, in the hope of seeing what was going on (I got the tip from this comment”). Unfortunately it gave little output.

Then I thought about what software Speedlify was using. If I removed Speedlify from the equation and ran the software directly, I might get more helpful error messages. So I ran lighthouse directly using

CHROME_PATH=/home/speedlify/speedlify/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome node ./node_modules/lighthouse/lighthouse-cli https://google.com  --chrome-flags="--no-sandbox --headless --disable-gpu"

This output an error message saying that a .so was missing. I installed that, re-ran the command and out popped an error message saying another .so was listed.

Now knowing what the problem was, rather than installing them one-by-one I went looking for a list of the required extra packages. After a bit of trial and error (there’s lots of “You need this to get Puppeteer to run” posts, many outdated - one of which I’d tried installing straight after my first comment, and it didn’t work) I found the list above.