Closed technosophos closed 3 years ago
So this is an encoding of the WAGI modules.toml
inside a Bindle invoice.toml
? Sorry if I am missing something, but this raises more questions for me about the relationship between WAGI and Bindle that I can't figure out from the specs - please do point me if this is already documented, or is this part of the proposal/exploration?
Regarding static files, the proposal seems fine as far as Bindle goes, though the requirement for the user to package static.wasm
as part of every bindle with assets could be onerous. It took me a while to grok what you were trying to say about private files, but I think what you are getting at is that fundamentally all file mounts are private; it's up to a module's code which, if any, it chooses to serve, and this is not expressed in the invoice, only in the code. static.wasm
happens to serve all files mounted into it, but the secret file isn't mounted there because the secret file isn't part of any group that static.wasm
requires. I'd suggest dropping the comment and instead having a paragraph or table stating which files are mounted where.
Are we going to support static files via modules.toml
too, or do static files require Bindle?
Oh, or would you just use the volumes
directive in modules.toml
(and map static.wasm
as the handler)?
The current implementation does not recognise module parcels with conditions:
We'll need to review that if we want to use the requires
condition to bring in static files.
(Also, this is a problem for hippofactory, which always emits a group and requires condition even if the group is empty. I can fix that on the hippofactory side though, if there is a reason we need to keep the filter this way.)
The goal of this feature is to take some files from a bindle and serve them via a Wasm module in the bindle. The target should be a wasm module that handles static file serving in a predictable and configurable way.
General overview:
A Bindle with Static Assets and Multiple Modules
Here is an example
invoice.toml
with two modules and some files that should be served statically, along with another file that should never be served statically. I have omitted a bunch of boilerplate for brevity.(See comments on https://github.com/deislabs/hippofactory/pull/15 for how this would be generated from hippofacts)
Serving the Files
The bindle above is mounted to some URI paths:
http://example.com/app/
is mapped tomyapp.wasm
http://example.com/static/
and all subpaths are sent tostatic.wasm
When WAGI encounters the
features.wagi.file = true
flag, the parcel is considered a file and is mounted as a file, attached to any modules thatrequire
this parcel.In the bindle above, the
mayapp.wasm
module would have one file available to it, effectively mounted to the path/super/secret/data.txt
. It would be able to access that data however it saw fit.The
static.wasm
module has the following paths available, mounted by Wagi:/img/cassowary.jpg
/img/penguin.jpg
/css/style.css
The
static.wasm
module effectively can translate HTTP paths to static file paths. Here's basic pseudocode: