Geoanalytics platform installation and upgrade guide

Installation

Pre-Requisites

  1. Java 8
  2. LIBXML 2.9.3
  3. LIBJSON 0.11.99

Install - Download

  1. Postgres 9.5+
  2. Postgres Extension PostGIS 2.2.1
  3. Postgres Extension Postgis_topology 2.2.1
  4. Postgres Extension plpgsql
  5. Postgres Extension uuid-ossp
  6. Apache Tomcat 8+
  7. GeoServer 2.12.2+ or 2.11.4+
  8. SmartGears
  9. Geoanalytics.war

Postgres Installation

Install postgres

  • apt-get install postgresql-9.5 postgis postgresql-9.5-postgis-2.2 postgresql-client-9.5 postgresql-contrib-9.5 postgresql-9.5-postgis-2.2 postgresql-9.5-postgis-scripts libdbd-pg-perl

Connect to postgres database as superuser (e.g. postgres).

  • (Root user) sudo su
  • (*postgres* user) su – postgres
  • (connect to postgres) psql

Create the database, extensions and give ownership to database user (e.g. geodbuser),

  • CREATE DATABASE geoanalytics;
  • CREATE USER geodbuser WITH PASSWORD 'cc';
  • ALTER DATABASE geoanalytics OWNER TO geodbuser;
  • GRANT ALL PRIVILEGES ON DATABASE geoanalytics to geodbuser;
  • \connect geoanalytics
  • CREATE EXTENSION IF NOT EXISTS plpgsql;
  • CREATE EXTENSION IF NOT EXISTS postgis;
  • SELECT PostGIS_full_version(); (Press q to exit version screen)
  • CREATE EXTENSION IF NOT EXISTS postgis_topology;
  • CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  • (View installed extensions) SELECT name, default_version,installed_version FROM pg_available_extensions where installed_version is not null;
  • (Exit PSQL console) \q
  • Download scripts from repository (geoanalyticsDB folder first)
  • (Create db using scripts) psql -d geoanalytics < /home/gcube/install/2016-12-02/geoanalytics_schema.sql 2 > error.txt
  • (Execute the rest of the scripts (with the proper order, it is included in the files' titles) the same way as above) psql
  • (connect to db) \c geoanalytics
  • (view all tables, views and materialized views) \d
  • (If there are tables or views whose owner is not geodbuser, give ownership to geodbuser manually)
  • ALTER TABLE "XXXXXX" OWNER TO geodbuser;
  • ALTER VIEW "CCCCCC" OWNER TO geodbuser;

Database schemas per platform version

Apache Tomcat

GeoServer

  • http://geoserver.org/download/
  • Deploy it in the same tomcat server with the geoanalytics application.
  • Change the default password for the admin user.
  • GeoServer version 2.12.2+ or 2.11.4+ is required in order to solve a race condition bug fixed in geotools (version 17.4)

SmartGears

Geoanalytics

  • Download latest version from ETICS.
  • Once deployed you need to configure it properly so that the application can connect with the db and the geoserver with the credentials you have created.
  • Navigate to apache tomcat webapps folder, then into geoanalytics application, then WEB-INF folder. Open geoanalytics.properties file and configure the following properties:
  • gr.cite.geoanalytics.dataaccess.dbUser, set it to geodbuser
  • gr.cite.geoanalytics.dataaccess.dbPass, set it to the password you have created when creating the user user for the geoanalytics database
  • gr.cite.geoanalytics.dataaccess.geoServerBridge.url, the geoserver url
  • gr.cite.geoanalytics.dataaccess.geoServerBridge.user, set it to admin
  • gr.cite.geoanalytics.dataaccess.geoServerBridge.pass, set it to the NEW password you have created for the admin user of geoserver
  • gr.cite.geoanalytics.security.portmapping.http, set it to 8080
  • gr.cite.geoanalytics.security.portmapping.https, set it to 8443
  • gr.cite.geoanalytics.persistence.dbusername, set it to geodbuser
  • gr.cite.geoanalytics.persistence.dbpassword, set it to the password you have created when creating the geodbuser user for the geoanalytics database

Upgrade

  • Download latest sql scripts from the latest version folder
  • Stop the Geoanalytics service
  • Take a backup of the database
  • Run scripts as described above(in case of new tables, check if the new tables' owner is geodbuser, otherwise change the ownership manually as described above)
  • Download latest .war from ETICS.
  • Configure geoanalytics.properties file as described above.
  • Deploy it.

Upgrade version 4.2 to 4.3

Upgrade version 4.3 to 4.4

Upgrade should be performed incrementally from the existing v4.3 database.

The required scripts which should be used for the whole procedure can be found here:

http://svn.research-infrastructures.eu/public/d4science/gcube/branches/geoanalytics/upgrade_scripts/upgrade_scripts_4.3_4.4/

Prerequired data:

  • One postgresql containing the current (v4.3) geoanalytics database (complete, with all user data loaded i.e ingested datasets, etc).

Pre-splitting steps:

  1. Please create a backup copy of the existing database following the 2 commands below (replace the GEOANALYTICS_DB with the existing database and GEOANALYTICS_DB_BACKUP with the desired name for the backup database):

    -- this terminates all active connections on the database (MANDATORY! DO NOT SKIP THIS) -- 
    SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'GEOANALYTICS_DB' AND pid <> pg_backend_pid();
    -- create a cloned database of GEOANALYTICS DB, IN CASE OF ANY ERROR --
    CREATE DATABASE GEOANALYTICS_DB_BACKUP WITH TEMPLATE GEOANALYTICS_DB OWNER postgres;

  2. Apply all sql scripts residing DIRECTLY on the root folder (http://svn.research-infrastructures.eu/public/d4science/gcube/branches/geoanalytics/upgrade_scripts/upgrade_scripts_4.3_4.4/) on the original geoanalytics database (meaning not the backup database created earlier). Please, DO NOT EXECUTE ANY OF THE SCRIPTS WITHIN THE Database_splitting folder at this phase.

  3. If everything has executed without any mistake, drop the backup database (drop database GEOANALYTICS_DB_BACKUP). If not, drop the geoanalytics db and create one from the backup, in the same way as step (1)

  4. Extract and copy the database to ALL nodes which will host the geoanalytics and gos instances. IT IS IMPORTANT THIS TO BE DONE BEFORE PROCEEDING ON THE NEXT STEPS.

The database which was created from the above steps will be named geoanalytics_4.4 from now on during the remaining notes. It will serve as the template by which all other databases will be created

Setting up the Geoanalytics database for version 4.4

  1. Use a copy of the database geoanalytics_4.4 and apply the script Database_splitting/01_splitting.sql on it ( FIRST EDIT THE SCRIPT ACCORDING TO THE NOTES IT CONTAINS )

  2. Apply also the script Database_splitting/02a_leave_only_geoanalytics_database.sql ( FIRST EDIT THE SCRIPT ACCORDING TO THE NOTES IT CONTAINS )

Setting up a Gos database for version 4.4

  1. Use a copy of the database geoanalytics_4.4 and apply the script Database_splitting/01_splitting.sql on it ( FIRST EDIT THE SCRIPT ACCORDING TO THE NOTES IT CONTAINS )

  2. Apply also the script Database_splitting/02b_leave_only_gos_database.sql ( FIRST EDIT THE SCRIPT ACCORDING TO THE NOTES IT CONTAINS )

Setup a zookeeper cluster

Instructions can be found here:
https://zookeeper.apache.org/doc/r3.3.2/zookeeperAdmin.html

You should end up having a connection string of the form
node1:2181,node2:2181,node3:2181
for the zookeeper cluster.
where nodex with x∈{1,2,3,4,5,...} are the hosting machines

Final steps:

So far we have split an existing geoanalytics database into two databases (according to the above instructions):
* geoanalytics
* gos

Assume that we need to install
* 2 instances of Gos and
* 1 instance of Geoanalytics (note that geoanalytics instances is always =1, only gos instances can go beyond 1)
on a production.

Namely geoanalytics, gos1 and gos2

Then, you need to have on gos1 and gos2 the following:

  • a tomcat (smartgears enabled)
  • a geoserver (within tomcat or standalone)
  • the gos database created on previous chapter by the scripts (postgres + gis + the data)
  • the GeospatialOperationsService war deployed within tomcat

Then you need to have on geoanalytics the following

  • what you already had regarding the databases (postgres + gis + the data)
  • apply the scripts for geoanalytics, as described on previous step (Setting up the Geoanalytics database for version 4.4)
  • NO geoserver is needed anymore for geoanalytics, since gos now manage the geroservers, so you can remove it.