Database and Pod

SUMARiS use a database engine to store data.

It can exists many SUMARiS databases instances on the web. Each databases instance is accessible through a server software, called SUMARiS Pod.

A Pod manage only one database instance.

Main features of the Pod

The SUMARiS Pod has several features:

  • Create a database instance, then manage schema updates.

    • The Pod is compliant with many database engines: HSQLDB, PostgreSQL and Oracle;
  • Allow data access (read/write) to a database instance. Such API is used by client software (like the SUMARiS App):

    • Publish data as GraphQL API;
    • Publish data as RDF API for semantic web, including OWL (Ontoligy Web Language);
    • CSV files input/output (using the ICES RDB exchange data format)
    • Peer-to-peer synchronization, to share data between Pods (coming soon)

Database model

  • Conceptual model of the database:
  • Tables list with all associated columns;
  • For IT developers:

    • Entities (Hibernate mapping);
    • HQL named queries declared in the source code. We also use JPA Criteria API to build queries dynamically (see source code for more details).

Installation of the database

HSQLDB engine (default)

wget -kL https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-server/src/main/assembly/bin/sumaris-db-hsqldb.sh
# Or using curl: 
# curl https://github.com/sumaris-net/sumaris-pod/blob/master/sumaris-server/src/main/assembly/bin/sumaris-db-hsqldb.sh > sumaris-db-hsqldb.sh  

# Give execution rights
chmod u+x sumaris-db-hsqldb.sh
  • Edit this file, to set the SUMARIS_HOME variable :
#!/bin/bash
# --- User variables (can be redefined): ---------------------------------------
#SUMARIS_HOME=/path/to/sumaris/home
SERVICE_NAME=sumaris-db
DB_NAME=sumaris
DB_PORT=9000
(...)
  • Start the database, using the command (in a terminal):
./sumaris-db-hsqldb.sh start
  • That’s it !

Your database is ready, and should be accessible (e.g. through a JDBC client software).

To make sure everything is running well, check logs at: <SUMARIS_HOME>/logs/

Oracle

TODO: write this part

PostgreSQL

TODO: write this part

Installation of the Pod

On Linux systems (Debian, Ubuntu)

  1. Install Pod’s dependencies:

  2. Download the latest JAR file at: https://github.com/sumaris-net/sumaris-pod/releases

  3. Copy the JAR file anywhere;

  4. In a terminal, start the pod using the command:

    java -jar sumaris-pod-x.y.z.jar
    
  5. Congratulations !

    Your Pod should now be running..

    A welcome page should also be visible at the address http://localhost:8080:

Note for IT developers:

Your running Pod give access to useful dev tools : - A GraphQL live query editor, at <server_url>/grapiql (WARN some query will need authorization) - A GraphQL subscription query editor (GraphQL + websocket), at <server_url>/subscription/test

On MS Windows

TODO: write this part

Configuration

To change the Pod’s configuration, follow this steps:

  1. Create a directory for your configuration (e.g. /home/<USER>/.config/sumaris/):

    mkdir -p /home/<USER>/.config/sumaris/
    
  2. Create a file application.yml inside this directory;

  3. Edit the file, and add options you want to override (see the list of available options):

    A basic example:

    server.address: 127.0.0.1
    server.port: 8080  
    sumaris.basedir: /home/<USER>/.config/sumaris
    
  4. In a terminal, start the pod with the command:

    java -server -Xms512m -Xmx1024m -Dspring.config.additional-location=/home/<USER>/.config/sumaris/ -jar sumaris-pod-x.y.z.jar
    
  5. That’s it !

    Your configuration file should have been processed.

Build from source (database + Pod)

  1. Installe project dependencies:
    • Install build tools (Make, GCC, Git)
    sudo apt-get install build-essential
    
  1. Get the source code

    git clone git@github.com:sumaris-net/sumaris-pod.git
    cd sumaris-pod
    
  2. Run the compilation:

    cd sumaris-pod
    mvn install -DskipTests
    
  3. The final JAR file should have been created inside the directory: <PROJECT_DIR>/sumaris-server/target/