Mongoose daemon mode

Introduction

Mongoose is a daemon mode of SWUpdate that provides a web server, web interface and web application.

Mongoose supports two different web interface versions although the first version is deprecated and should not be used. The second version uses a WebSocket for the asynchronous communication between web server and web application, allows a visualization of image update processes, restarts the system via a post update command and automatically reloads the web page after a restart or connection lost.

The web application in web-app uses the Node.js package manager and gulp as build tool. It depends on Bootstrap 4, Font Awesome 5 and Dropzone.js.

Startup

After having configured and compiled SWUpdate with enabled mongoose web server and web interface version 2 support,

./swupdate --help

lists the mandatory and optional arguments to be provided to mongoose. As an example,

./swupdate -l 5 -w '-r ./examples/www/v2 -p 8080' -p 'reboot'

runs SWUpdate in mongoose daemon mode with log-level TRACE and a web server at http://localhost:8080.

Example

The ready to use example of the web application in the examples/www/v2 directory uses a Public Domain background.jpg image from pixabay with is released under the Creative Commons CC0 license. The used favicon.png and logo.png images are made from the SWUpdate logo and therefore subject to the GNU General Public License version 2. You must comply to this license or replace the images with your own files.

Customize

You could customize the web application inside the web-app directory. Beside the replace of the favicon.png, logo.png and background.jpg images inside the images directory you could customize the Bootstrap colors and settings inside the scss/bootstrap.scss style sheet. The style sheet changes need a rebuild of the web application source code.

Develop

The development requires Node.js version 6 or greater and a prebuilt SWUpdate project with enabled mongoose web server and web application interface version 2 support.

  1. Enter the web application directory:

    cd ./web-app
    
  2. Install the dependencies:

    npm install
    
  3. Build the web application:

    npm run build
    
  4. Start the web application:

    ../swupdate -w '-r ./dist -p 8080' -p 'echo reboot'
    
  5. Test the web application:

  6. Pack the web application (optional):

    npm run package -- --output swupdate-www.tar.gz
    

Contribute

Please run the linter before any commit

npm run lint