Code Monkey home page Code Monkey logo

g3w-admin's Introduction

CircleCI

G3W-SUITE

G3W-ADMIN admin server module for G3W-SUITE.

G3W-SUITE works with QGIS-Server LTR versions, so at the moment works with QGIS-Server 2.18.x LTR

The following instructions are for a Ubuntu 16.04 LTS.

Installation of node.js and Yarn

G3W-ADMIN use javacript package manager Yarn and Node.js

sudo apt-get install -y nodejs-legacy npm

for install Yarn follow main installation instructions:

https://yarnpkg.com/en/docs/install#debian-stable

Create virtualenv

Virtualenv

The following instructions are for python 2

Install python pip

sudo apt-get install python-pip

now we can install virtualenvwrapper

sudo pip install virtualenvwrapper

To activate virtuenvwrapper on system login, add follow lines to 'bashrc' config file of your user

nano ~/.bashrc
....
export WORKON_HOME=<path_to_virtualenvs_directory>
source /usr/local/bin/virtualenvwrapper.sh

Virtualenv creation

To create a virtualnenv is sufficent call mkvirtualenv commando follow by the identification name for virtualenv

mkvirtualenv g3wsuite

Install G3W-SUITE

First step is install dev libraries packages for python module to install with requiriments.txt

sudo apt-get install -y \
    libxml2-dev \
    libxslt-dev \
    postgresql-server-dev-all \
    libgdal-dev \
    python-dev

after is necessary install the correct python module for GDAL library, check your version and install correct module

export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal

pip install GDAL==<installed_version or closest>

Set local_config.py file

G3W-ADMIN is a Django application, and to work is necessary set a config.py file. To start copy local_settings.example.py and set the databse and other:

cd g3w-admin/g3w-admin/base/settings
cp local_settings_example.py local_settings.py

set database, media root and session cookies name:

...

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': '<db_name>',
        'USER': '<db_user>',
        'PASSWORD': '<db_user_password>',
        'HOST': '<db_host>',
        'PORT': '<db_port>',
    }
}

...

DATASOURCE_PATH = '<static_path_to_gis_data_source>'

...

MEDIA_ROOT = '<path_to_media_root>'

...

SESSION_COOKIE_NAME = '<unique_session_id>'

With paver commands

G3W-ADMIN has a series of paver CLI commands to administrate the suite. After prepared environment if sufficient invoce paver install task

paver install

Run G3W-SUITE

To run the application with paver

paver start

and for stop

paver stop

G3W-ADMIN is a django application so is possibile run app by standard django manage.py commands

./manage.py runserver

Deploy G3W-SUITE

As other Django application, G3W-SUITE can be deployed by its wsgi capabilities. On the web if simple to find tutorial for deploy a Django application.

The simpler way is to use Apache2 as server WEB and its mod_wsgi module.

Alternative solutions are:

Manual installation steps

The preferred installation is by using the paver script as mentioned above, but in case you need to customize the installation process, here are the build and setup steps:

Build static js code

# Install yarn (requires root):
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | \
    tee /etc/apt/sources.list.d/yarn.list
apt-get update && sudo apt install -y yarn
# Back to unprivileged user, from the repository directory, run:
yarn --ignore-engines --ignore-scripts --prod
nodejs -e "try { require('fs').symlinkSync(require('path').resolve('node_modules/@bower_components'), 'g3w-admin/core/static/bower_components', 'junction') } catch (e) { }"

Make sure build components are available in static and collected later

cd g3w-admin/core/static
ln -s "../../../node_modules/@bower_components" bower_components

Install requirements

Possibily within a virtual env:

pip install -r requirements.tx

Django setup

python manage.py collectstatic --noinput
python manage.py migrate --noinput

Install some fixtures for EPSG and other suite options:

for FIXTURE in 'BaseLayer.json' 'G3WGeneralDataSuite.json' 'G3WMapControls.json' 'G3WSpatialRefSys.json'; do
    python manage.py loaddata  core/fixtures/${FIXTURE}
done

Sync menu tree items (re-run this command in case you installed optional modules and they are not visible in the admin menu tree):

python manage.py sitetree_resync_apps

Continuous integration testing

CI tests are automatically run on CircleCI for the dev branch only.

The Docker compose configuration used in the CI tests is available at docker-compose.yml.

Another configuration for running local tests is provided with docker-compose-local.yml and can also be used for local testing by running:

docker-compose -f docker-compose-local.yml up

The testing image is built from the dependency image and it will run all install and build steps from the local repository.

The dependency image is built from the Dockerfile.deps.

g3w-admin's People

Contributors

wlorenzetti avatar volterra79 avatar giohappy avatar elpaso avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.