Skip to content
Snippets Groups Projects

VIPSCoreManager

The CoreManager is a server component that acts as a frontend to the VIPSCore system.

The main tasks of the manager are authencication, authorization, scaling and logging of activities in the VIPSCore system. All requests to VIPSCore are (or rather, may be) routed through VIPSCoreManager.

How VIPSCore and VIPSCoreManager fits into the whole VIPS architecture

Requests to and replies from VIPSCoreManager are identical to VIPSCore, except that you need to provide credentials as part of the request body.

VIPSCoreManager is a part of the VIPS platform for automatic pest prediction

Build and deploy

Database

So make sure you have PostgreSQL >= 10 installed. As the db superuser (postgres on Ubuntu), create a user/role vipscoremanager. Then, initialize the database as in the example below:

--
-- PostgreSQL database dump
--

-- Dumped from database version 14.4 (Ubuntu 14.4-0ubuntu0.22.04.1)
-- Dumped by pg_dump version 14.4 (Ubuntu 14.4-0ubuntu0.22.04.1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE vipscoremanager;
--
-- Name: vipscoremanager; Type: DATABASE; Schema: -; Owner: vipscoremanager
--

CREATE DATABASE vipscoremanager WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'en_US.UTF-8';


ALTER DATABASE vipscoremanager OWNER TO vipscoremanager;

The code

You need Maven installed.

Clone and build the VIPSCommon package

Clone and build this project

Download and install WildFly >= 25.0.1

Add the db credentials to Wildfly's configuration file [WILDFLY_HOME]/standalone/configuration/standalone.xml, e.g. like this:

<profile>
    <!-- [...] -->
    <subsystem xmlns="urn:jboss:domain:datasources:6.0">
        <datasource jta="true" jndi-name="java:jboss/datasources/vipscoremanager" pool-name="Postgres-vipscoremanager-pool" enabled="true" use-java-context="true" use-ccm="true">
            <connection-url>jdbc:postgresql://localhost:5432/vipscoremanager</connection-url>
            <driver>postgresql</driver>
            <security>
                <user-name>vipscoremanager</user-name>
                <password>foobar</password>
            </security>
        </datasource>
        <drivers>
        <!-- [...] -->
        <driver name="postgresql" module="org.postgresql">
            <driver-class>org.postgresql.Driver</driver-class>
        </driver>
        </drivers>
    </subsystem>
    <!-- [...] -->
</profile>

Also, install the JDBC driver for PostgreSQL in [WILDFLY_HOME]/modules/ (See Wildfly's class loading documentation)

Deploy the build from this project in Wildfly. Wildfly should run on Java >= 11.

Configuration

These system properties must be set in the WildFly config file [WILDFLY_HOME]/standalone/configuration/standalone.xml:

<system-properties>
        <property name="no.nibio.vips.coremanager.VIPSCORE_URL" value="http://localhost:8080/VIPSCore"/>
        <property name="no.nibio.vips.coremanager.VIPSBATCH_ALLOWED_IPS" value="127.0.0.1"/>
        <property name="no.nibio.vips.coremanager.MD5_SALT" value="FooBarFooBarFooBar"/>
        <!-- [...] -->
</system-properties>

Explanation of the properties:

# Where to find the VIPSCore service
no.nibio.vips.coremanager.VIPSCORE_URL=http://localhost:8080/VIPSCore
# From which IP adresses we accept batch operation requests
no.nibio.vips.coremanager.VIPSBATCH_ALLOWED_IPS=127.0.0.1
# Password hash salt
no.nibio.vips.coremanager.MD5_SALT=FooBarFooBarFooBar

Initialization

The code includes database migrations by Flyway, so the database structure will be created automatically on the first successfull deployment.

In order to use the service, you need to add at least one organization and at least one user. This is done by SQL directly in the database. See example below:

-- Create the organization
INSERT INTO public.organization(organization_name)VALUES('Foobar International');
-- Create the batch user for VIPSLogic
-- Assuming that the INSERT statement above created an organization with organization_id=1
INSERT INTO public.vips_core_user(vips_core_user_id,last_name,organization_id)
VALUES(-10,'VIPSLogic',1);
-- Create login credentials for this user
-- Use the system property no.nibio.vips.coremanager.MD5_SALT to create the hash
-- These credentials must be set as system properties in the server running VIPSLogic
-- (Please the the docs for VIPSLogic)
INSERT INTO public.vips_core_credentials(username,password,vips_core_user_id)
VALUES('vipslogic','XXXXXXXXXXX',-10);

Create a client

If you don't use VIPSLogic or just want to test the system (e.g. with Postman), you can send requests directly to the system. Please see the VIPSCore documentation for how to do this.