Skip to content

2. Setup

Uroš Preložnik edited this page Jan 6, 2021 · 56 revisions

1. Get the code

Download latest release and move the contents inside release name to /var/www/html/gisapp/ (create necessary folders manually) or use GIT:

cd /var/www/html/
git clone https://github.com/uprel/gisapp.git

Checkout specific version, example:

cd gisapp
git checkout v1.8.2

At the end you need such file structure:

/var/www/html/gisapp/:
- _demo
- _scripts
- _setup
- admin
- client
- client_common
- client_mobile
- plugins
- vendor
- index.php
- README.md

Example of windows installation folder: c:\xampp\htdocs\.

2. Apache configuration

Windows users read this post.

Copy Apache configuration file to conf-available folder

cp /var/www/html/gisapp/_setup/gisapp.conf /etc/apache2/conf-available/

Add this 2 lines to /etc/apache2/sites-available/000-default.conf (inside VirtualHost tag)

Include conf-available/serve-cgi-bin.conf
Include conf-available/gisapp.conf

Reload configuration

service apache2 reload

3. User for accessing database

On Windows you can skip this part and simply create new database with pgAdminIII and just run setup.sql (read next part).

First it is recommended that you are using different user for working with database instead of default postgres. If you have to create new PGSQL user, open terminal:

sudo su - postgres

createuser -d -E -i -l -P -r -s newuser

Be sure to change newuser to desired username

Enter new password when prompted

Log out as postgres user

exit

4. Create database

Log in to psql, create new database and run setup script. Database name used in this setup is gisapp. Change newuser to your PGSQL user.

sudo -u postgres psql

CREATE DATABASE gisapp WITH OWNER = newuser ENCODING = 'UTF8';

ALTER DEFAULT PRIVILEGES GRANT ALL ON tables TO newuser;
ALTER DEFAULT PRIVILEGES GRANT ALL ON sequences TO newuser;
ALTER DEFAULT PRIVILEGES GRANT ALL ON functions TO newuser;
ALTER DEFAULT PRIVILEGES GRANT ALL ON routines TO newuser;
ALTER DEFAULT PRIVILEGES GRANT ALL ON types TO newuser;
ALTER DEFAULT PRIVILEGES GRANT ALL ON schemas TO newuser;

\connect gisapp

\i /var/www/html/gisapp/_scripts/_setup.sql

Just a simple test to see if everything is OK. Type:

SELECT name FROM layers;

You should get something like this:

gisapp=# SELECT name FROM layers;
     name     
--------------
 google_map
 google_sat
 mapquest_map
(3 rows)

Quit with: \q

5. Settings

You must prepare settings for server side and for client side from template files. Settings are not part of repository so you can simply overwrite everything when doing updates with new version and that will not delete your own configuration.

Server side - settings.php

Copy settings_template.php to settings.php:

cp /var/www/html/gisapp/admin/settings_template.php /var/www/html/gisapp/admin/settings.php

For Windows use settings_windows.php as template. Make sure to check and edit Apache port!

Open settings.php and insert correct values for database, user and project location:

//database connection
define('DB_CONN_STRING','pgsql:host=localhost;port=5432;dbname=gisapp');

//db user
define('DB_USER','username');
define('DB_PWD','password');

//project location
define('PROJECT_PATH','/var/www/html/gisapp/_demo/');

//qgis server
define('QGISSERVERURL','http://localhost/cgi-bin/qgis_mapserv.fcgi');

Client side - settings.js

Similar as above you must copy settings-template.js to settings.js in /client_common folder. No changes are necessary to use default options.

cp /var/www/html/gisapp/client_common/settings-template.js /var/www/html/gisapp/client_common/settings.js

Read client settings documentation docs/Eqwc.settings.html

6. Project structure

You have 3 options how to store and organize projects in your filesystem:

  1. All projects inside folder defined with PROJECT_PATH. This was only option before 1.4 release.
  2. In PROJECT_PATH you create subfolder with each client name as it is in database. Then you can store projects per each client in client subfolder.
  3. Write complete path to project in database. Look Managing database chapter under Projects.

7. Test HelloWorld project

Navigate your browser to http://localhost/gisapp/helloworld

Login as default user:

user: admin
pass: admin

Now you can continue with adding new users and projects with Managing Database.