The Internet Health Report monitors the conditions of networks that compose the Internet. This effort aims to provide network operators, policymakers, and other stakeholders, with a better understanding of the Internet's infrastructure and its evolution. To understand further click here.
Install Node v24.11.0 (LTS)
Install NPM v11.6.1
Clone the project
git clone https://github.com/InternetHealthReport/ihr-website.git
cd ihr-websiteNote:
- you can use NVM to switch between node versions as per your need
The application reads browser-visible runtime settings from public/config.json. Copy or edit it as needed:
{
"DEFAULT_LOCALE": "en",
"FALLBACK_LOCALE": "en",
"SUPPORTED_LOCALES": ["en", "jp"],
"BASE_URL": "/",
"CARTO_BASEMAPS_API_KEY": "your-api-key-here"
}Do not store secrets in this file. Runtime configuration is downloaded by the browser and is visible to every website visitor.
The included public/robots.txt asks compliant search-engine crawlers not to index /config.json, but it does not prevent anyone from accessing the file.
To add a variable in the future:
-
Add the variable and a safe development default to
public/config.json:{ "EXAMPLE_SERVICE_URL": "https://example.test/api" } -
Add validation for it in
src/config.js. Make the property required when the application cannot work without it, or provide a safe default when it is optional. -
Read it in application code only through
getConfig():import { getConfig } from '@/config' const serviceUrl = getConfig().EXAMPLE_SERVICE_URL
Do not use
import.meta.envfor a deployment-time value. Also avoid callinggetConfig()from a module that is statically imported beforeloadConfig()completes; configuration-dependent startup modules must be dynamically imported afterloadConfig(), as insrc/main.js. -
Add the property to the production Ansible template:
{ "EXAMPLE_SERVICE_URL": "https://example.test/api" }
After updating the mounted config.json, reload the page to pick up the new value. Application code changes still require building and deploying a new Docker image.
npm installnpm run devnpm run buildnpm run formatTo deploy the project with Docker, follow these steps:
git clone https://github.com/InternetHealthReport/ihr-website.git
cd ihr-websitedocker build -t ihr-website .docker run --name ihr-website -d -p <host-port>:80 \
--mount type=bind,src=/absolute/path/to/config.json,dst=/usr/share/nginx/html/config.json,readonly \
ihr-websiteReplace <host-port> with the port on your host machine where you want to expose the application.
The mounted config.json can be changed for each deployment without rebuilding the image.
Checkout IHR Handbook for contributors for more info.