espresso
The web server behind chromabits.com. Espresso is built to serve static websites in a container cluster.
Object Storage
On boot, Espresso downloads the site its serving from a bucket on a object storage backend (S3 compatible). While running, Espresso will check for updates on the site bundle and download them as necessary.
Espresso expects the whole site to be stored in a single Gzipped TAR archive
named bundle.tar.gz
at the root of the bucket.
Requirements
- S3-compatible: The object storage service should expose an S3-compatible interface. Tested backends are Ceph RGW and Minio.
- ETag Support: Espresso uses ETags to detect changes to the site bundle. The backend service should support these.
Configuration
Espresso can be configured via a TOML configuration file. Simply create a
config.toml
file and place it on the working directory.
[server]
address = "127.0.0.1:8088"
run_dir = "run"
auto_cleanup = true
[stats]
address = "127.0.0.1:8089"
[bundle]
type = "LocalBundle"
dir = "/tmp/"
[unbundler]
poll_seconds = 10
Customization
While Espresso was built specifically for chromabits.com, it is able to serve other static sites as long as their requirements are simple.
Deployment
A Kubernetes Helm chart is provided for deployment.
# Set up a Minikube cluster (if you don't already have one).
minikube start
# Create a values.yaml file and customize configuration.
#
# Note: Set the service type to `NodePort`.
nvim values.yaml
# Install espresso.
helm install espresso ./contrib/chart --namespace=default -f values.yaml
# Get the service URL.
minikube service --url espresso
Development
RUST_LOG=info cargo run
to build and run the server.
RUST_LOG=info cargo test
to run all tests.