update readme

This commit is contained in:
2022-03-08 10:53:06 +02:00
parent 67c727716c
commit 5b70353d6f

View File

@ -1,18 +1,27 @@
# peach-web # peach-web
[![Build Status](https://travis-ci.com/peachcloud/peach-web.svg?branch=master)](https://travis-ci.com/peachcloud/peach-web) ![Generic badge](https://img.shields.io/badge/version-0.5.0-<COLOR>.svg) ![Generic badge](https://img.shields.io/badge/version-0.5.0-<COLOR>.svg)
## Web Interface for PeachCloud ## Web Interface for PeachCloud
**peach-web** provides a web interface for the PeachCloud device. **peach-web** provides a web interface for the PeachCloud device.
Initial development is focused on administration of the device itself, beginning with networking functionality, with SSB-related administration to be integrated at a later stage. The web interface is primarily designed as a means of managing a Scuttlebutt pub. As such, it exposes the following features:
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. - Create a Scuttlebutt profile
- Follow, unfollow, block and unblock peers
- Generate pub invite codes
- Configure the sbot (hops, log directory, LAN discovery etc.)
- Send private messages
- Stop, start and restart the sbot
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).
_Note: This is a work-in-progress._ _Note: This is a work-in-progress._
### Setup ## Setup
Clone the `peach-workspace` repo: Clone the `peach-workspace` repo:
@ -35,9 +44,9 @@ Run the binary:
`./target/release/peach-web` `./target/release/peach-web`
### Environment ## Environment
**Deployment Profile** ### Deployment Profile
The web application deployment profile can be configured with the `ROCKET_ENV` environment variable: The web application deployment profile can be configured with the `ROCKET_ENV` environment variable:
@ -47,17 +56,17 @@ Default configuration parameters are defined in `Rocket.toml`. This file defines
Read the [Rocket Environment Configurations docs](https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables) for further information. Read the [Rocket Environment Configurations docs](https://rocket.rs/v0.5-rc/guide/configuration/#environment-variables) for further information.
**Configuration Mode** ### 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 `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.
**Authentication** ### 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 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`:
`export ROCKET_DISABLE_AUTH=true` `export ROCKET_DISABLE_AUTH=true`
**Logging** ### Logging
Logging is made available with `env_logger`: Logging is made available with `env_logger`:
@ -65,7 +74,7 @@ Logging is made available with `env_logger`:
Other logging levels include `debug`, `warn` and `error`. Other logging levels include `debug`, `warn` and `error`.
### Debian Packaging ## Debian Packaging
A `systemd` service file and Debian maintainer scripts are included in the `debian` directory, allowing `peach-web` to be easily bundled as a Debian package (`.deb`). The `cargo-deb` [crate](https://crates.io/crates/cargo-deb) can be used to achieve this. A `systemd` service file and Debian maintainer scripts are included in the `debian` directory, allowing `peach-web` to be easily bundled as a Debian package (`.deb`). The `cargo-deb` [crate](https://crates.io/crates/cargo-deb) can be used to achieve this.
@ -97,17 +106,17 @@ Remove configuration files (not removed with `apt-get remove`):
`sudo apt-get purge peach-web` `sudo apt-get purge peach-web`
### Design ## 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. `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
Configuration variables are stored in /var/lib/peachcloud/config.yml. Configuration variables are stored in /var/lib/peachcloud/config.yml.
Peach-web also updates this file when changes are made to configurations via Peach-web also updates this file when changes are made to configurations via
the web interface. peach-web has no database, so all configurations are stored in this file. the web interface. peach-web has no database, so all configurations are stored in this file.
#### Dynamic DNS Configuration ### Dynamic DNS Configuration
Most users will want to use the default PeachCloud dynamic dns server. Most users will want to use the default PeachCloud dynamic dns server.
If the config dyn_use_custom_server=false, then default values will be used. If the config dyn_use_custom_server=false, then default values will be used.
@ -115,6 +124,6 @@ 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. 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. Using a custom value can here can be useful for testing.
### Licensing ## Licensing
AGPL-3.0 AGPL-3.0