wechange-eg / cosinnus-devops

Devops repository for the WECHANGE suite. Your starting point to contribute to WECHANGE.
GNU Affero General Public License v3.0
22 stars 9 forks source link

wechange

This is the base project for wechange. It is mainly a configurable shell for the actual wechange apps, which are pluggable components. Most of the actual code resides in "cosinnus-core". See requirements_staging.txt for a full list of internal apps.

Note: The wechange project is often refered to as "neww" in code and imports and the internal apps and python Objects are named "cosinnus" for historical reasons.

Option A: Setup local development with Docker

git submodule init
git submodule update
docker-compose up

Option B: Setup local development manually

This will set up a local development environment, getting you ready to work on wechange and all its internal apps.

Install PostgresSql

Note: this step is necessary!

Install the GDAL library

Install Python, Pip and Virtualenv

Install Git

Create a virtualenv and project folders

Get the cosinnus-devops and cosinnus source code

Set up the local wechange source and install all dependencies

Notes:

Configure up your local wechange projects

One-Time Django Setup

First-Time Wechange Setup

Compile the JS client using webpack

This will compile the client.js JS client, which is used for the Map/Tile View and the v2 User Dashboard and Navbar. After setting up your environment, you need to do this at least once.

Install Elasticsearch on your system

If you are not planning to work with the map or “search” you can skip this step, otherwise it is required.

    """
    HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
        },
    }
    """
    # enable this haystack setting if you have actually set up elastic search on your system

    HAYSTACK_CONNECTIONS = {
        'default': {
            'ENGINE': 'cosinnus.backends.RobustElasticSearchEngine',  # replaces 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
            'URL': 'http://127.0.0.1:9200/',
            'INDEX_NAME': 'wechange',
        },
    }

First-Time Wagtail Setup (no longer recommended)

This is an optional step for your your local environment. If you choose not to do this, your root URL will stay blank, but all other URLs will work fine.

We use Wagtail as CMS, and it will show up automatically as a root URL dashboard. You can skip this step configuring it, but all you will see on your root URL will be a blank page. Navigate to a page like http://localhost:8000/projects/ to see the wechange-page.

Check if you're up-and-running and create the Forum Group

(Alternative) Using MariaDB instead of Postgres

To use MariaDB instead of Postgres locally, you will need to modify the following migrations files

In both, replace

django.contrib.postgres.fields.jsonb.JSONField

with

django_mysql.models.JSONField

Git Structure

Cosinnus-devops pulls Cosinnus-core and all cosinnus apps in directly from their Git repositories. See requirements_staging.txt for the repo locations and used branches.

Testing Subportals

WECHANGE supports sub-portals that share the same database and can display the contents of other portals in the same "pool" in searches and map views. For this, create a new CosinnusPortal in the django admin, enter its portal name, site-id and settings in config_subportal.py.

Run the new portal using ./manage.py --cosinnus-portal <portalname>.

For multiple subportals, duplicate the wsgi_subportal.py and config_subportal.py.

Acknowledgements

wechange uses the Browserstack Testing Suite for Browser Testing.

BrowserStack