From 952951515b616774664ae416b77a943574cf4f18 Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 24 Mar 2022 09:43:31 +0200 Subject: [PATCH] update readme --- peach-web/README.md | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/peach-web/README.md b/peach-web/README.md index 986cc7a..860b124 100644 --- a/peach-web/README.md +++ b/peach-web/README.md @@ -1,6 +1,6 @@ # peach-web -![Generic badge](https://img.shields.io/badge/version-0.5.0-.svg) +![Generic badge](https://img.shields.io/badge/version-0.6.0-.svg) ## Web Interface for PeachCloud @@ -17,7 +17,7 @@ The web interface is primarily designed as a means of managing a Scuttlebutt pub Additional features are focused on administration of the device itself. This includes networking functionality and device statistics. -The peach-web stack currently consists of [Rocket](https://rocket.rs/) (Rust web framework), [Tera](http://tera.netlify.com/) (Rust template engine), HTML and CSS. Scuttlebutt functionality is provided by [golgi](http://golgi.mycelial.technology). +The peach-web stack currently consists of [Rouille](https://crates.io/crates/rouille) (Rust web framework), [Maud](https://maud.lambda.xyz/) (Rust template engine), HTML and CSS. Scuttlebutt functionality is provided by [golgi](http://golgi.mycelial.technology). _Note: This is a work-in-progress._ @@ -32,39 +32,21 @@ Move into the repo and compile: `cd peach-workspace/peach-web` `cargo build --release` -Run the tests: - -`ROCKET_DISABLE_AUTH=true ROCKET_STANDALONE_MODE=false cargo test` - -Move back to the `peach-workspace` directory: - -`cd ..` - Run the binary: -`./target/release/peach-web` +`../target/release/peach-web` ## Environment -### Deployment Profile - -The web application deployment profile can be configured with the `ROCKET_ENV` environment variable: - -`export ROCKET_ENV=stage` - -Default configuration parameters are defined in `Rocket.toml`. This file defines a set of default parameters, some of which are overwritten when running in `debug` mode (ie. `cargo run` or `cargo build`) or `release` mode (ie. `cargo run --release` or `cargo build --release`). - -Read the [Rocket Environment Configurations docs](https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables) for further information. - ### Configuration Mode -The web application can be run with a minimal set of routes and functionality (PeachPub - a simple sbot manager) or with the full-suite of capabilities, including network management and access to device statistics (PeachCloud). The mode is enabled by default (as defined in `Rocket.toml`) but can be overwritten using the `ROCKET_STANDALONE_MODE` environment variable: `true` or `false`. If the variable is unset or the value is incorrectly set, the application defaults to standalone mode. +The web application can be run with a minimal set of routes and functionality (PeachPub - a simple sbot manager) or with the full-suite of capabilities, including network management and access to device statistics (PeachCloud). The mode is enabled by default (as defined in `Rocket.toml`) but can be overwritten using the `STANDALONE_MODE` environment variable: `true` or `false`. If the variable is unset or the value is incorrectly set, the application defaults to standalone mode. ### Authentication -Authentication is disabled in `debug` mode and enabled by default when running the application in `release` mode. It can be disabled by setting the `ROCKET_DISABLE_AUTH` environment variable to `true`: +Authentication is enabled by default when running the application. It can be disabled by setting the `DISABLE_AUTH` environment variable to `true`: -`export ROCKET_DISABLE_AUTH=true` +`export DISABLE_AUTH=true` ### Logging @@ -106,10 +88,6 @@ Remove configuration files (not removed with `apt-get remove`): `sudo apt-get purge peach-web` -## Design - -`peach-web` is built on the Rocket webserver and Tera templating engine. It presents a web interface for interacting with the device. HTML is rendered server-side. Request handlers call `peach-` libraries and serve HTML and assets. Each Tera template is passed a context object. In the case of Rust, this object is a `struct` and must implement `Serialize`. The fields of the context object are available in the context of the template to be rendered. - ## Configuration Configuration variables are stored in /var/lib/peachcloud/config.yml. @@ -124,6 +102,10 @@ If the config dyn_use_custom_server=true, then a value must also be set for dyn_ This value is the URL of the instance of peach-dyndns-server that requests will be sent to for domain registration. Using a custom value can here can be useful for testing. +## Design + +`peach-web` has been designed with simplicity and resource minimalism in mind. Both the dependencies used by the project, as well as the code itself, reflect these design priorities. The Rouille micro-web-framework and Maud templating engine have been used to present a web interface for interacting with the device. HTML is rendered server-side and request handlers call `peach-` libraries and serve HTML and assets. The optimised binary for `peach-web` can be compiled on a RPi 3 B+ in approximately 30 minutes. + ## Licensing AGPL-3.0