AppyPrinciplesGetting started
Apps Amon

Amon stands for Appy Monitoring. It is an app written in Appy. Deployed on the same server as a bunch of Appy sites, Amon uses public URLs exposed by any Appy site to check whether a Appy site is live or healthy.

Amon is then able to restart a site being down, or being seriously failing, according to the state of its pool of threads.

Amon can also monitor traditional companion processes for Appy sites, like a Apache reverse proxy or LibreOffice running in server mode.

Beyond monitoring and acting on Appy sites, Amon also includes a log scanner: it can read applicative logs from any monitored Appy site and create objects in its database, transforming your logs into a real database, with all the search functionalities one may found in any Appy app.

Installation

First of all, if not done yet, create, on the server where Amon and Appy sites must be deployed, a Python virtualenv in /home/appy/.venv, as explained here.

Amon is not on PyPI, is developed in a rolling-release mode, has a public git repository and depends on the last development version of Appy. Although there are published versions of Appy on PyPI, the development version of Appy, also available via a public git repository, is quite stable.

Amon is traditionally installed in /home/appy/Amon, as a Appy site listening on port 7999. Create this site, with the lastest versions of Amon and Appy from their git repositories, by typing, as appy user:

appy make site /home/appy/Amon -a url=https://www.geezteem.com/807/git~/Amon -d url=https://www.geezteem.com/17/git~/appy

The site has been created. Explanations about the structure of this Appy site can be found here.

In order to change the port where Amon will listen, edit the configuration file that has been generated in /home/appy/Amon/config.py and change the port:

    ...
    c.server.set(app, site)
    c.server.port = 7999 
    ...

Preparing the Appy sites

Amon, once finally configured (see below), will scan your server, find Appy sites and get, from their own config.py files, plenty of useful info about these sites.

Because Amon will read config.py files by importing them as Python modules, it will work if each file respects the following conventions.

The complete function must be defined with a second parameter, named minimal

The complete function must be defined with a second parameter, named minimal, defaulting to False:

def complete(c, minimal=False):
    ...

Perform specific imports only in non-minimal mode

When your site runs, the complete method is called with minimal being False: the whole configuration is loaded. When Amon reads it, it reads a minimal configuration. Any specific element you need to define by using an import statement must be done if minimal is True, like in this example:

def complete(c, minimal=False):
    ...
    if not minimal:
       from MyApp import MySpecificConfig
       c.myConfig = MySpecificConfig()

That way, Amon does not import a big part of (or all) the import tree from your app, which would lead to total mess.

Finalizing the configuration via the Amon web interface

The remainder of the configuration is done via the web interface. Launch your site and go to http//<yourserver>:7999.