Sitespeed.io

From wiki.mikejung.biz
Jump to navigation Jump to search

How to test a single URL with sitespeed.io

If you don't want to test multiple pages / crawl a site with sitespeed.io, you must use the option "-d 0" which will tell sitespeed.io to crawl to a depth of 0 (-d How deep to crawl).

sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io sitespeed.io -d 0 -u https://somedomain.domain -b chrome

How to configure all 3 sitespeed.io containers to work together

Graphite Container Details / Commands

To get the graphite container running we need to create a new directory on our local storage (not in a docker container).

sudo mkdir graphite/
sudo docker run -d --name graphite -p 8080:80 -p 2003:2003 --restart="always" -v $path/to/graphite:/opt/graphite/storage/whisper sitespeedio/graphite

Once you launch this container (assuming you are using docker on a local PC), you can view the graphite dashboard by visiting this URL http://localhost:8080/

Grafana Container Details / Commands

To get Grafana up and running we need to make another new directory on our local storage (not in a docker container).

sudo mkdir -p graphana/
sudo docker run -d -p 3000:3000 -v $path/to/graphana:/var/lib/grafana -e "GF_SECURITY_ADMIN_USER=user" -e "GF_SECURITY_ADMIN_PASSWORD=password" --name grafana --restart="always" grafana/grafana

Assuming the Grafana container starts up correctly, you should be able to view the admin dashboard at this URL http://localhost:3000/login

Using Graphite, Grafana and Sitespeed.io together

Once Graphite and Grafana containers are up and running and you have verified that both are actually working (visit the URLs!) you can finally run sitespeed.io and send the results to the graphite container! You will have to run:

sudo docker inspect $graphite_container_id

Look for the "IPAddress", mine was 172.17.0.12, yours may be different, but whatever it is, note it, we are going to use that IP in the next command.

sudo docker run --privileged --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io sitespeed.io -d 0 -u https://wiki.mikejung.biz -b firefox --graphiteHost $graphite_docker_ip 

At this point sitespeed.io will run and my site will be analyzed, after that's done the details should be sent over to graphite so you can see the data in a graphf!

Install sitespeed.io on Ubuntu 15.10 (without docker)

Run all this stuff

apt-get install -y curl
curl --silent --location https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
apt-get install -y default-jre-headless git libicu55 nodejs build-essential
npm set progress=false
npm install -g sitespeed.io && npm cache clean
apt-get purge -y curl git build-essential
apt-get clean autoclean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

If the install worked you should be able to run this command

sitespeed.io -h

How to install graphite, carbon and whisper on Ubuntu 15.10

easy way

apt-get install graphite-web graphite-carbon

Getting Dat Database ready for Django

apt-get install postgresql libpq-dev python-psycopg2

Create postgres db and user to use with graphite

sudo -u postgres psql

When in the postgres cli, run this

CREATE USER graphite WITH PASSWORD 'password';
CREATE DATABASE graphite WITH OWNER graphite;
\q

hard way

First we need to grab the packages from graphite's download page, make sure you grab the LATEST versions, which can be found here - https://launchpad.net/graphite/+download

wget https://launchpad.net/graphite/0.9/0.9.10/+download/graphite-web-0.9.10.tar.gz
wget https://launchpad.net/graphite/0.9/0.9.10/+download/carbon-0.9.10.tar.gz
wget https://launchpad.net/graphite/0.9/0.9.10/+download/whisper-0.9.10.tar.gz

Now we need to extract the files

tar zxvf carbon-0.9.10.tar.gz
tar zxvf graphite-web-0.9.10.tar.gz
tar zxvf whisper-0.9.10.tar.gz

cd into carbon, then run the setup.py script to build and install carbon

cd carbon-0.9.10/
chmod +x setup.py
./setup.py build
./setup.py install

Now we cd into graphite's directory, before we try and install using setup.py we need to make sure dependencies are installed. I had to install a bunch of python packages via pip before I met all dependencies.

cd graphite-web-0.9.10/
apt-get install python-pip python-dev libsasl2-dev libldap2-dev libssl-dev libapache2-mod-python
pip install -U pip setuptools
pip install django
pip install django-realtime --upgrade
pip install django-tagging
pip install python-memcached
pip install python-ldap
pip install txamqp
pip install whisper
chmod +x setup.py
./setup.py build
./setup.py install

Do the same process to install whisper.

cd whisper-0.9.10/
chmod +x setup.py
./setup.py build
./setup.py install