Skip to content

umcconnell/servum

Test Lint Docs

servum

Servum is a simple static server. Not more. Not less.

It is fast* and comes with no external dependencies. Servum also supports multi-threaded, parallel processing of incoming requests. HTTP only.

Quickstart

Install servum from the Releases Tab.

Then run servum inside the directory you want to serve 🚀.

Table of Contents

Installation

Pre-built binaries for Windows, Mac and Linux can be found under the Releases Tab.

Linux

To install the binary system-wide on Linux, make sure it is executable before moving it to usr/bin:

# In your Downloads folder:
chmod a+x ./servum
sudo mv ./servum /usr/bin/

Windows

To install the binary on windows, you can move it to C:\Tools as recommended in this StackExchange question: https://superuser.com/questions/532460/where-to-install-small-programs-without-installers-on-windows

If you would like to have a shortcut in the start menu, you can right-click the .exe file and select "Pin to start" before running it. See this stack-exchange question for more info: https://superuser.com/questions/1189406/ctrlshiftenter-to-run-as-admin-works-on-desktop-app-programs-but-not-run?answertab=votes#tab-top

Cargo

If you're a Rust programmer, servum can be installed via cargo.

cargo install --git https://github.com/umcconnell/servum.git --branch main --bin cargo-servum

Usage

To get started, just run servum, or cargo servum if you've installed using cargo, in the directory you want to serve.

servum [optional: BASE_DIR] [optional: OPTIONS]

servum takes an optional path to the base directory, i.e. the root directory you want to serve. This defaults to the current directory.

Additional configuration, such as the port, address, number of threads to use, etc., is possible using further CLI arguments. Run servum --help to get help.

Speed

The speed test consisted of serving the example folder on a laptop (Intel i7-9750H) using a single thread. Performance was measured using wrk with 6 threads and 400 connections for 60s:

wrk -t6 -c400 -d60s http://localhost:8080/index.html
Server Notes Requests/sec Transfer/sec Errors
1. servum 1 thread 41176.04 42.21MB /
2. nginx from docker container 27036.48 31.69MB /
3. serve node 16683.90 2.69MB /
4. python3 module http.server 1135.15 1.27MB 19 timeouts

Developing

Servum is open source! Contributions, improvements, bug fixes, etc. are very welcomed.

Prerequisites

Before you get started, make sure you've got rust and cargo installed on your machine. If not, installation via rustup is quick and easy. See the rust website for installation instructions: https://www.rust-lang.org/tools/install

Initial setup

First, clone the repo with git:

git clone https://github.com/umcconnell/servum.git
cd servum

Then, you can run servum using cargo:

cargo run [BASE_DIR] [OPTIONS]

... or build a binary:

cargo build --release

Check out the examples folder for an example static website.

Happy coding!

Docs

The developer docs are available online: https://umcconnell.github.io/servum/servum/index.html

Docs can also be built and viewed locally using:

cargo doc --document-private-items --open

Testing

Tests can be run using:

cargo test

When adding new features, make sure to add tests to your code.

Contributing

Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Ulysse McConnell - umcconnell

See also the list of contributors who participated in this project.

License

servum is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Acknowledgments

A huge thanks goes to the open and welcoming rust community and their great documentation effort. This project is based off Chapter 12 of the Rust Book "Building a Multithreaded Web Server"