RackHD HTTP Server (on-http)

2.60.7 · active · verified Wed Apr 22

on-http serves as the primary HTTP server component for the RackHD infrastructure management system, providing the web user interface and RESTful API endpoints essential for managing bare-metal hardware. Currently at its stable version 2.60.7, the project exhibits a consistent release cadence with frequent patch updates, indicating active development and maintenance. It is deployed as a standalone application, mandating the presence and correct configuration of external MongoDB and RabbitMQ instances for its operation. Its key differentiators lie in its deep integration with RackHD's capabilities for automated hardware provisioning, discovery, and orchestration, offering a structured API that defaults to version 2.0, with version 1.1 explicitly deprecated. The package also includes built-in tools for generating API documentation, task documentation, and client libraries for various programming languages, facilitating ecosystem integration.

Common errors

Warnings

Install

Imports

Quickstart

This script demonstrates how to install `on-http`, generate its documentation, start the server in the background, perform basic `curl` requests to its UI and API endpoints, and then gracefully shut it down. It highlights the prerequisite external services (MongoDB, RabbitMQ) and the common practice of using `sudo` to run the server.

#!/bin/bash

# NOTE: This quickstart assumes MongoDB and RabbitMQ are already running and accessible
# on their default ports (localhost:27017 for Mongo, localhost:5672 for RabbitMQ).

# Clean existing node_modules and install dependencies
rm -rf node_modules
npm install

# Generate API and task documentation (optional, but good for setup and local access)
npm run apidoc
npm run taskdoc

# Start the on-http server in the background.
# The README shows 'sudo node index.js', which is typically required for system ports or permissions.
# For development, you might adjust permissions or run on a higher port.
sudo node index.js &
SERVER_PID=$!

echo "on-http server started (PID: $SERVER_PID). Waiting for it to become ready..."
sleep 10 # Give the server some time to initialize and connect to dependencies

# Perform basic health checks and access documentation
echo "Accessing RackHD UI and API endpoints:"

# Check the Web UI
curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" http://127.0.0.1/ui
echo "- UI expected at http://127.0.0.1/ui"

# Check the API documentation
curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" http://127.0.0.1/docs
echo "- API Docs expected at http://127.0.0.1/docs"

# Example: Try to fetch a list of nodes (requires RackHD to have discovered nodes)
curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" http://127.0.0.1/api/current/nodes
echo "- API endpoint /api/current/nodes (status 200 means success, data depends on setup)"

# Clean up: Kill the background server process
kill $SERVER_PID
wait $SERVER_PID 2>/dev/null
echo "on-http server (PID: $SERVER_PID) stopped."

view raw JSON →