Zonemaster-Backend

 view release on metacpan or  search on metacpan

docs/Architecture.md  view on Meta::CPAN



### Web backend

A Zonemaster *Web backend* is a daemon providing a JSON-RPC interface for
recording *test* requests in the *Database* and fetching *test* results from the
*Database*. The *Backend* architecture supports multiple *RPC API daemons*
interacting with the same *Database*.

This only needs to be run as root in order to make sure the log file
can be opened. The `starman` process will change to the `www-data` user as
soon as it can, and all of the real work will be done as that user.

>
> TODO: List all ports these processes listen to.
>
> TODO: List all files these processes read and write.
>
> TODO: List everything these processes open network connections to.
>

share/zm-rpcapi.lsb  view on Meta::CPAN

### END INIT INFO

BINDIR=${ZM_BACKEND_BINDIR:-/usr/local/bin}
LOGFILE=${ZM_BACKEND_LOGFILE:-/var/log/zonemaster/zm-rpcapi.log}
PIDFILE=${ZM_BACKEND_PIDFILE:-/var/run/zonemaster/zm-rpcapi.pid}
LISTENIP=${ZM_BACKEND_LISTENIP:-127.0.0.1}
LISTENPORT=${ZM_BACKEND_LISTENPORT:-5000}
USER=${ZM_BACKEND_USER:-zonemaster}
GROUP=${ZM_BACKEND_GROUP:-zonemaster}

STARMAN=`PATH="$PATH:/usr/local/bin" /usr/bin/which starman`
#export ZM_BACKEND_RPCAPI_LOGLEVEL='warning'  # Set this variable to override the default log level

. /lib/lsb/init-functions

start () {
    $STARMAN --listen=$LISTENIP:$LISTENPORT --preload-app --user=$USER --group=$GROUP --pid=$PIDFILE --error-log=$LOGFILE --daemonize $BINDIR/zonemaster_backend_rpcapi.psgi || exit 1
}

stop () {
    if [ -f $PIDFILE ]
    then
        kill `cat $PIDFILE`
    fi
}

status () {
    status="0"
    pidofproc -p "$PIDFILE" starman >/dev/null || status="$?"
    if [ "$status" = 0 ]; then
        log_success_msg "zm-rpcapi is running"
        return 0
    elif [ "$status" = 4 ]; then
        log_failure_msg "could not access PID file for zm-rpcapi"
        return $status
    else
        log_failure_msg "zm-rpcapi is not running"
        return $status
    fi

share/zm-rpcapi.service  view on Meta::CPAN

[Unit]
Description=RPC server for Zonemaster Backend
After=network.target mariadb.service postgresql.service
Wants=mariadb.service postgresql.service

[Service]
Type=simple
ExecStart=/usr/local/bin/starman --listen=127.0.0.1:5000 --preload-app --user=zonemaster --group=zonemaster --pid=/run/zonemaster/zm-rpcapi.pid --error-log=/var/log/zonemaster/zm-rpcapi.log --daemonize /usr/local/bin/zonemaster_backend_rpcapi.psgi
KillSignal=SIGQUIT
PIDFile=/run/zonemaster/zm-rpcapi.pid

[Install]
WantedBy=multi-user.target

share/zm_rpcapi-bsd  view on Meta::CPAN

: ${zm_rpcapi_enable="NO"}
: ${zm_rpcapi_user="zonemaster"}
: ${zm_rpcapi_group="zonemaster"}
: ${zm_rpcapi_pidfile="/var/run/zonemaster/${name}.pid"}
: ${zm_rpcapi_logfile="/var/log/zonemaster/${name}.log"}
: ${zm_rpcapi_listen="127.0.0.1:5000"}

export ZONEMASTER_BACKEND_CONFIG_FILE="/usr/local/etc/zonemaster/backend_config.ini"
#export ZM_BACKEND_RPCAPI_LOGLEVEL='warning'  # Set this variable to override the default log level

command="/usr/local/bin/starman"
command_args="--listen=${zm_rpcapi_listen} --preload-app --user=${zm_rpcapi_user} --group=${zm_rpcapi_group} --pid=${zm_rpcapi_pidfile} --error-log=${zm_rpcapi_logfile} --daemonize /usr/local/bin/zonemaster_backend_rpcapi.psgi"
pidfile="${zm_rpcapi_pidfile}"
required_files="/usr/local/etc/zonemaster/backend_config.ini /usr/local/bin/zonemaster_backend_rpcapi.psgi"

run_rc_command "$1"



( run in 0.470 second using v1.01-cache-2.11-cpan-e93a5daba3e )