Skip to content

Building instructions

Lorenzo Pini edited this page Mar 30, 2017 · 37 revisions

Cloning the repo

Get the source as usual from github.

The git command line should be something like

git clone git@github.com:geosolutions-it/geostore.git geostore

Quick GeoStore build and run with H2 in-memory DB#

Geostore is released with a default configuration that use an in-memory DB for quick running, usefull for evaluation and tests. If your git working directory is called geostore, enter in the sub directory src and type the command:

#geostore/src$ mvn clean install

for build geostore with the default profile wich provide support only for H2 DBMS configured to run in-memory.

Once you have finished the build process, go into geostore\src\web\app and type the command:

#geostore/src/web/app$ mvn jetty:run

this command launch geostore in jetty Servlet container, you can see the exposed service at URL:

http://localhost:8181/geostore/rest

Obviously you can also take the created war archive in your local .m2 repository and deploy it on other servlet containers.

Building GeoStore with postgres support#

Create the GeoStore DB in Windows

In order to be able to run the psql and createdb commands, you must first set in the "PATH" environment variable the path to the /bin folder of Postgres. The follow commands are referred to the Postgres use.

  1. Create a PostgreSQL DB called "geostore" (PostGis support is not required).
    You may need to run these commands as user postgres in the windows Console.
C:\currentDir>createdb -U postgres geostore
  1. Run the sql script doc/sql/001_setup_db.sql on geostore db; it will create the users:
  • geostore with pw geostore

  • geostore_test with pw geostore_test

    and schemas `geostore` and `geostore_test`.
    You may need to run these commands as user `postgres`.
    
C:\currentDir>psql -U geostore -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/001_setup_db.sql
  1. Run the sql script doc/setup/sql/002_create_schema_postgres.sql on geostore db, geostore schema; it will create the base tables, indices, etc.
C:\currentDir>psql -U geostore -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/002_create_schema_postgres.sql

Note that you are logging in postgres as usergeostore, so you will be asked for user password, that's set as geostore as stated above.

  1. Run the sql script doc/setup/sql/002_create_schema_postgres.sql on geostore db, geostore_test schema; it will create the base tables, indices, etc.
C:\currentDir>set PGOPTIONS="--search_path=geostore_test"
C:\currentDir>psql -U geostore_test -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/002_create_schema_postgres.sql

Note that you are logging in postgres as usergeostore_test, so you will be asked for user password, that's set as geostore_test as stated above.

Create the GeoStore DB in Linux###

The follow commands are referred to the Postgres use.

  1. Create a PostgreSQL DB called "geostore" (PostGis support is not required).
    You may need to run these commands as user postgres.
createdb geostore
  1. Run the sql script doc/sql/001_setup_db.sql on geostore db; it will create the users:
  • geostore with pw geostore

  • geostore_test with pw geostore_test

    and schemas `geostore` and `geostore_test`. 
    You may need to run these commands as user `postgres`.
    
psql -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/001_setup_db.sql
  1. Run the sql script doc/sql/002_create_schema_postgres.sql on geostore db, geostore schema; it will create the base tables, indices, etc. The geostore_test schema will be automatically recreated during tests.
psql -U geostore -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/002_create_schema_postgres.sql

Note that you are logging in postgres as usergeostore, so you will be asked for user password, that's set as geostore as stated above.

  1. Run the sql script doc/sql/002_create_schema_postgres.sql on geostore db, geostore_test schema; it will create the base tables, indices, etc.
psql -U geostore_test -d geostore -f YOUR_GEOSTORE_DIR/doc/sql/002_create_schema_postgres.sql

Note that you are logging in postgres as usergeostore_test, so you will be asked for user password, that's set as geostore_test as stated above.

Building GeoStore with Oracle support#

After you have installed the Oracle DMBS (10g or 11g) in your system you have to following the steps below to obtain a simple installation:

  1. Access to the Oracle Enterprise Manager control page at:

    YOUR_HOST:1158/em

    and go to the 'Administration' section.

  2. Create a new User named GEOSTORE with password 'geostore' and sufficient rights to read and write own schema. For example you can enable CONNECT and DBA rules.

  3. Connect to the database using a proper tool like DbVisualizer or Oracle SQL Developer using the newly created user with:

     - username: geostore
     - password: geostore
    
  4. Run the sql script doc/sql/002_create_schema_oracle.sql on GEOSTORE schema using the DB tool previously installed; It will create the base tables, indices, etc.

Build the webapp

Enter the src/ directory and launch:

  1. If you are using PostgreSQL

    mvn clean install -Dovrdir=postgres -Ppostgres
    
  2. If you are using Oracle

    mvn clean install -Dovrdir=oracle -Poracle
    

    Due to Oracle license restriction, there is no public Maven repository provides Oracle JDBC driver. To use the Oracle JDBC driver with Maven, you have to install it manually into your Maven local repository.

    Without this JDBC driver installed, the previous mvn command will not work !

    Below the steps to follow to add an Oracle JDBC driver ( ojdbc6.jar ) into your Maven local repository:

    • Download manually the Oracle JDBC driver from [Oracle web site](http://www.oracle.com/technetwork /database/features/jdbc/index-091264.html).

    • Install the Oracle jdbc driver using the command below:

      mvn install:install-file -Dfile={YOU_JDBC_DIR/ojdbc6.jar} -DgroupId=com.oracle -DartifactId=ojdbc6    
      -Dversion=11.2.0 -Dpackaging=jar
      

You may want to use the profile extjs in order to have services offering output in EXT json format ( this is necessary mainly when you use MapStore ). For example:

mvn clean install -Dovrdir=postgres -Pextjs,postgres

The maven install command will create a .war file:

  • src/web/app/target/geostore.war : the geostore service

It will also make available the GeoStore client jar as maven artifact

   <dependency>
      <groupId>it.geosolutions.geostore</groupId>
      <artifactId>geostore-rest-client</artifactId>
      <version>1.0-SNAPSHOT</version>
   </dependency>

(The current code may have a later version for the client)

Run the webapp

You can run the webapp using the embedded Jetty http server.

In order to run GeoStore, enter into the directory src/web/app and run the command

mvn jetty:run

adding the extjs profile -Pextjs if needed.

Example for GeoStore with ExtJS and PostgreSQL support:

mvn jetty:run -Dovrdir=postgres -Pextjs,postgres