Overview
A small file server built into Expanse, so it runs on any node with no extra package. On every start it writes index to index.html in a private directory and serves that directory.
It is a test and placeholder workload. To serve a real site, use web/nginx or web/caddy.
- Shape
- Stateless replicas
- Reached at
- Node port, or a VIP
- Node package
- None
Built into Expanse: it runs on any node with no extra package.
Example
apiVersion: expanse.io/v1 kind: Block metadata: name: site namespace: default spec: type: web/static-site replicas: 2 resources: requests: cpu: 50m memory: 32Mi config: port: 18104 index: "<html><body>Hello from Expanse</body></html>"
$ expanse ctl block apply -f static-site.yaml --dry-run # validate only $ expanse ctl block apply -f static-site.yaml
Configuration
Keys go under spec.config and are checked against the type's JSON Schema when the block is applied. A default is what the block uses when the key is unset.
| Key | Default | Meaning |
|---|---|---|
index | <html><body>expanse static site</body></html> | The HTML written to index.html on start. |
port | none: always set it | TCP port the site is served on. Unset, the server takes a random free port. |
Using it
$ expanse ctl block apply -f site.yaml $ curl http://<node address>:18104/
Expose it on a VIP the same way as web/nginx to reach every replica through one address.
When a node fails
Nothing is stored, so a failed node's replica is simply placed again on another node after the unreachable grace (30 s).
Limits
- Serves one page. The schema describes the page as written to the block's volume, but the runtime writes it to a private temporary directory, so a
storageentry is not used.
Source
- nix/blocks/web/static-site: the type's identity and JSON Schema.