### Manual Installation Steps Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md A multi-step process for manually installing MySpeed, including package installation, binary download, and execution. ```sh sudo apt-get install wget curl -y #(1) mkdir /opt/myspeed && cd /opt/myspeed #(2) # Detect architecture and download the appropriate binary ARCH=$(uname -m) if [ "$ARCH" = "x86_64" ]; then ARCH="x64" elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64" fi wget $(curl -s https://api.github.com/repos/gnmyt/myspeed/releases/latest \ | grep "browser_download_url.*linux-${ARCH}" | cut -d '"' -f 4) \ -O myspeed #(3) chmod +x myspeed #(4) ./myspeed #(5) ``` -------------------------------- ### Build MySpeed from Source Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/windows.md Commands to install dependencies and build the MySpeed project from its source code. This includes installing Deno, navigating to the client directory, installing npm packages, building the client, and moving the build output. ```bash deno install cd client && npm install && npm run build && cd .. && move client\build build ``` -------------------------------- ### Automatic Installation (Development) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Automatically install the development version of MySpeed by piping the install script to bash, with the --beta flag. ```sh curl -sSL https://raw.githubusercontent.com/gnmyt/myspeed/development/scripts/install.sh | bash -s -- --beta ``` -------------------------------- ### Install Apache Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Installs the Apache HTTP Server. Use this if you plan to configure Apache as your reverse proxy. ```sh sudo apt-get install apache2 -y ``` -------------------------------- ### Install Deno on Windows Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/windows.md Use this command to install Deno, which is required for building MySpeed from source. This command downloads and executes an installation script. ```powershell irm https://deno.land/install.ps1 | iex ``` -------------------------------- ### Install Nginx Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Installs the Nginx web server. Use this if you plan to configure Nginx as your reverse proxy. ```sh sudo apt-get install nginx -y ``` -------------------------------- ### Install from Source Code Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Install the development version of MySpeed by compiling from source. This involves installing dependencies like git, curl, npm, and Deno, cloning the repository, and building the project. ```sh sudo apt-get install git curl npm -y #(1) # Install Deno curl -fsSL https://deno.land/install.sh | sh export DENO_INSTALL="$HOME/.deno" export PATH="$DENO_INSTALL/bin:$PATH" #(2) mkdir /opt/myspeed && cd /opt/myspeed #(3) git clone https://github.com/gnmyt/myspeed.git . #(4) deno install #(5) cd client && npm install && npm run build && cd .. && mv client/build . #(6) deno run --allow-all server/index.js #(7) ``` -------------------------------- ### Run MySpeed from Source Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/windows.md Execute this command using Deno to start the MySpeed server after building from source. The '--allow-all' flag grants necessary permissions. ```bash deno run --allow-all server/index.js ``` -------------------------------- ### Automatic Installation (Stable) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Automatically install the stable version of MySpeed by executing a script fetched via curl. ```sh bash <(curl -sSL https://install.myspeed.dev) ``` -------------------------------- ### Install MySpeed with Docker (Stable) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Run the stable version of MySpeed using Docker. This command starts a detached container, maps port 5216, and mounts a volume for data persistence. ```sh docker run -d -p 5216:5216 -v myspeed:/myspeed/data --restart=unless-stopped --name MySpeed germannewsmaker/myspeed ``` -------------------------------- ### Set Permissions for MySpeed Installation Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/troubleshooting.md Use this command to set the required permissions for your MySpeed installation directory. Replace `/opt/myspeed` with your actual installation path. ```bash chmod 700 /opt/myspeed ``` -------------------------------- ### Get All Configuration Values Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves all configuration settings. In view mode (unauthenticated), sensitive keys are omitted. Requires authentication for full access. ```bash curl http://localhost:5216/api/config ``` ```json # { # "ping": "25", # "download": "100", # "upload": "50", # "cron": "0 * * * *", # "scheduleOffset": "true", # "provider": "ookla", # "ooklaId": "12345", # "libreId": "none", # "libreUrl": "none", # "passwordLevel": "none", # "interface": "eth0", # "viewMode": false, # "previewMode": false # } ``` -------------------------------- ### Install Certbot for Apache Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Installs Certbot and the Apache plugin for obtaining Let's Encrypt SSL certificates. This command is for Debian/Ubuntu systems. ```sh sudo apt-get install certbot python3-certbot-apache -y ``` -------------------------------- ### Test MySpeed Installation Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/windows.md Run this command in the directory where you placed 'myspeed.exe' to verify your installation. MySpeed will be available on port 5216. ```powershell .\myspeed.exe ``` -------------------------------- ### Install MySpeed with Docker (Development) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Run the development version of MySpeed using Docker. This command is similar to the stable version but uses the ':development' tag. ```sh docker run -d -p 5216:5216 -v myspeed:/myspeed/data --restart=unless-stopped --name MySpeed germannewsmaker/myspeed:development ``` -------------------------------- ### Install Certbot for Nginx Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Installs Certbot and the Nginx plugin for obtaining Let's Encrypt SSL certificates. This command is for Debian/Ubuntu systems. ```sh sudo apt-get install certbot python3-certbot-nginx -y ``` -------------------------------- ### Copying Let's Encrypt Certificates Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/https.md Copy Let's Encrypt certificates to the MySpeed data directory. This example assumes certificates are managed by certbot. Adjust ownership to ensure MySpeed can read the files. ```sh # Copy the certificates sudo cp /etc/letsencrypt/live/your-domain.com/fullchain.pem /path/to/myspeed/data/certs/cert.pem sudo cp /etc/letsencrypt/live/your-domain.com/privkey.pem /path/to/myspeed/data/certs/key.pem # Make sure MySpeed can read them sudo chown $USER:$USER /path/to/myspeed/data/certs/*.pem ``` -------------------------------- ### Obtain SSL Certificate with Certbot (Apache) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Runs Certbot to obtain and install a Let's Encrypt SSL certificate for your domain using the Apache plugin. Replace 'your-domain.com' with your actual domain. ```sh sudo certbot --apache -d your-domain.com ``` -------------------------------- ### Get Configuration Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves all configuration values for the service. In view mode, sensitive keys are omitted. ```APIDOC ## GET /api/config — Get all configuration values Returns all config keys except the raw password hash. In view mode (unauthenticated read-only), sensitive keys like `ooklaId`, `libreId`, `libreUrl`, `cron`, `scheduleOffset`, and `passwordLevel` are omitted. ### Method GET ### Endpoint /api/config ### Request Example ```bash curl http://localhost:5216/api/config ``` ### Response #### Success Response (200) - **ping** (string) - The ping configuration value. - **download** (string) - The download speed configuration value. - **upload** (string) - The upload speed configuration value. - **cron** (string) - The cron schedule for tests. - **scheduleOffset** (string) - Whether schedule offset is enabled. - **provider** (string) - The speed test provider. - **ooklaId** (string) - The Ookla ID (if configured). - **libreId** (string) - The LibreSpeed ID (if configured). - **libreUrl** (string) - The LibreSpeed URL (if configured). - **passwordLevel** (string) - The password protection level. - **interface** (string) - The network interface used for testing. - **viewMode** (boolean) - Indicates if the service is in view mode. - **previewMode** (boolean) - Indicates if the service is in preview mode. #### Response Example ```json { "ping": "25", "download": "100", "upload": "50", "cron": "0 * * * *", "scheduleOffset": "true", "provider": "ookla", "ooklaId": "12345", "libreId": "none", "libreUrl": "none", "passwordLevel": "none", "interface": "eth0", "viewMode": false, "previewMode": false } ``` ``` -------------------------------- ### Get Speed Recommendations Source: https://context7.com/gnmyt/myspeed/llms.txt Provides the best ping, download, and upload values observed over the last 10 tests. Returns HTTP 501 if insufficient test data is available. ```bash curl http://localhost:5216/api/recommendations ``` ```json # { "id": 1, "ping": 10, "download": 98.45, "upload": 49.21 } # No data yet: HTTP 501 { "message": "There are no recommendations yet" } ``` -------------------------------- ### Get Version Information Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves the local and remote version information for the service. ```APIDOC ## GET /api/info/version — Get local and remote version ### Method GET ### Endpoint /api/info/version ### Request Example ```bash curl http://localhost:5216/api/info/version ``` ### Response #### Success Response (200) - **local** (string) - The local version of the service. - **remote** (string) - The remote version of the service (0 if GitHub API is unreachable). #### Response Example ```json { "local": "1.0.9", "remote": "1.0.9" } ``` ``` -------------------------------- ### Get Speed Recommendations Source: https://context7.com/gnmyt/myspeed/llms.txt Provides speed recommendations based on the best ping, download, and upload values from the last 10 tests. ```APIDOC ## GET /api/recommendations — Get speed recommendations Returns the best ping, download, and upload values seen across the last 10 tests. Returns HTTP 501 if not enough tests have been recorded yet. ### Method GET ### Endpoint /api/recommendations ### Request Example ```bash curl http://localhost:5216/api/recommendations ``` ### Response #### Success Response (200) - **id** (integer) - An identifier for the recommendation set. - **ping** (integer) - The recommended best ping value. - **download** (number) - The recommended best download speed. - **upload** (number) - The recommended best upload speed. #### Error Response (501) - **message** (string) - Error message indicating no recommendations are available yet. #### Response Example (Success) ```json { "id": 1, "ping": 10, "download": 98.45, "upload": 49.21 } ``` #### Response Example (No data yet) ```json { "message": "There are no recommendations yet" } ``` ``` -------------------------------- ### Obtain SSL Certificate with Certbot (Nginx) Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Runs Certbot to obtain and install a Let's Encrypt SSL certificate for your domain using the Nginx plugin. Replace 'your-domain.com' with your actual domain. ```sh sudo certbot --nginx -d your-domain.com ``` -------------------------------- ### Get Local and Remote Version Information Source: https://context7.com/gnmyt/myspeed/llms.txt Fetches the local version of the Speedtest service and the latest available remote version. The remote version is reported as '0' if the GitHub API is unreachable. ```bash curl http://localhost:5216/api/info/version ``` ```json # { "local": "1.0.9", "remote": "1.0.9" } # remote is "0" if GitHub API is unreachable ``` -------------------------------- ### Reload Deno Dependencies for MySpeed Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/troubleshooting.md Run this command in your installation folder to refresh all Deno dependencies. This can resolve issues related to outdated or corrupted dependencies. ```bash deno cache --reload server/index.js ``` -------------------------------- ### Get Database Storage Usage Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves the current database storage usage, including the total size and the number of tests stored. The 'size' is reported in bytes. ```bash curl -H "password: mysecretpassword" http://localhost:5216/api/storage ``` ```json # { "size": 204800, "testCount": 720 } # size is in bytes ``` -------------------------------- ### Systemd Service Management Commands Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Commands to manage the MySpeed systemd service, including reloading the daemon, enabling startup, starting the service, and checking its status. ```sh systemctl daemon-reload systemctl enable myspeed systemctl start myspeed systemctl status myspeed ``` -------------------------------- ### Get Prometheus Metrics Source: https://context7.com/gnmyt/myspeed/llms.txt Exposes the latest speed test result as Prometheus gauges. Requires HTTP Basic Auth with username 'prometheus' and the instance password if a password is set. ```bash # No password configured curl http://localhost:5216/api/prometheus/metrics ``` ```bash # With password (basic auth: username=prometheus, password=yourpassword) curl -u "prometheus:yourpassword" http://localhost:5216/api/prometheus/metrics ``` ```text # Example output: # # HELP myspeed_ping Current ping in ms # # TYPE myspeed_ping gauge # myspeed_ping 12 # # # HELP myspeed_jitter Current jitter in ms # # TYPE myspeed_jitter gauge # myspeed_jitter 0.85 # # # HELP myspeed_download Current download speed in Mbps # # TYPE myspeed_download gauge # myspeed_download 94.32 # # # HELP myspeed_upload Current upload speed in Mbps # # TYPE myspeed_upload gauge # myspeed_upload 47.11 # # # HELP myspeed_server Current server ID # # TYPE myspeed_server gauge # myspeed_server 12345 # # # HELP myspeed_time Time of the test # # TYPE myspeed_time gauge # myspeed_time 23 ``` -------------------------------- ### List all configured (active) integrations Source: https://context7.com/gnmyt/myspeed/llms.txt Fetches a list of all integrations that are currently configured and active. Includes details like ID, name, and last activity. ```bash curl -H "password: mysecretpassword" http://localhost:5216/api/integrations/active # [ # { # "id": 1, # "name": "telegram", # "displayName": "My Telegram Bot", # "data": { "token": "123:ABC...", "chat_id": "987654", "send_finished": true }, # "lastActivity": "2024-01-15T14:00:10.000Z", # "activityFailed": false # } # ] ``` -------------------------------- ### Import Configuration from JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Imports server configuration settings from a JSON file. The file 'config.json' should be provided as the request body. ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d @config.json http://localhost:5216/api/storage/config ``` ```json # Success: { "message": "Config imported" } ``` -------------------------------- ### Build MySpeed Client and Move Build Folder Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/troubleshooting.md If MySpeed is in development mode because the client build folder was not found, execute these commands. This builds the client and moves the output to the correct location. ```bash cd client && npm install && npm run build && cd .. && mv client/build . ``` -------------------------------- ### Create a generic webhook integration Source: https://context7.com/gnmyt/myspeed/llms.txt Configures a generic webhook integration. Specify the integration name, URL, and which events should trigger notifications. ```bash # Create a generic webhook integration curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "My Webhook", "url": "https://hooks.example.com/myspeed", "send_started": true, "send_finished": true, "send_failed": true, "send_alive": false, "send_recommendations": true, "send_config_updates": false }' http://localhost:5216/api/integrations/webhook # Webhook POST body sent on TEST_FINISHED event: # { "event": "TEST_FINISHED", "data": { "ping": 12, "jitter": 0.85, "download": 94.32, "upload": 47.11, "time": 23 } } ``` -------------------------------- ### MySpeed Environment Variables Source: https://context7.com/gnmyt/myspeed/llms.txt Configure HTTP/HTTPS ports, database connection, and operational modes like preview or testing. ```bash SERVER_PORT=5216 # HTTP port (default: 5216) HTTPS_PORT=5217 # HTTPS port when certs present (default: 5217) DB_TYPE=sqlite # Database: "sqlite" (default) or "mysql" DB_HOST=localhost # MySQL host DB_NAME=myspeed # MySQL database name DB_USER=myspeed # MySQL username DB_PASS=secret # MySQL password RUN_TEST_ON_STARTUP=true # Run a test immediately on first boot PREVIEW_MODE=true # Demo mode: simulates tests, blocks mutations PREVIEW_MESSAGE="..." # Banner shown in preview mode TZ=Europe/Berlin # Timezone (affects cron scheduling) ``` -------------------------------- ### Get a single speed test Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves details for a specific speed test by its ID. ```APIDOC ## GET /api/speedtests/:id — Get a single speed test ### Description Retrieves the details of a specific speed test identified by its ID. ### Method GET ### Endpoint /api/speedtests/:id #### Path Parameters - **id** (integer) - Required - The unique identifier of the speed test to retrieve. ### Request Example ```bash curl http://localhost:5216/api/speedtests/45 ``` ### Response #### Success Response (200) - **id** (integer) - Unique identifier for the speed test. - **ping** (number) - Ping time in milliseconds. - **jitter** (number) - Jitter in milliseconds. - **download** (number) - Download speed in Mbps. - **upload** (number) - Upload speed in Mbps. - **time** (integer) - Duration of the test in seconds. - **serverId** (integer) - Identifier for the server used for the test. - **type** (string) - Type of test (e.g., "auto", "custom"). - **created** (string) - ISO 8601 timestamp of when the test was created. #### Error Response (404) - **message** (string) - "Speedtest not found" #### Response Example ```json { "id": 45, "ping": 12, "jitter": 0.85, "download": 94.32, "upload": 47.11, "time": 23, "serverId": 12345, "type": "auto", "created": "2024-01-15T14:00:05.123Z" } ``` ``` -------------------------------- ### List all available integration types Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a list of all supported integration types, including their names, icons, and required fields. Requires authentication. ```bash curl -H "password: mysecretpassword" http://localhost:5216/api/integrations # { # "discord": { "name": "discord", "icon": "fa-brands fa-discord", "fields": [...] }, # "telegram": { "name": "telegram", "icon": "fa-brands fa-telegram", "fields": [...] }, # "gotify": { "name": "gotify", "icon": "fa-solid fa-bell", "fields": [...] }, # "pushover": { "name": "pushover", "icon": "fa-solid fa-pushover", "fields": [...] }, # "webhook": { "name": "webhook", "icon": "fa-solid fa-globe", "fields": [...] }, # "healthChecks": { "name": "healthChecks", "icon": "fa-solid fa-heart-pulse","fields": [...] } # } ``` -------------------------------- ### Get Database Storage Usage Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves the current database storage usage and the total number of tests performed. ```APIDOC ## GET /api/storage — Get database storage usage ### Description Get database storage usage. ### Method GET ### Endpoint /api/storage ### Request Example ```bash curl -H "password: mysecretpassword" http://localhost:5216/api/storage ``` ### Response #### Success Response (200) - **size** (integer) - Storage size in bytes - **testCount** (integer) - Total number of tests performed ### Response Example ```json { "size": 204800, "testCount": 720 } ``` ``` -------------------------------- ### Create a Telegram integration Source: https://context7.com/gnmyt/myspeed/llms.txt Sets up a Telegram integration. Provide the integration name, bot token, chat ID, and flags for sending notifications. ```bash # Create a Telegram integration curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "Telegram Alerts", "token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz", "chat_id": "987654321", "send_finished": true, "send_failed": true }' http://localhost:5216/api/integrations/telegram # { "message": "Integration created", "id": 4 } ``` -------------------------------- ### Get test runner status Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves the current status of the speed test runner, indicating if tests are paused or running. ```APIDOC ## GET /api/speedtests/status — Get test runner status ### Description Returns the current status of the automatic speed test runner. ### Method GET ### Endpoint /api/speedtests/status ### Request Example ```bash curl http://localhost:5216/api/speedtests/status ``` ### Response #### Success Response (200) - **paused** (boolean) - Indicates if the test runner is currently paused. - **running** (boolean) - Indicates if the test runner is currently executing a test. #### Response Example ```json { "paused": false, "running": true } ``` ``` -------------------------------- ### Get Single Speed Test Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a specific speed test by its ID. Returns a 404 error if the test is not found. ```bash curl http://localhost:5216/api/speedtests/45 # 404 response when not found: # { "message": "Speedtest not found" } # Successful response: # { # "id": 45, # "ping": 12, # "jitter": 0.85, # "download": 94.32, # "upload": 47.11, # "time": 23, # "serverId": 12345, # "type": "auto", # "created": "2024-01-15T14:00:05.123Z" # } ``` -------------------------------- ### Import Configuration from JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Imports configuration settings from a JSON file. ```APIDOC ## PUT /api/storage/config — Import configuration from JSON ### Description Import configuration from JSON. ### Method PUT ### Endpoint /api/storage/config ### Request Body - **@config.json** (file) - JSON file containing configuration data ### Request Example ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d @config.json http://localhost:5216/api/storage/config ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message ### Response Example ```json { "message": "Config imported" } ``` ``` -------------------------------- ### Get Test Runner Status Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves the current status of the automatic speed test runner, indicating if it is paused or actively running. ```bash curl http://localhost:5216/api/speedtests/status # { "paused": false, "running": true } ``` -------------------------------- ### List Available Speed Test Servers Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a list of available speed test servers for a specified provider (e.g., 'ookla' or 'libre'). Returns an array of server objects, each containing an ID, name, and host. ```bash # Get Ookla servers curl http://localhost:5216/api/info/server/ookla ``` ```bash # Get LibreSpeed servers curl http://localhost:5216/api/info/server/libre ``` ```text # Returns an array of server objects: # [{ "id": 12345, "name": "MyISP - City", "host": "speedtest.example.com" }, ...] ``` -------------------------------- ### Get aggregated statistics Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves aggregated statistics for speed tests within a specified date range. Supports downsampling for large datasets. ```APIDOC ## GET /api/speedtests/statistics — Get aggregated statistics for a date range ### Description Returns aggregated statistics including min/max/avg for ping, jitter, download, upload, and time. Also provides hourly averages, standard deviation, and chart-ready data arrays. The response is automatically downsampled if the raw data exceeds 300 points. ### Method GET ### Endpoint /api/speedtests/statistics #### Query Parameters - **from** (string) - Required - The start date for the statistics range (YYYY-MM-DD). - **to** (string) - Required - The end date for the statistics range (YYYY-MM-DD). ### Request Example ```bash curl "http://localhost:5216/api/speedtests/statistics?from=2024-01-01&to=2024-01-31" ``` ### Response #### Success Response (200) - **tests** (object) - **total** (integer) - Total number of tests in the period. - **failed** (integer) - Number of failed tests in the period. #### Response Example ```json { "tests": { "total": 720, "failed": 3 }, ``` ``` -------------------------------- ### Save and Exit Nano Editor Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Instructions for saving a file and exiting the nano text editor. ```sh Press `CTRL` + `X`, then press `Y` and press `Enter` to save the file and exit the editor. ``` -------------------------------- ### Export Full Configuration as JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Exports the full configuration, including nodes, recommendations, and integrations, as a JSON file. ```APIDOC ## GET /api/storage/config — Export full configuration as JSON ### Description Exports config values (excluding password and interface), nodes, recommendations, and integrations. ### Method GET ### Endpoint /api/storage/config ### Request Example ```bash curl -o config.json -H "password: mysecretpassword" \ http://localhost:5216/api/storage/config ``` ``` -------------------------------- ### Deploy MySpeed with Docker Source: https://context7.com/gnmyt/myspeed/llms.txt Provides Docker commands for deploying MySpeed. Supports stable release, custom databases (MySQL), and custom ports/startup options. ```bash # Stable release docker run -d \ -p 5216:5216 \ -v myspeed:/myspeed/data \ --restart=unless-stopped \ --name MySpeed \ germannewsmaker/myspeed # With MySQL instead of SQLite docker run -d \ -p 5216:5216 \ -v myspeed:/myspeed/data \ --restart=unless-stopped \ --name MySpeed \ -e DB_TYPE=mysql \ -e DB_HOST=db.example.com \ -e DB_NAME=myspeed \ -e DB_USER=myspeed \ -e DB_PASS=secret \ germannewsmaker/myspeed # With custom port and startup test docker run -d \ -p 8080:8080 \ -v myspeed:/myspeed/data \ --restart=unless-stopped \ --name MySpeed \ -e SERVER_PORT=8080 \ -e RUN_TEST_ON_STARTUP=true \ germannewsmaker/myspeed ``` -------------------------------- ### Import Tests from JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Imports speed test data from a JSON file into the database. The file 'speedtests.json' should be provided as the request body. ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d @speedtests.json http://localhost:5216/api/storage/tests/history ``` ```json # Success: { "message": "Tests imported" } # Error: HTTP 500 { "message": "Error importing tests" } ``` -------------------------------- ### Reset MySpeed Password Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/faq.md Use this command to reset your MySpeed password if forgotten. Navigate to the installation directory and execute the Node.js command to update the password setting in the local database. ```sh node -e "const {Sequelize} = require('sequelize');const db = new Sequelize({dialect: 'sqlite', storage: 'data/storage.db'});db.query('UPDATE config SET value=? WHERE key=?', {replacements: ['none', 'password']})" ``` -------------------------------- ### Export Full Configuration as JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Exports the complete server configuration, including nodes, recommendations, and integrations, but excluding sensitive password and interface details. The output is saved to 'config.json'. ```bash curl -o config.json -H "password: mysecretpassword" \ http://localhost:5216/api/storage/config ``` -------------------------------- ### Create a Discord webhook integration Source: https://context7.com/gnmyt/myspeed/llms.txt Creates a new Discord integration. Requires the integration name, webhook URL, and flags for sending notifications on test completion or failure. ```bash # Create a Discord webhook integration curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "Speed Monitor", "url": "https://discord.com/api/webhooks/123456/abcdef", "send_finished": true, "send_failed": true, "finished_message": ":chart_with_upwards_trend: Test done! Down: %download% Mbps | Up: %upload% Mbps | Ping: %ping% ms" }' http://localhost:5216/api/integrations/discord # { "message": "Integration created", "id": 3 } ``` -------------------------------- ### List all configured (active) integrations Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a list of all integrations that have been configured and are currently active in the system. ```APIDOC ## GET /api/integrations/active — List all configured (active) integrations ### Description Retrieves a list of all integrations that have been configured and are currently active. ### Method GET ### Endpoint /api/integrations/active ### Parameters #### Headers - **password**: string - Required ### Response #### Success Response (200) - An array of integration objects, each containing: - **id** (integer) - The unique identifier for the integration. - **name** (string) - The name of the integration type. - **displayName** (string) - A user-friendly display name for the integration. - **data** (object) - Configuration data specific to the integration. - **lastActivity** (string) - Timestamp of the last activity. - **activityFailed** (boolean) - Indicates if the last activity failed. ### Response Example ```json [ { "id": 1, "name": "telegram", "displayName": "My Telegram Bot", "data": { "token": "123:ABC...", "chat_id": "987654", "send_finished": true }, "lastActivity": "2024-01-15T14:00:10.000Z", "activityFailed": false } ] ``` ``` -------------------------------- ### Get Aggregated Speed Test Statistics Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves aggregated statistics for speed tests within a specified date range. Supports downsampling for large datasets and provides various metrics including averages, consistency, and chart-ready data. ```bash curl "http://localhost:5216/api/speedtests/statistics?from=2024-01-01&to=2024-01-31" # Expected response shape: # { # "tests": { "total": 720, "failed": 3 }, ``` -------------------------------- ### Generate SSL Certificates for HTTPS Source: https://context7.com/gnmyt/myspeed/llms.txt Create self-signed SSL certificates and place them in the data/certs directory to enable HTTPS. ```bash mkdir -p /opt/myspeed/data/certs openssl req -x509 -newkey rsa:4096 -keyout /opt/myspeed/data/certs/key.pem \ -out /opt/myspeed/data/certs/cert.pem -days 365 -nodes ``` -------------------------------- ### Configure Apache for MySpeed Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/reverse-proxy.md Creates and configures an Apache virtual host to proxy requests to MySpeed. Ensure 'your-domain.com' is replaced with your actual domain. ```sh sudo nano /etc/apache2/sites-available/myspeed.conf ``` ```apache ServerName your-domain.com ProxyPreserveHost On ProxyPass / http://localhost:5216/ ProxyPassReverse / http://localhost:5216/ ``` ```sh sudo a2enmod proxy sudo a2enmod proxy_http # Activate the file and restart the reverse proxy sudo a2ensite myspeed.conf sudo systemctl restart apache2 ``` -------------------------------- ### Copying Existing Certificates Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/guides/https.md Copy your existing SSL certificate and private key to the MySpeed data directory. Ensure the filenames are `cert.pem` and `key.pem`. ```sh cp /path/to/your/certificate.pem /path/to/myspeed/data/certs/cert.pem cp /path/to/your/private-key.pem /path/to/myspeed/data/certs/key.pem ``` -------------------------------- ### Execute Speed Test (Node.js) Source: https://context7.com/gnmyt/myspeed/llms.txt Executes a speed test using the specified provider and server configuration. Imports the 'speedTest' utility from './util/speedtest.js'. ```javascript import speedTest from './util/speedtest.js'; // Run Ookla test on auto-selected server const result = await speedTest("ookla"); ``` ```javascript // Run Ookla test on a specific server const result = await speedTest("ookla", 12345); ``` ```javascript // Run LibreSpeed on a specific server ID const result = await speedTest("libre", 67); ``` ```javascript // Run LibreSpeed against a custom server URL const result = await speedTest("libre", undefined, "https://librespeed.example.com"); ``` ```javascript // Run Cloudflare test const result = await speedTest("cloudflare"); ``` ```json // result shape (Ookla): // { // ping: { latency: 12.4, jitter: 0.85 }, // download: { bandwidth: 11790000, elapsed: 11000 }, // upload: { bandwidth: 5888000, elapsed: 8000 }, // server: { id: 12345, name: "MyISP" }, // result: { id: "abc123" }, // elapsed: 21500 // } ``` -------------------------------- ### List Available Network Interfaces Source: https://context7.com/gnmyt/myspeed/llms.txt Returns a JSON object mapping network interface names to their corresponding IP addresses. ```bash curl http://localhost:5216/api/info/interfaces ``` ```json # { "eth0": "192.168.1.100", "lo": "127.0.0.1" } ``` -------------------------------- ### Create systemd Service File Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Defines the systemd service for MySpeed, specifying the executable path, working directory, and restart behavior. ```ini [Unit] Description=MySpeed After=network.target [Service] Type=simple ExecStart=/opt/myspeed/myspeed Restart=always # \/ It is strongly recommended to create your own user here User=root # \/ Specify your installation location here WorkingDirectory=/opt/myspeed [Install] WantedBy=multi-user.target ``` -------------------------------- ### Factory Reset Configuration Source: https://context7.com/gnmyt/myspeed/llms.txt Resets all configuration settings to their default values, removes all nodes, recommendations, and integrations, and restarts the scheduler. Requires password authentication. ```bash curl -X DELETE -H "password: mysecretpassword" \ http://localhost:5216/api/storage/config ``` ```json # Success: { "message": "Config reset" } ``` -------------------------------- ### List all available integration types Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a list of all integration types supported by the system, including their names, icons, and required fields. ```APIDOC ## GET /api/integrations — List all available integration types ### Description Retrieves a list of all integration types supported by the system. ### Method GET ### Endpoint /api/integrations ### Parameters #### Headers - **password**: string - Required ### Response #### Success Response (200) - **[integrationType]** (object) - An object where keys are integration type names (e.g., "discord", "telegram"). Each object contains: - **name** (string) - The name of the integration type. - **icon** (string) - A CSS class for the integration's icon. - **fields** (array) - An array describing the fields required for this integration. ### Response Example ```json { "discord": { "name": "discord", "icon": "fa-brands fa-discord", "fields": [...] }, "telegram": { "name": "telegram", "icon": "fa-brands fa-telegram", "fields": [...] }, "gotify": { "name": "gotify", "icon": "fa-solid fa-bell", "fields": [...] }, "pushover": { "name": "pushover", "icon": "fa-solid fa-pushover", "fields": [...] }, "webhook": { "name": "webhook", "icon": "fa-solid fa-globe", "fields": [...] }, "healthChecks": { "name": "healthChecks", "icon": "fa-solid fa-heart-pulse","fields": [...] } } ``` ``` -------------------------------- ### Create an integration Source: https://context7.com/gnmyt/myspeed/llms.txt Creates a new integration of a specified type. Requires Content-Type and password headers, and integration-specific configuration in the request body. ```APIDOC ## PUT /api/integrations/:integrationName — Create an integration ### Description Creates a new integration of a specified type. ### Method PUT ### Endpoint /api/integrations/:integrationName ### Parameters #### Path Parameters - **integrationName** (string) - Required - The name of the integration type to create (e.g., "discord", "telegram", "webhook"). #### Headers - **Content-Type**: application/json - Required - **password**: string - Required #### Request Body (Example for Discord) - **integration_name** (string) - Required - A display name for the integration. - **url** (string) - Required for Discord - The webhook URL. - **send_finished** (boolean) - Optional - Whether to send notifications on test completion. - **send_failed** (boolean) - Optional - Whether to send notifications on test failure. - **finished_message** (string) - Optional - Custom message for test completion. #### Request Body (Example for Telegram) - **integration_name** (string) - Required - A display name for the integration. - **token** (string) - Required for Telegram - The bot token. - **chat_id** (string) - Required for Telegram - The chat ID. - **send_finished** (boolean) - Optional - Whether to send notifications on test completion. - **send_failed** (boolean) - Optional - Whether to send notifications on test failure. #### Request Body (Example for Webhook) - **integration_name** (string) - Required - A display name for the integration. - **url** (string) - Required for Webhook - The webhook URL. - **send_started** (boolean) - Optional - Whether to send notifications on test start. - **send_finished** (boolean) - Optional - Whether to send notifications on test completion. - **send_failed** (boolean) - Optional - Whether to send notifications on test failure. - **send_alive** (boolean) - Optional - Whether to send keep-alive notifications. - **send_recommendations** (boolean) - Optional - Whether to send recommendations. - **send_config_updates** (boolean) - Optional - Whether to send configuration update notifications. ### Request Example (Discord) ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "Speed Monitor", "url": "https://discord.com/api/webhooks/123456/abcdef", "send_finished": true, "send_failed": true, "finished_message": ":chart_with_upwards_trend: Test done! Down: %download% Mbps | Up: %upload% Mbps | Ping: %ping% ms" }' http://localhost:5216/api/integrations/discord ``` ### Request Example (Telegram) ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "Telegram Alerts", "token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz", "chat_id": "987654321", "send_finished": true, "send_failed": true }' http://localhost:5216/api/integrations/telegram ``` ### Request Example (Webhook) ```bash curl -X PUT -H "Content-Type: application/json" -H "password: mysecretpassword" \ -d '{ "integration_name": "My Webhook", "url": "https://hooks.example.com/myspeed", "send_started": true, "send_finished": true, "send_failed": true, "send_alive": false, "send_recommendations": true, "send_config_updates": false }' http://localhost:5216/api/integrations/webhook ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message, e.g., "Integration created". - **id** (integer) - The ID of the created integration. #### Response Example ```json { "message": "Integration created", "id": 3 } ``` ### Note For webhook integrations, the following JSON body is sent on a TEST_FINISHED event: ```json { "event": "TEST_FINISHED", "data": { "ping": 12, "jitter": 0.85, "download": 94.32, "upload": 47.11, "time": 23 } } ``` ``` -------------------------------- ### Save and Exit Vim Editor Source: https://github.com/gnmyt/myspeed/blob/development/docs/en/setup/linux.md Instructions for saving a file and exiting the vim text editor. ```sh Press `ESC`, then type `:wq` and press `Enter` to save the file and exit the editor. ``` -------------------------------- ### Manage Speed Test Schedule with Cron Scheduler Source: https://context7.com/gnmyt/myspeed/llms.txt Manages automated speed test scheduling using node-schedule. Use `startTimer` to begin, `stopTimer` to halt, and `runTask` to manually trigger a test. Schedule offset can spread server load. ```javascript import { startTimer, stopTimer, runTask } from './tasks/timer.js'; // Start scheduler with hourly cron startTimer("0 * * * *"); // Start scheduler with every 30 minutes startTimer("*/30 * * * *"); // Manually trigger one test (respects pause state and schedule offset) await runTask(); // Stop the scheduler (e.g., before updating the cron expression) stopTimer(); startTimer("0 */2 * * *"); // Restart with new expression ``` -------------------------------- ### Factory Reset Configuration Source: https://context7.com/gnmyt/myspeed/llms.txt Resets all configuration settings to their default values and restarts the scheduler. ```APIDOC ## DELETE /api/storage/config — Factory reset ### Description Resets all config keys to defaults, destroys all nodes, recommendations, and integrations, and restarts the scheduler. ### Method DELETE ### Endpoint /api/storage/config ### Request Example ```bash curl -X DELETE -H "password: mysecretpassword" \ http://localhost:5216/api/storage/config ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message ### Response Example ```json { "message": "Config reset" } ``` ``` -------------------------------- ### List Available Speed Test Servers Source: https://context7.com/gnmyt/myspeed/llms.txt Lists available speed test servers for a given provider (Ookla or LibreSpeed). ```APIDOC ## GET /api/info/server/:provider — List available speed test servers ### Method GET ### Endpoint /api/info/server/:provider #### Path Parameters - **provider** (string) - Required - The speed test provider ('ookla' or 'libre'). ### Request Example ```bash # Get Ookla servers curl http://localhost:5216/api/info/server/ookla # Get LibreSpeed servers curl http://localhost:5216/api/info/server/libre ``` ### Response #### Success Response (200) Returns an array of server objects. - **id** (integer) - The server ID. - **name** (string) - The server name. - **host** (string) - The server host address. #### Response Example ```json [{ "id": 12345, "name": "MyISP - City", "host": "speedtest.example.com" }, ...] ``` ``` -------------------------------- ### List All Remote Nodes Source: https://context7.com/gnmyt/myspeed/llms.txt Retrieves a list of all configured remote nodes. Requires authentication with a password. ```bash curl -H "password: mysecretpassword" http://localhost:5216/api/nodes ``` ```json # [{ "id": 1, "name": "Home Office", "url": "http://192.168.1.20:5216" }] ``` -------------------------------- ### Download All Tests as JSON Source: https://context7.com/gnmyt/myspeed/llms.txt Downloads all stored speed test results in JSON format. The output is saved to a file named 'speedtests.json'. ```bash curl -o speedtests.json -H "password: mysecretpassword" \ http://localhost:5216/api/storage/tests/history/json ```