Project | LXD |
Status | Drafting |
Author(s) | @gabrielmougard |
Approver(s) | |
Release | |
Internal ID | LX051 |
Abstract:
Additionally to the online documentation of LXD, we want to expose the LXD documentation website as part of a LXD deployment. The generated static website is already generated in the /doc/html
folder as part of our doc pipeline. We would ‘just’ need to serve these static assets through a web server embedded within LXD.
Rationale:
Exposing the documentation website as part of a LXD deployment has the following advantages:
It provides a better accessibility: including the documentation within the binary means it’s always available, even if the user is offline or has intermittent network connectivity. It also eliminates the need to visit an external website to understand how to use the project, making it more convenient for users.
It ensures synchronization between the project and its documentation: hosting the documentation with the project binary ensures that the version of the documentation always matches the version of the software being used. This avoids any confusion or errors that might result from discrepancies between the documentation and the software version.
It makes it possible to link from the LXD UI to the docs: eventhough we could link to the online documentation, if a link changes, or a section is moved to another page, the link in the UI would break. So have it embedded avoid that issue.
However, it’s important to note that this approach also has potential downsides, such as increasing the size of the binary and the need to update the entire binary to update the documentation (87MB is the size of the LXD binary with the embedded website, compared to 61MB without it)
Specification
Design
We’ll introduce a new http endpoint within LXD at /documentation/
. This endpoint is served by a file server handling pre-compressed or deflated assets stored within the snap package.
The generated static documentation (make doc
in our pipeline) will need to be copied in the source (instroduction of a lxd/gendocs/html
folder to put the html/css/js/img assets. Note here that it resonates with this other spec document introducing the generated JSON config option metadata in lxd/metadata/configuration.json
that would be exposed over LXD’s REST API)
-
Just as LXD UI, we need a flag to enable or not the documentation at the snap package level. I propose to do a
snap set lxd documentation.enable=true
andsudo systemctl reload snap.lxd.daemon
which will set an internal env variable to enable this feature. -
For this to work (and again, similar to LXD UI ) we need to expose the server to the network
lxc config set core.https_address <ADDR>
API Changes:
- No API changes (this is a new endpoint, not a new API route)
CLI Changes:
- No CLI changes
Database Changes:
- None
Upgrade Handling:
- None