Giter Club home page Giter Club logo

multivisor's Introduction

Multivisor

Build Status

A centralized supervisor UI (Web & CLI)

  • Processes status always up to date
  • Reactivity through asynchronous actions
  • Notifications when state changes
  • Mobile aware, SPA web page
  • Powerful filters
  • Interactive CLI

QICHAO'S NOTE

  • I pushed the python part of it to our own pypi enabling us to install it easily for our other projects.
  • This installation is necessary as Multivisor Dashboard relies on the supervisor processes to have a specific rpc interface (see following) so the Dashboard can connect and get live updates.
[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9051

Web interface

multivisor on chrome desktop app mode

Command line interface

multivisor-cli

Running the example from scratch

# Fetch the project:
git clone https://github.com/tiagocoutinho/multivisor
cd multivisor


# Install frontend dependencies
npm install
# Build for production with minification
npm run build

# install backend: feel free to use your favorite python virtual environment
# here. Otherwise you will need administrative privileges
pip install .

# Launch a few supervisors
mkdir examples/full_example/log
supervisord -c examples/full_example/supervisord_lid001.conf
supervisord -c examples/full_example/supervisord_lid002.conf
supervisord -c examples/full_example/supervisord_baslid001.conf

# Finally, launch multivisor:
multivisor -c examples/full_example/multivisor.conf

That's it!

Web interface

Start a browser pointing to localhost:22000. On a mobile device it should look something like this:

multivisor on mobile

Command line interface

Type on the command line:

multivisor-cli

Technologies

multivisor diagram

The multivisor backend runs a flask web server.

The multivisor-cli runs a prompt-toolkit 2 based console.

The frontend is based on vue + vuex + vuetify.

Configuration

Supervisor

Make sure multivisor is installed in the same environment as the one supervisor(s) is(are) running. Then, configure the multivisor rpc interface by adding the following lines to your supervisord.conf:

[rpcinterface:multivisor]
supervisor.rpcinterface_factory = multivisor.rpc:make_rpc_interface
bind=*:9002

If no bind is given, it defaults to *:9002.

Repeat the above procedure for every supervisor you have running.

Multivisor

The multivisor web server relies on the multivisor rpc interface running on each supervisor.

The multivisor web server is configured with a INI like configuration file (much like supervisor itself). It is usually named multivisor.conf and it must be passed as argument to multivisor when starting the server.

It consists of a global section where you can give an optional name to your multivisor instance (default is multivisor. This name will appear on the top left corner of multivisor the web page).

To add a new supervisor to the list simply add a section [supervisor:<name>]. It accepts an optional url in the format [<host>][:<port>]. The default is <name>:9002.

Here is some basic example:

[global]
name=ACME

[supervisor:roadrunner]
# since no url is given it will be roadrunner:9002

[supervisor:coyote]
# no host is given: defaults to coyote
url=:9011

[supervisor:bugsbunny]
# no port is given: defaults to 9002
url=bugsbunny.acme.org

[supervisor:daffyduck]
url=daffyduck.acme.org:9007

Of course the multivisor itself can be configured in supervisor as a normal program.

Authentication

To protect multivisor from unwanted access, you can enable required authentication. Specify username and password parameters in global section of your configuration file e.g.:

[global]
username=test
password=test

You can also specify password as SHA-1 hash in hex, with {SHA} prefix: e.g. {SHA}a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 (example hash is test in SHA-1).

In order to use authentication, you also need to set MULTIVISOR_SECRET_KEY environmental variable, as flask sessions module needs some secret value to create secure session. You can generate some random hash easily using python: python -c 'import os; import binascii; print(binascii.hexlify(os.urandom(32)))'

Remember to restart the server after changes in configuration file.

Build & Install

# install frontend
npm install

# build for production with minification
npm run build

# install backend
pip install .

Run

# serve at localhost:22000
multivisor -c multivisor.conf

Start a browser pointing to localhost:22000

Development mode

You can run the backend using the webpack dev server to facilitate your development cycle:

First, start multivisor (which listens on 22000 by default):

python -m multivisor.server.web -c multivisor.conf

Now, in another console, run the webpack dev server (it will transfer the requests between the browser and multivisor):

npm run dev

That's it. If you modify App.vue for example, you should see the changes directly on your browser.

multivisor's People

Contributors

tiagocoutinho avatar guy881 avatar qichaohe avatar changsijay avatar landequhuxi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.