OpenSpeedTest Documentation

repository·main·Indexed 25 days ago

https://github.com/openspeedtest/speed-test

A free and open-source HTML5 network performance estimation tool written in vanilla JavaScript. This documentation covers self-hosting requirements for static web servers, Docker and Docker Compose installation, SSL configuration via Let's Encrypt or custom certificates, and client behavior control using URL parameters. It also details advanced customizations via Index.html for database integration and multi-server lists, as well as environment variables for container configuration.

Tokens
1.8K
Snippets
4
Records
9
Agent score
37%

What's inside OpenSpeedTest

  1. Use custom SSL certificates (Self-Signed or Paid)

    main

    To use your own SSL certificates, prepare a folder containing your certificate and key files renamed exactly to nginx.crt and nginx.key. Then, mount this folder to /etc/ssl/ in the container.

    Example using Docker CLI:

    sudo docker run -v /${PATH-TO-YOUR-OWN-SSL-CERTIFICATE}:/etc/ssl/ --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest

    Example using Docker Compose:

    version: '3.3'
    services:
        speedtest:
            volumes:
                - '/Users/vishnu/Desktop/docker/:/etc/ssl/'
            restart: unless-stopped
            container_name: openspeedtest
            ports:
                - '3000:3000'
                - '3001:3001'
            image: openspeedtest/latest
  2. Customize OpenSpeedTest via Index.html

    main

    For advanced customization, you can edit the Index.html file directly to implement the following features:

    Save results to a Database

    Set saveData to true and provide your endpoint URL:

    var saveData = true;
    var saveDataURL = "//yourDatabase.Server.com:4500/save?data=";

    Add multiple servers

    Define a list of servers. The application will automatically select the one with the lowest latency:

    var openSpeedTestServerList = [
      {"ServerName":"Home-Earth", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"},
      {"ServerName":"Home-Mars", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"},
      {"ServerName":"Home-Moon", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"}
    ];
    var saveData = true;
    var saveDataURL = "//yourDatabase.Server.com:4500/save?data=";
    
    var openSpeedTestServerList = [
      {"ServerName":"Home-Earth", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"},
      {"ServerName":"Home-Mars", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"},
      {"ServerName":"Home-Moon", "Download":"/downloading", "Upload":"/upload", "ServerIcon":"DefaultIcon"}
    ];
  3. Install OpenSpeedTest using Docker Compose

    main

    Use the following docker-compose.yml configuration to deploy the OpenSpeedTest service.

    version: '3.3'
    services:
        speedtest:
            restart: unless-stopped
            container_name: openspeedtest
            ports:
                - '3000:3000'
                - '3001:3001'
            image: openspeedtest/latest
  4. Configure a custom web server for OpenSpeedTest

    main

    To host OpenSpeedTest yourself, you need a static web server (e.g., Nginx, Apache, IIS, Express) that supports HTTP/1.1 or newer. Ensure your server meets these requirements:

    • Supports GET, POST, HEAD, and OPTIONS methods with 200 OK responses.
    • Supports POST to static files with 200 OK responses.
    • client_max_body_size is set to at least 35 Megabytes.
    • Timeout is greater than 60 seconds.
    • Disable Access logs to improve server performance and reduce TTFB.
    • If using a Reverse Proxy, ensure the post-body content length is increased to at least 35 megabytes.
    • Supports HTTP2 and HTTP3 (though HTTP1.1 is recommended for maximum performance).
  5. Install OpenSpeedTest using Docker

    main

    To deploy OpenSpeedTest as a container, use the openspeedtest/latest image. The implementation uses nginxinc/nginx-unprivileged:stable-alpine to run NGINX as a non-root user, which is resource-efficient.

    Accessing the server:

    • HTTP: http://YOUR-SERVER-IP:3000
    • HTTPS: https://YOUR-SERVER-IP:3001

    Port Mapping:

    • To change the host port for HTTP (default 3000), use -p <NEW_PORT>:3000.
    • To change the host port for HTTPS (default 3001), use -p <NEW_PORT>:3001.
    sudo docker run --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest
  6. Setup Free Let's Encrypt SSL with Automatic Renewal

    main

    You can automatically generate and renew Let's Encrypt certificates by providing specific environment variables.

    Requirements:

    • A public IPv4 or IPv6 address.
    • A domain name resolving to the server's IP.
    • A valid email address.

    Docker Command:

    docker run -e ENABLE_LETSENCRYPT=True -e DOMAIN_NAME=speedtest.yourdomain.com -e USER_EMAIL=you@yourdomain.pro --restart=unless-stopped --name openspeedtest -d -p 80:3000 -p 443:3001 openspeedtest/latest

    Docker Compose:

    version: '3.3'
    services:
        speedtest:
            environment:
                - ENABLE_LETSENCRYPT=True
                - DOMAIN_NAME=speedtest.yourdomain.com
                - USER_EMAIL=you@yourdomain.pro
            restart: unless-stopped
            container_name: openspeedtest
            ports:
                - '80:3000'
                - '443:3001'
            image: openspeedtest/latest
  7. Configure OpenSpeedTest via Environment Variables

    main

    Use the following environment variables to customize the OpenSpeedTest Docker container behavior:

    VariableDescription
    CHANGE_CONTAINER_PORTSSet to True to enable custom internal port configuration.
    HTTP_PORTThe internal HTTP port (default 3000).
    HTTPS_PORTThe internal HTTPS port (default 3001).
    SET_USERSets the user ID (e.g., 101).
    ALLOW_ONLYA semicolon-separated list of domains allowed to make CORS requests (e.g., domain1.com;domain2.com).
    SET_SERVER_NAMEThe name displayed on the SpeedTest UI (e.g., HOME-NAS).
  8. Use URL parameters to control SpeedTest behavior

    main

    You can modify the behavior of the OpenSpeedTest client by passing specific URL parameters. Parameters are case-insensitive and can be abbreviated using their first letter.

    Stress Test (Continuous Testing)

    Enable a continuous speed test by passing Stress or S. You can specify a duration in seconds or use presets:

    • Presets: Low, Medium, High, VeryHigh, Extreme, Day, Year.
    • Seconds: Pass a raw integer (e.g., 5000).

    Automatic Execution

    • Run or R: Starts the test immediately on page load.
    • Run=N or R=N: Starts the test after N seconds.

    Test Selection

    • Test=DOWNLOAD, Test=UPLOAD, or Test=PING (or T=D, T=U, T=P): Runs only the specified test type.

    Connection and Timeout Settings

    • XHR or X: Sets the number of parallel HTTP connections (default is 6, range 1-32).
    • Out or O: Sets the Ping timeout in milliseconds (default is 5000ms).
    • Ping or P: Sets the number of ping samples for accuracy.
    • Host or H: Overrides the server host with a specific HTTP URL.
    • Clean or C: Resets or sets the Overhead Compensation factor (0 to 4).
    http://192.168.1.5?Run&Stress=300
    http://192.168.1.5?S=L
    http://192.168.1.5?R=10
    http://192.168.1.5?T=U
    http://192.168.1.5?X=3
    http://192.168.1.5?O=7000
    http://192.168.1.5?P=500
    http://192.168.1.5?H=http://192.168.1.10:3000