Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Container - Static file server for UI bundles #885

Merged
merged 22 commits into from
Jan 21, 2019

Conversation

willemolding
Copy link
Collaborator

@willemolding willemolding commented Jan 18, 2019

(This is @lucksus, wrapping up @willemolding's PR with description and last polish)

The two grey items in the center are part of this PR:
screenshot 2019-01-18 at 21 43 30

HTTP server

Uses hyper and hyper staticfile to create a light-weight HTTP server to serve front-end files.

Additions to container config

Two structs get added to the set of container config types:

  • UiBundleConfiguration
  • UiInterfaceConfiguration
    Which look like this in the toml config file:
[[ui_bundles]]
id = "bundle1"
root_dir = "" # serves the current directory
hash = "Qm000"

[[ui_interfaces]]
id = "ui-interface-1"
bundle = "bundle1"
port = 3000
dna_interface = "<not used>"

UI bundles are analogous to DNAs: adding one means installing it and making it available inside the container under a given ID. This does not yet instantiate this UI (same as with the DNA which needs to be used in an instance).

A UI bundle has to be connected to a DNA/zome interface (the websocket thing that connects to the container JSON RPC functions) in order to create a UI interface, kind of like an instance of the bundle. This is what gets served by the HTTP server on a given port.

The main reason for this is not part of this PR but coming up next: the UI needs to call back to the container to open a websocket connection. It needs to know which of potentially many websocket interfaces is meant for it. The container will insert this information into the package it is serving for each UI...

@willemolding willemolding changed the title [WIP] - Container - Static file server for UI bundles Container - Static file server for UI bundles Jan 18, 2019
@willemolding willemolding changed the title Container - Static file server for UI bundles [WIP] - Container - Static file server for UI bundles Jan 18, 2019
@lucksus lucksus changed the title [WIP] - Container - Static file server for UI bundles Container - Static file server for UI bundles Jan 18, 2019
Ok(())
}

// pub fn stop(&mut self) -> HolochainResult<()> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only part that needs to be finished. I guess this can wait until UI bundle CRUD interface though

@@ -607,7 +607,11 @@ pattern = ".*""#
file.read_to_string(&mut config_contents)
.expect("Could not read temp config file");

let mut toml = String::from("bridges = []");
let mut toml = String::from(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's ripe for refactoring as another add_block unit?

@lucksus lucksus merged commit 1390e84 into develop Jan 21, 2019
@lucksus lucksus removed the review label Jan 21, 2019
@zippy zippy deleted the container-static-file-server branch July 5, 2019 13:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants