### Start sitespeed.io Server with Configuration Source: https://www.sitespeed.io/documentation/onlinetest Demonstrates how to start the sitespeed.io server using a specified configuration file. ```bash sitespeed.io-server --config path/to/file ``` -------------------------------- ### Install ffmpeg on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the ffmpeg utility, which is required for video recording capabilities within sitespeed.io. This command updates the package list and then installs ffmpeg. ```bash sudo apt-get update -y && sudo apt-get install -y ffmpeg ``` -------------------------------- ### Install Throttle using npm Source: https://www.sitespeed.io/documentation/throttle This command installs the Throttle package globally using npm, making it available as a command-line tool. Ensure you have Node.js and npm installed. ```bash npm install @sitespeed.io/throttle -g ``` -------------------------------- ### YAML Configuration Example Source: https://www.sitespeed.io/documentation/onlinetest An example of a configuration snippet in YAML format, demonstrating how to set parameters like redis host. ```yaml redis: host: "127.0.0.1" ``` -------------------------------- ### Install sitespeed.io Globally Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs sitespeed.io globally using npm, ensuring it is accessible from any directory. It also recommends following Sindre Sorhus's guide for installing npm packages without sudo. ```bash npm install sitespeed.io --location=global ``` -------------------------------- ### Install sitespeed.io Server (NPM) Source: https://www.sitespeed.io/documentation/onlinetest Installs the sitespeed.io server globally using npm. This command requires NodeJS and npm to be installed on the system. ```bash npm install @sitespeed.io/server -g ``` -------------------------------- ### Start Network Simulation in NodeJS (Promise) Source: https://www.sitespeed.io/documentation/throttle Starts network simulation directly within a NodeJS application using the Throttle module. It returns a promise that resolves when the simulation starts. Requires the '@sitespeed.io/throttle' package to be installed. ```javascript import throttle from '@sitespeed.io/throttle' // Returns a promise throttle.start({up: 360, down: 780, rtt: 200}).then(() => ... ``` -------------------------------- ### Install sitespeed.io Dependencies on Debian Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This command downloads and executes a script to install sitespeed.io dependencies on Debian systems. It automates the setup of required software. Tested on Debian 12. ```bash wget -O - https://gist.githubusercontent.com/soulgalore/2f070b0a150360053f7198a4e9067db1/raw/cc1c56577195832225ddc36460f6fc53510d6de3/install-sitespeed.io-and-dependencies-debian.sh | bash ``` -------------------------------- ### Install NodeJS LTS on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the Long Term Support (LTS) version of Node.js on Ubuntu systems. This involves downloading a setup script, executing it, and then installing the nodejs package. ```bash curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh sudo bash nodesource_setup.sh sudo apt install -y nodejs ``` -------------------------------- ### Start Docker Compose for sitespeed.io (Bash) Source: https://www.sitespeed.io/documentation/onlinetest Starts the Docker containers defined in the 'docker-compose.yml' and 'docker-compose.app.yml' files. This command launches KeyDB, PostgreSQL, Minio, the sitespeed.io server, and test runner. ```bash docker compose -f docker-compose.yml -f docker-compose.app.yml up ``` -------------------------------- ### Start Docker Compose Dependencies (Bash) Source: https://www.sitespeed.io/documentation/onlinetest Starts the dependency services (KeyDB, PostgreSQL, Minio) using Docker Compose. This is used when not running the full onlinetest stack via Docker Compose but still need the dependencies. ```bash docker compose up ``` -------------------------------- ### Install xvfb on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs X Virtual Framebuffer (xvfb), a display server that enables running graphical applications like browsers in an environment without a physical display, which is necessary for headless testing with sitespeed.io. ```bash sudo apt-get install -y xvfb ``` -------------------------------- ### Start sitespeed.io Server with Docker Source: https://www.sitespeed.io/documentation/onlinetest Shows how to run the sitespeed.io server using Docker, mounting a local configuration file. ```bash docker run --rm -v "$(pwd)":/config sitespeedio/server:1.7.1 --config /config/config.yml ``` -------------------------------- ### Install sitespeed.io via Docker (Windows) Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This snippet shows the Docker commands for Windows. It first pulls the latest sitespeed.io image and then runs it, mounting the current directory for output. Note the use of `${pwd}` for the volume mount, which is specific to Windows command prompt environments. ```bash C:\Users\Vicky> docker pull sitespeedio/sitespeed.io C:\Users\Vicky> docker run --rm -v ${pwd}:/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io -b firefox ``` -------------------------------- ### Run sitespeed.io Test Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This command executes sitespeed.io with specified configurations after the user has switched to the 'sitespeedio' user. It includes options for running with XVFB, Chrome, recording video, and capturing visual metrics. ```bash su - sitespeedio sitespeed.io https://www.sitespeed.io --xvfb -b chrome --video --visualMetrics ``` -------------------------------- ### Install Video and Visual Metrics Dependencies on Raspberry Pi Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs FFmpeg for video recording and Python packages (pyssim, OpenCV-Python, Numpy, scipy) for visual metrics analysis on a Raspberry Pi. ```bash sudo apt-get update && sudo apt-get install -y ffmpeg python -m pip install pyssim OpenCV-Python Numpy scipy --break-system-packages ``` -------------------------------- ### Install sitespeed.io Dependencies on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This script automates the installation of all necessary dependencies for running sitespeed.io on Ubuntu, including Node.js, ffmpeg, Python libraries, xvfb, and network tools. It also creates a dedicated user for running sitespeed.io. Tested on Ubuntu 22.04. ```bash bash <(curl -sL https://gist.githubusercontent.com/soulgalore/18fbf40670a343fa1cb0606756c90a00/raw/7218332445010ee64e3301f2021bcf18a91f0627/install-sitespeed.io-and-dependencies-ubuntu.sh) ``` -------------------------------- ### Start and Stop Network Simulation in NodeJS (Async/Await) Source: https://www.sitespeed.io/documentation/throttle Demonstrates starting and stopping network simulation in NodeJS using async/await syntax. This approach allows for sequential execution of simulation start, task execution, and simulation stop. ```javascript import throttle from '@sitespeed.io/throttle' const options = {up: 360, down: 780, rtt: 200}; await throttle.start(options); // Do your thing and then stop await throttle.stop(); ``` -------------------------------- ### Install Microsoft Edge Stable on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the stable version of Microsoft Edge on Ubuntu. This involves importing the Microsoft signing key, adding the Edge repository, updating the package list, and installing the edge-stable package. ```bash curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list' sudo apt-get update sudo apt-get install -y microsoft-edge-stable ``` -------------------------------- ### Start Network Simulation (CLI) Source: https://www.sitespeed.io/documentation/throttle Starts simulating a slower network connection with specified upload speed (kbit/s), download speed (kbit/s), and Round Trip Time (RTT in ms). Requires sudo privileges. ```bash throttle --up 330 --down 780 --rtt 200 ``` -------------------------------- ### Install sitespeed.io Globally via NPM Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This command installs sitespeed.io globally on your system using npm, making the 'sitespeed.io' command available from any directory. This method requires Node.js and npm to be pre-installed. ```bash npm install sitespeed.io -g ``` -------------------------------- ### Install Google Chrome on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs Google Chrome stable version on Ubuntu. This process involves adding the Google Chrome repository to the system's sources and then installing the chrome-stable package. ```bash wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' sudo apt update sudo apt install -y google-chrome-stable ``` -------------------------------- ### Install net-tools on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the net-tools package, which provides utilities like 'ip' and 'tc'. These tools are required for network throttling functionality within sitespeed.io. ```bash sudo apt-get install -y net-tools ``` -------------------------------- ### Install NodeJS LTS on Raspberry Pi Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the latest LTS version of NodeJS on a Raspberry Pi using the NodeSource repository. This is a prerequisite for installing sitespeed.io. ```bash curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install nodejs ``` -------------------------------- ### Run sitespeed.io Test with Chrome Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Executes a sitespeed.io test using Google Chrome. The command specifies the number of runs, enables video recording and visual metrics, uses XVFB, flushes DNS, and applies network throttling. ```bash sitespeed.io -n 5 -b chrome https://www.sitespeed.io --video --visualMetrics --xvfb --browsertime.flushDNS true --connectivity.engine throttle -c cable ``` -------------------------------- ### Install sitespeed.io Test Runner (NPM) Source: https://www.sitespeed.io/documentation/onlinetest Installs the sitespeed.io test runner globally using npm. This command requires NodeJS and npm to be installed on the system. ```bash npm install @sitespeed.io/testrunner -g ``` -------------------------------- ### Install Android SDK command-line tools (macOS) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command installs the Android SDK command-line tools using Homebrew on macOS. These tools are necessary for managing Android devices and ADB connections when not using Docker. ```bash brew install --cask android-platform-tools ``` -------------------------------- ### Create and Configure sitespeedio User Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Creates a new user named 'sitespeedio', adds them to the sudo group, and configures sudo to allow this user to run commands without a password. It then switches to the 'sitespeedio' user to run sitespeed.io. ```bash adduser sitespeedio usermod -aG sudo sitespeedio su - sitespeedio echo "sitespeedio ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee "/etc/sudoers.d/sitespeedio" ``` -------------------------------- ### Run sitespeed.io Test with Edge Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Executes a sitespeed.io test using Microsoft Edge. The command configures the test for 5 runs, enables video and visual metrics, uses XVFB, flushes DNS, and applies network throttling for a 'cable' connection. ```bash sitespeed.io -n 5 -b edge https://www.sitespeed.io --video --visualMetrics --xvfb --browsertime.flushDNS true --connectivity.engine throttle -c cable ``` -------------------------------- ### Install Android SDK command-line tools (Linux) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command installs the Android SDK command-line tools using apt-get on Debian-based Linux distributions. These tools are essential for managing Android devices and ADB connections when not using Docker. ```bash apt-get install android-tools-adb ``` -------------------------------- ### Install sitespeed.io via Docker (Mac & Linux) Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This command uses Docker to run sitespeed.io. It mounts the current directory to the container, allowing output to be saved locally. The `-b firefox` flag specifies Firefox as the browser to use for testing. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io https://www.sitespeed.io -b firefox ``` -------------------------------- ### Install Python Dependencies for sitespeed.io Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs Python 3 and pip, along with essential Python libraries such as pyssim, OpenCV-Python, Numpy, and scipy, which are utilized by sitespeed.io for certain functionalities. ```bash sudo apt-get install -y python-is-python3 python3-dev python3-pip python -m pip install pyssim OpenCV-Python Numpy scipy ``` -------------------------------- ### Install NodeJS and Python Dependencies (Mac M1) Source: https://www.sitespeed.io/documentation/sitespeed.io/installation This section details the installation of Node.js LTS, npm, FFmpeg, and Python with necessary packages (Pillow, pyssim, OpenCV-Python, Numpy, scipy) on an Apple Mac M1. It includes steps for setting up Homebrew, pyenv, and pip, and configuring user permissions for sudo commands. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` ```bash brew install node@20 ``` ```bash brew install ffmpeg ``` ```bash brew install pyenv ``` ```bash pyenv install 3.9.1 ``` ```bash pyenv global 3.9.1 ``` ```bash echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc ``` ```bash source ~/.zshrc ``` ```bash curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py ``` ```bash python get-pip.py --user ``` ```bash python -m pip install --user pillow pyssim OpenCV-Python Numpy scipy ``` ```bash echo "${USER} ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee "/etc/sudoers.d/sitespeedio" ``` ```bash brew install --cask android-platform-tools ``` -------------------------------- ### Skip EdgeDriver Download during npm install Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs sitespeed.io using npm while skipping the automatic download of EdgeDriver by setting the EDGEDRIVER_SKIP_DOWNLOAD environment variable. ```bash EDGEDRIVER_SKIP_DOWNLOAD=true npm install sitespeed.io -g ``` -------------------------------- ### Install Firefox on Ubuntu Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs the Firefox web browser on Ubuntu systems using the apt package manager. This is one of the browsers that can be used with sitespeed.io. ```bash sudo apt install firefox -y ``` -------------------------------- ### Install ADB and Chromedriver on Raspberry Pi Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs ADB (Android Debug Bridge) and Chromedriver, essential tools for controlling Android devices and browsers, on a Raspberry Pi. ```bash sudo apt-get update sudo apt-get install chromium-chromedriver adb -y ``` -------------------------------- ### Skip GeckoDriver Download during npm install Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs sitespeed.io using npm while skipping the automatic download of GeckoDriver by setting the GECKODRIVER_SKIP_DOWNLOAD environment variable. ```bash GECKODRIVER_SKIP_DOWNLOAD=true npm install sitespeed.io -g ``` -------------------------------- ### Log Throttle Commands (CLI Flag) Source: https://www.sitespeed.io/documentation/throttle Enables logging of all commands executed by Throttle using the `--log` command-line flag. This provides visibility into the network simulation setup process. ```bash throttle 3gslow --log ``` -------------------------------- ### Run sitespeed.io Test on Android Device Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Executes a sitespeed.io test against a specified URL on an Android device. Includes options for video recording and visual metrics. ```bash sitespeed.io https://www.sitespeed.io --android -n 1 --video --visualMetrics ``` -------------------------------- ### Run sitespeed.io Testrunner with Configuration Source: https://www.sitespeed.io/documentation/onlinetest Execute the sitespeed.io testrunner, providing a custom configuration file. This is useful when you have specific testing parameters or setups. ```Bash sitespeed.io-testrunner --config path/to/file ``` -------------------------------- ### Install and Use Throttle Outside Docker on OS X Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Installs the @sitespeed.io/throttle package globally and uses it to set 'cable' connectivity before running sitespeed.io in Docker. It also includes commands to stop the throttle service. ```bash # First install $ npm install @sitespeed.io/throttle -g # Then set the connectivity, run and stop $ throttle cable $ docker run --shm-size=1g --rm sitespeedio/sitespeed.io:38.5.2 https://www.sitespeed.io/ $ throttle stop ``` -------------------------------- ### Specify ChromeDriver Version during npm install Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs sitespeed.io using npm and specifies a particular version of ChromeDriver to be downloaded using the CHROMEDRIVER_VERSION environment variable. ```bash CHROMEDRIVER_VERSION=81.0.4044.20 npm install ``` -------------------------------- ### Skip ChromeDriver Download during npm install Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Installs sitespeed.io using npm while skipping the automatic download of ChromeDriver by setting the CHROMEDRIVER_SKIP_DOWNLOAD environment variable. ```bash CHROMEDRIVER_SKIP_DOWNLOAD=true npm install sitespeed.io -g ``` -------------------------------- ### Run sitespeed.io Test with Firefox Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Executes a sitespeed.io test using Firefox as the browser. The command includes settings for the number of runs, video recording, visual metrics, XVFB, DNS flushing, and network throttling. ```bash sitespeed.io -n 5 -b firefox https://www.sitespeed.io --video --visualMetrics --xvfb --browsertime.flushDNS true --connectivity.engine throttle -c cable ``` -------------------------------- ### Build sitespeed.io Docker Image Source: https://www.sitespeed.io/documentation/sitespeed.io/docker Instructions to clone the sitespeed.io repository and build a Docker image locally. This is useful for development or custom builds. It requires Docker to be installed and accessible. ```bash git clone https://github.com/sitespeed/sitespeed.io.git cd sitespeed.io docker build --load -t sitespeedio/sitespeed.io . ``` -------------------------------- ### Use Pre-made Network Profiles (CLI) Source: https://www.sitespeed.io/documentation/throttle Starts network simulation using a pre-defined profile. The `--profile` flag accepts names like '3g', 'dsl', 'lte', etc., each with specific speed and RTT values. Use `throttle --help` to see all available profiles. ```bash throttle --profile 3gslow ``` ```bash throttle 3gslow ``` -------------------------------- ### Run sitespeed.io with Video and Visual Metrics (Mac/No Docker) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command initiates a sitespeed.io performance test on an Android device, capturing video and collecting Visual Metrics. Ensure VisualMetrics requirements are installed locally if not using Docker. ```bash sitespeed.io --android --video --visualMetrics https://www.sitespeed.io ``` -------------------------------- ### Install PageXray CLI Source: https://www.sitespeed.io/documentation/pagexray Installs the PageXray command-line interface globally using npm. This allows you to run PageXray directly from your terminal. ```bash npm install pagexray -g ``` -------------------------------- ### Configure VNC Server on Raspberry Pi Source: https://www.sitespeed.io/documentation/sitespeed.io/installation Configures the VNC server on a Raspberry Pi using the raspi-config utility. This allows remote desktop access to the Raspberry Pi. ```bash sudo raspi-config ``` -------------------------------- ### Start VNC Server within Docker Container Source: https://www.sitespeed.io/documentation/sitespeed.io/docker This command starts an x11vnc server within the Docker container, specifically displaying on the Xvfb display ':99'. It prompts you to set a password for VNC access. This enables remote viewing of the container's desktop session. ```bash x11vnc -display :99 -storepasswd ``` -------------------------------- ### Install Lighthouse Plugin for NodeJS Test Runners Source: https://www.sitespeed.io/documentation/onlinetest This command installs the Lighthouse plugin for sitespeed.io when using NodeJS-based test runners. It ensures that the necessary functionality for running Lighthouse audits is available in your testing environment. Run this command globally using npm. ```bash npm install @sitespeed.io/plugin-lighthouse -g ``` -------------------------------- ### Run sitespeed.io with an Extra Start Script Source: https://www.sitespeed.io/documentation/sitespeed.io/docker This command allows you to execute a custom script within the sitespeed.io Docker container during startup. The script path inside the container is specified using the `EXTRA_START_SCRIPT` environment variable (e.g., `/sitespeed.io/test.sh`). ```bash docker run -e EXTRA_START_SCRIPT=/sitespeed.io/test.sh --rm -v "$(pwd):/sitespeed.io" ... ``` -------------------------------- ### Enable Lighthouse Testing in sitespeed.io Configuration Source: https://www.sitespeed.io/documentation/onlinetest This configuration snippet enables Lighthouse testing within sitespeed.io. By setting `useLighthouse` to `true` in the HTML configuration, a checkbox will appear in the extras section of the UI, allowing users to easily initiate Lighthouse tests. This feature requires no external dependencies beyond the base sitespeed.io setup. ```yaml html: # Show the Lighthouse box useLighthouse: true ``` -------------------------------- ### Inspect sitespeed.io Docker Container with Bash Source: https://www.sitespeed.io/documentation/sitespeed.io/docker This command allows you to change the entry point of the sitespeed.io Docker container to 'bash', enabling you to inspect its contents. No specific dependencies are required beyond Docker being installed and the sitespeed.io image being available. ```bash docker run -it --entrypoint bash sitespeedio/sitespeed.io:38.5.2 ``` -------------------------------- ### Minimal HAR Comparison Configuration (JSON) Source: https://www.sitespeed.io/documentation/compare This configuration defines the essential URLs for two HAR files to be compared. It's the most basic setup required for the comparison tool to function. ```json { "har1": { "url": "https://www.url.com/page1.har" }, "har2": { "url": "https://www.url.com/page2.har" } } ``` -------------------------------- ### Emulate Mobile Device with sitespeed.io (Chrome) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command uses sitespeed.io with Chrome to emulate a specific mobile device by setting its device name. It's a basic setup for mobile emulation. ```bash sitespeed.io https://www.sitespeed.io -b chrome --browsertime.chrome.mobileEmulation.deviceName "Moto G4" ``` -------------------------------- ### Emulate Mobile Device and Throttle CPU with sitespeed.io (Chrome) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command extends mobile emulation by also throttling the CPU, simulating slower mobile hardware performance. A CPU throttling rate of 6 is used as an example. ```bash sitespeed.io https://www.sitespeed.io -b chrome --browsertime.chrome.mobileEmulation.deviceName "Moto G4" --browsertime.chrome.CPUThrottlingRate 6 ``` -------------------------------- ### Run Docker Container with Network Privileges Source: https://www.sitespeed.io/documentation/throttle Starts a Docker container with the necessary capabilities to modify network settings. The `--cap-add=NET_ADMIN` flag grants the container the permission to perform network-related operations, which Throttle requires. ```bash docker run --cap-add=NET_ADMIN ... ``` -------------------------------- ### Run sitespeed.io test with gnirehtet and throttling (npm) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command runs a sitespeed.io test on an Android device, utilizing gnirehtet for reverse tethering and the 'throttle' engine for network simulation. It's useful for testing specific network conditions. Ensure gnirehtet is installed via Homebrew on macOS. ```bash sitespeed.io --android --video --visualMetrics --gnirehtet --connectivity.engine throttle -c 4g https://www.sitespeed.io ``` -------------------------------- ### Setup Custom Docker Networks with tc Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity A bash script that creates custom Docker bridge networks with specific network configurations using 'tc' for traffic control. It defines four networks: '3g', 'cable', '3gfast', and '3gslow', each with different rate limits and delays. ```bash #!/bin/bash echo 'Starting Docker networks' docker network create --driver bridge --subnet=192.168.33.0/24 --gateway=192.168.33.10 --opt "com.docker.network.bridge.name"="docker1" 3g tc qdisc add dev docker1 root handle 1: htb default 12 tc class add dev docker1 parent 1:1 classid 1:12 htb rate 1.6mbit ceil 1.6mbit tc qdisc add dev docker1 parent 1:12 netem delay 150ms docker network create --driver bridge --subnet=192.168.34.0/24 --gateway=192.168.34.10 --opt "com.docker.network.bridge.name"="docker2" cable tc qdisc add dev docker2 root handle 1: htb default 12 tc class add dev docker2 parent 1:1 classid 1:12 htb rate 5mbit ceil 5mbit tc qdisc add dev docker2 parent 1:12 netem delay 14ms docker network create --driver bridge --subnet=192.168.35.0/24 --gateway=192.168.35.10 --opt "com.docker.network.bridge.name"="docker3" 3gfast tc qdisc add dev docker3 root handle 1: htb default 12 tc class add dev docker3 parent 1:1 classid 1:12 htb rate 1.6mbit ceil 1.6mbit tc qdisc add dev docker3 parent 1:12 netem delay 75ms docker network create --driver bridge --subnet=192.168.36.0/24 --gateway=192.168.36.10 --opt "com.docker.network.bridge.name"="docker4" 3gslow tc qdisc add dev docker4 root handle 1: htb default 12 tc class add dev docker4 parent 1:1 classid 1:12 htb rate 0.4mbit ceil 0.4mbit tc qdisc add dev docker4 parent 1:12 netem delay 200ms ``` -------------------------------- ### Run Development Server (npm) Source: https://www.sitespeed.io/documentation/compare This command initiates the local development server for the project. It's used by developers to run and test the compare.sitespeed.io tool locally. ```bash npm run develop ``` -------------------------------- ### PageXray JSON Output Example Source: https://www.sitespeed.io/documentation/pagexray An example of the JSON output produced by PageXray after converting a HAR file. This structure includes details about the page, content types, response codes, domains, and visual metrics. ```json [ { "url": "https://www.sitespeed.io/", "meta": { "browser": { "name": "Chrome", "version": "60.0.3112.78" }, "startedDateTime": "2017-08-24T18:26:29.077Z", "connectivity": "native", "title": "Sitespeed.io - Welcome to the wonderful world of Web Performance run 1" }, "finalUrl": "https://www.sitespeed.io/", "baseDomain": "www.sitespeed.io", "documentRedirects": 0, "redirectChain": [], "transferSize": 98791, "contentSize": 120776, "headerSize": 0, "requests": 10, "missingCompression": 0, "httpType": "h2", "httpVersion": "HTTP/2.0", "contentTypes": { "html": { "transferSize": 8479, "contentSize": 28279, "headerSize": 0, "requests": 1 }, "css": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "javascript": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "image": { "transferSize": 87309, "contentSize": 85979, "headerSize": 0, "requests": 8 }, "font": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "favicon": { "transferSize": 3003, "contentSize": 6518, "headerSize": 0, "requests": 1 } }, "assets": [], "responseCodes": { "200": 10 }, "firstParty": {}, "thirdParty": {}, "domains": { "www.sitespeed.io": { "transferSize": 98791, "contentSize": 120776, "headerSize": -10, "requests": 10, "timings": { "blocked": 169, "dns": 0, "connect": 0, "send": 6, "wait": 3624, "receive": 104 } } }, "expireStats": { "min": 600, "median": 31536000, "max": 31536000, "total": 283824600, "values": 10 }, "lastModifiedStats": { "min": 733347, "median": 733444, "max": 733480, "total": 7334359, "values": 10 }, "cookieStats": { "min": 0, "median": 0, "max": 0, "total": 0, "values": 10 }, "totalDomains": 1, "visualMetrics": { "FirstVisualChange": 617, "SpeedIndex": 625, "VisualComplete85": 617, "LastVisualChange": 1033, "VisualProgress": { "0": 0, "617": 98, "633": 98, "667": 98, "850": 98, "1033": 100 } } } ] ``` -------------------------------- ### Configure Humble Engine for Mobile Testing Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Sets the connectivity engine to 'humble' and specifies the Raspberry Pi's URL for Humble. It also configures Android testing and the '3g' connectivity profile. ```bash sitespeed.io --browsertime.connectivity.engine=humble --browsertime.connectivity.humble.url=http://raspberrypi.local:3001 --android --browsertime.connectivity.profile 3g https://www.sitespeed.io/ ``` -------------------------------- ### Clone onlinetest Repository (Git) Source: https://www.sitespeed.io/documentation/onlinetest Clones the sitespeed.io onlinetest repository from GitHub. This is the first step for setting up the onlinetest environment, especially when using Docker. ```bash git clone https://github.com/sitespeedio/onlinetest.git ``` -------------------------------- ### Run sitespeed.io with Mounted Volume and Synchronized Time (Linux) Source: https://www.sitespeed.io/documentation/sitespeed.io/docker This Docker command runs sitespeed.io, mounting the current working directory to `/sitespeed.io` for data storage and synchronizing the container's time with the host system using `/etc/localtime`. This is specific to Linux environments. ```bash docker run --shm-size 2g --rm -v "$(pwd):/sitespeed.io" -v /etc/localtime:/etc/localtime:ro sitespeedio/sitespeed.io:38.5.2 -b firefox https://www.sitespeed.io/ ``` -------------------------------- ### Configure Desktop Testing Environment Source: https://www.sitespeed.io/documentation/onlinetest Define settings for running tests on desktop browsers, including specifying which browsers to use and the desired connectivity simulation. 'useDocker' controls whether to leverage Docker for browser execution. ```YAML - name: "Desktop Browsers" type: "desktop" browsers: ["chrome", "firefox", "edge"] connectivity: ["native", "3g", "4g", "cable"] useDocker: false ``` -------------------------------- ### Configure Valid Test Domains for sitespeed.io Source: https://www.sitespeed.io/documentation/onlinetest YAML configuration to restrict testing to specific domains using a regular expression. Example shows testing all URLs on a specific domain. ```yaml validTestDomains: "^www\.sitespeed\.io$" ``` -------------------------------- ### Configure pf.conf on OSX Source: https://www.sitespeed.io/documentation/throttle These lines should be added to the `/etc/pf.conf` file on macOS to prevent errors when using `pfctl` with Throttle. This ensures that `pf` and `pflog` services are enabled. ```bash pf_enable="YES" pflog_enable="YES" ``` -------------------------------- ### Configure Basic Authentication for sitespeed.io Server Source: https://www.sitespeed.io/documentation/onlinetest YAML configuration for setting up basic authentication on the sitespeed.io server, including login and password. ```yaml basicAuth: login: password: ``` -------------------------------- ### Run sitespeed.io Testrunner using Docker Source: https://www.sitespeed.io/documentation/onlinetest Launch the sitespeed.io testrunner within a Docker container, mounting local directories for configuration and enabling necessary network capabilities. This ensures a consistent testing environment. ```Bash docker run -v "$(pwd)":/config --cap-add=NET_ADMIN -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp sitespeedio/testrunner:1.2.0 --config /config/config.json ``` -------------------------------- ### Run sitespeed.io AMD container on Mac ARM with Emulation Source: https://www.sitespeed.io/documentation/sitespeed.io/docker Command to run sitespeed.io AMD containers on Mac ARM devices using Rosetta emulation. This requires Docker Desktop with emulation enabled and specifies the platform architecture. ```bash docker run --rm -v "$(pwd):/sitespeed.io" --platform linux/amd64 sitespeedio/sitespeed.io:38.5.2 https://www.sitespeed.io/ ``` -------------------------------- ### Access Local Network Services with Docker Compose Source: https://www.sitespeed.io/documentation/sitespeed.io/docker When using Docker Compose, you can connect the sitespeed.io container to a specific Docker network (e.g., `sitespeedio_default`) to access services running within that compose setup, such as Graphite or Grafana. ```bash docker run --shm-size 2g --rm -v "$(pwd):/sitespeed.io" --network sitespeedio_default sitespeedio/sitespeed.io:38.5.2 -b firefox http://localhost:4000/ ``` -------------------------------- ### Configure KeyDB for Message Broker Source: https://www.sitespeed.io/documentation/onlinetest This configuration snippet for KeyDB sets essential parameters for its use as a message broker in sitespeed.io. It includes settings for port, password, memory limits, and persistence to ensure reliable communication between the server and test runners. Adjust 'YOUR_PASSWORD_THAT_YOU_NEED_TO_CHANGE' and 'maxmemory' according to your server's resources. ```ini # You can read more about keydb configuration: https://docs.keydb.dev/docs/config-file/ # The default port port 6379 # Your password, make sure to change this requirepass YOUR_PASSWORD_THAT_YOU_NEED_TO_CHANGE # Choose max memory, adjust this to the server where you run keydb # You can also choose how many objects that should stay in keydb # by changing removeOnComplete in the server configuration maxmemory 6GB maxmemory-policy allkeys-lru # You can configure to store the the data so that queued tests will survive # a restart appendonly yes appendfilename appendonly.aof appendfsync everysec ``` -------------------------------- ### Navigate to Project Directory (Bash) Source: https://www.sitespeed.io/documentation/onlinetest Changes the current directory to the 'onlinetest' project folder after cloning the repository. This is a standard bash command to move into a specific directory. ```bash cd onlinetest ``` -------------------------------- ### Run sitespeed.io test on Android (npm) Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command executes a sitespeed.io test targeting an Android device connected via USB. It assumes sitespeed.io is installed via npm. Ensure your Android device is properly set up with USB debugging enabled. ```bash sitespeed.io --android https://www.sitespeed.io ``` -------------------------------- ### Run sitespeed.io with VNC Visualization Source: https://www.sitespeed.io/documentation/sitespeed.io/docker This command runs the sitespeed.io Docker container, maps the VNC port (default 5900) from the container to the host, and mounts the current directory to '/sitespeed.io' inside the container. It then executes a test against 'https://www.sitespeed.io/' using Chrome. This allows for remote visualization of the browser test through a VNC client. ```bash docker run --rm -v "$(pwd):/sitespeed.io" -p 5900:5900 sitespeedio/sitespeed.io:38.5.2 https://www.sitespeed.io/ -b chrome ``` -------------------------------- ### Run sitespeed.io with Firefox using Docker Source: https://www.sitespeed.io/documentation/sitespeed.io/docker Command to run sitespeed.io using the Firefox container. It requires increasing the shared memory size using `--shm-size` for optimal performance. Results are persisted in the current directory. ```bash docker run --shm-size 2g --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:38.5.2 -b firefox https://www.sitespeed.io/ ``` -------------------------------- ### Run sitespeed.io Conditionally Based on Battery Temperature Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones This command configures sitespeed.io to start performance tests on an Android device only when the battery temperature is below a specified threshold (e.g., 32 degrees Celsius). It also includes an option to set the waiting time between temperature checks. This helps avoid testing on potentially throttled, overheated devices. ```bash sitespeed.io --android --androidBatteryTemperatureLimit 32 https://www.sitespeed.io ``` -------------------------------- ### Run iOS Simulator Test with sitespeed.io Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones Configures and runs a test on an iOS simulator using sitespeed.io. Requires specifying the device UDID, enabling the simulator, and optionally including video and visual metrics. Assumes Xcode and necessary simulator environments are set up. ```bash sitespeed.io https://www.sitespeed.io -b safari --safari.useSimulator --safari.deviceUDID YOUR_DEVICE_ID --video --visualMetrics -c 4g ``` -------------------------------- ### Configure Throttle Engine for Browsertime Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Sets the connectivity engine to 'throttle' for Browsertime to simulate slower network conditions. Requires sudo privileges on Linux or pfctl on Mac. The '-c cable' option specifies a predefined connectivity profile. ```bash browsertime --connectivity.engine throttle -c cable https://www.sitespeed.io/ ``` -------------------------------- ### Advanced HAR Comparison Configuration (JSON) Source: https://www.sitespeed.io/documentation/compare This advanced configuration includes optional parameters like labels for runs, a page title, first-party domain definition, and custom comments for different sections of the comparison report. It enhances the context and presentation of the HAR comparison. ```json { "har1": { "url": "https://www.url.com/page1.har", "label": "Before change", "run": 1 }, "har2": { "url": "https://www.url.com/page2.har", "label": "After change", "run": 2 }, "title": "The page title used in the title bar", "firstParty" : " (.*wikipedia.*||.*wikimedia.*)", "comments": { "intro": "Extra information put at the top of the page", "waterfall": "Text displayed at top of the waterfall", "visualProgress": "Text displayed at the top of visual progress", "domains": "Text displayed at the top of domains", "requestDiff": "Text displayed at the top of request/response diff", "firstParty": "Text displayed at the top of first/third party" } } ``` -------------------------------- ### Enable Safari Driver on macOS Source: https://www.sitespeed.io/documentation/sitespeed.io/mobile-phones Enables the SafariDriver, which is bundled with macOS, allowing for automated testing of Safari. This command needs to be run once to activate the driver. ```bash safaridriver --enable ``` -------------------------------- ### Configure Throttle Engine for sitespeed.io Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Sets the connectivity engine to 'throttle' for sitespeed.io to simulate slower network conditions. This command uses the Browsertime configuration to apply the throttle engine. ```bash sitespeed.io --browsertime.connectivity.engine throttle -c cable https://www.sitespeed.io/ ``` -------------------------------- ### Configure Android Testing Environment Source: https://www.sitespeed.io/documentation/onlinetest Set up testing on an Android device by providing its model, device ID, and desired browsers. 'useDocker' and 'connectivity' options are also available. ```YAML - name: "Android" type: "android" browsers: ["chrome", "firefox"] model: "Moto G5" deviceId: "ZY322MMFZ2" useDocker: false connectivity: ["native"] ``` -------------------------------- ### Run sitespeed.io with Chrome using Docker Source: https://www.sitespeed.io/documentation/sitespeed.io/docker Command to run sitespeed.io using the default Chrome container. It mounts the current directory to persist results and specifies the Chrome browser. Ensure you use a specific version tag for consistency. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:38.5.2 -b chrome https://www.sitespeed.io/ ``` -------------------------------- ### Configure SSL for sitespeed.io Server Source: https://www.sitespeed.io/documentation/onlinetest YAML configuration for enabling SSL on the sitespeed.io server by providing paths to the key and certificate files. ```yaml server: # Configure SSL. Add the path to the key and certificate file ssl: key: cert: ``` -------------------------------- ### Enable Throttle in Docker on Linux Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Enables the Throttle connectivity engine within a Docker container on Linux. Requires loading the 'ifb' module and granting the container NET_ADMIN privileges. The command also specifies the '3g' connectivity profile. ```bash sudo modprobe ifb numifbs=1 docker run --cap-add=NET_ADMIN --rm sitespeedio/sitespeed.io:38.5.2 -c 3g --browsertime.connectivity.engine=throttle https://www.sitespeed.io/ ``` -------------------------------- ### Run sitespeed.io with a Custom Docker Network Source: https://www.sitespeed.io/documentation/sitespeed.io/connectivity Runs sitespeed.io within a Docker container attached to a custom-defined Docker network, specified here as 'cable'. This allows for applying the pre-configured network conditions to the test. ```bash docker run --shm-size=1g --network=cable --rm sitespeedio/sitespeed.io:38.5.2 -c cable https://www.sitespeed.io/ ```