Server Runner is a little Rust programm to run multiple web servers, check until all servers are ready via a URL that returns HTTP 200 und runs a command when all servers are ready.
Currently Server Runner is only available via Cargo. It will be also available via NPM in the near future, since NPM is available on almost any OS out there and it's much easier to publish than to many other package managers.
cargo install server-runnerserver-runner [OPTIONS]-c, --config <FILE>- Path to configuration file (default:servers.yaml)-v, --verbose- Enable verbose logging-a, --attempts <NUMBER>- Maximum number of connection attempts per server (default: 10)-h, --help- Print help information-V, --version- Print version information
server-runner -c config.yaml -v -a 15The configuration file is written in YAML format and defines the servers to start and the command to run when all servers are ready.
servers:
- name: "My web server"
url: "http://localhost:8080"
command: "node webserver.js"
timeout: 5 # Optional: HTTP request timeout in seconds (default: 5)
- name: "API server"
url: "http://localhost:3000/health"
command: "python api_server.py"
timeout: 10
command: "npm test"servers (required): List of servers to start and monitor
Each server requires:
name: Display name for the serverurl: HTTP endpoint to check for availability (must return HTTP 200 when ready)command: Shell command to start the servertimeout: (optional) HTTP request timeout in seconds (default: 5)
command (required): Command to execute when all servers are ready
Server Runner will:
- Start all configured servers simultaneously
- Poll each server's URL every second until it returns HTTP 200
- Retry up to the maximum number of attempts (default: 10, configurable with
-a) - Execute the specified command once all servers are ready
- Shut down all servers when the command completes or if any error occurs
If any server fails to respond with HTTP 200 after the maximum attempts, Server Runner will shut down all servers and exit with an error.