Zonemaster-WebBackend

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

script/crontab_job_runner/execute_zonemaster_P5.pl
script/patch_db_mysql_for_backend_DB_version_lower_than_1.0.3.pl
script/patch_db_postgresq_for_backend_DB_version_lower_than_1.0.3.pl
script/zm_wb_daemon
script/zonemaster_webbackend.psgi
share/backend_config.ini
share/cleanup-mysql.sql
share/cleanup-postgres.sql
share/initial-mysql.sql
share/initial-postgres.sql
share/starman-zonemaster.conf
share/travis_mysql_backend_config.ini
share/travis_postgresql_backend_config.ini
share/travis_sqlite_backend_config.ini
share/zm-backend.sh
share/zm-centos.sh
share/zm_wb_daemon.conf
t/test01.data
t/test01.t
t/test_DB_backend.pl
t/test_runner.pl

docs/installation.md  view on Meta::CPAN

```sh
{"id":140715758026879,"jsonrpc":"2.0","result":"Zonemaster Test Engine Version: v1.0.2"}
```

## <a name="debian"></a>2. Ubuntu & Debian 

### 2.1 Installing dependencies

```sh
sudo apt-get update
sudo apt-get install git libmodule-install-perl libconfig-inifiles-perl libdbd-sqlite3-perl starman libio-captureoutput-perl libproc-processtable-perl libstring-shellquote-perl librouter-simple-perl libclass-method-modifiers-perl libtext-microtemplat...
sudo cpan -i  Test::Requires Plack::Middleware::Debug Parallel::ForkManager JSON::RPC 
```
>
> Note: The Perl modules `Parallel::ForkManager` and `JSON::RPC` exist as Debian
> packages, but with versions too old to be useful for us.
>

### 2.2 Install the chosen database engine and related dependencies

#### 2.2.1 MySQL

docs/installation.md  view on Meta::CPAN


#### 2.6.3 SQLite

>
> At this time there is no instruction for configuring and creating a database
> in SQLite.
>

### 2.7 Service startup

Starting the starman part that listens for and answers the JSON::RPC requests

```sh
sudo service zm-backend.sh start
```

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.

Check that the service has started 

```sh
sudo service zm-backend.sh status
```

### 2.8 Post-installation sanity check

docs/installation.md  view on Meta::CPAN

#### 3.7.3 SQLite

>
> At this time there is no instruction for configuring and creating a database
> in SQLite.
>

### 3.8 Service startup

```sh
starman --error-log="$HOME/logs/error.log" --pid-file="$HOME/logs/starman.pid" --listen=127.0.0.1:5000 --daemonize /usr/local/bin/zonemaster_webbackend.psgi 
zm_wb_daemon start
```

### 3.9 Post-installation sanity check

If you followed this instructions to the letter, you should be able to use the
API on localhost port 5000, like this:

```sh
curl -s -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"version_info","id":"1"}' http://localhost:5000/ && echo

share/starman-zonemaster.conf  view on Meta::CPAN

description "Zonemaster WebBackend Upstart Job"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
umask 022
limit nofile 4096 4096
expect fork
pre-start script
    [ -d "/var/log/starman" ] || mkdir -p /var/log/starman
end script
exec /usr/bin/starman \
                --user=www-data \
                --group=www-data \
                --daemonize \
                --listen :5000 \
                --max-requests 99999999 \
                --workers 5 \
                --error-log /var/log/starman/zonemaster_webbackend.log \
                /usr/local/bin/zonemaster_webbackend.psgi

share/zm-backend.sh  view on Meta::CPAN

        mkdir -p $PIDDIR
    fi

    chown -R www-data $LOGDIR
    chown -R www-data $PIDDIR
}

start() {
    setup

    starman --user=$USER --group=$GROUP --error-log=$LOGDIR/zm-starman-error.log --pid=$PIDDIR/zm-starman.pid --listen=$LISTENIP:5000 --daemonize /usr/local/bin/zonemaster_webbackend.psgi
    /usr/local/bin/zm_wb_daemon --user=$USER --group=$GROUP --pidfile=$PIDDIR/zm_wb_daemon.pid start
}

stop() {
    if [ -f $PIDDIR/zm_wb_daemon.pid ]
    then
        /usr/local/bin/zm_wb_daemon --user=$USER --group=$GROUP --pidfile=$PIDDIR/zm_wb_daemon.pid stop
    fi

    if [ -f $PIDDIR/zm-starman.pid ]
    then
        kill `cat $PIDDIR/zm-starman.pid`
    fi
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;

share/zm-centos.sh  view on Meta::CPAN

        mkdir -p $PIDDIR
    fi

    chown -R $USER $LOGDIR
    chown -R $GROUP $PIDDIR
}

start() {
    setup

    /usr/local/bin/starman --user=$USER --group=$GROUP --error-log=$LOGDIR/zm-starman-error.log --pid=$PIDDIR/zm-starman.pid --listen=$LISTENIP:5000 --daemonize /usr/local/bin/zonemaster_webbackend.psgi
    /usr/local/bin/zm_wb_daemon --user=$USER --group=$GROUP --pidfile=$PIDDIR/zm_wb_daemon.pid start
}

stop() {
    if [ -f $PIDDIR/zm_wb_daemon.pid ]
    then
        /usr/local/bin/zm_wb_daemon --user=$USER --group=$GROUP --pidfile=$PIDDIR/zm_wb_daemon.pid stop
    fi

    if [ -f $PIDDIR/zm-starman.pid ]
    then
        kill `cat $PIDDIR/zm-starman.pid`
    fi
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;



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