===================
Water Quality Portal User Interface
This application should be built using python 3.6.x and node version > 8.x.x.
Two containers are provided - one for node-based build tooling, the second for a Python server container.
docker-compose build
The Docker Compose configuration provides a default application configuration
suitable for local development. If you would like to modify the configuration
(see server/config.py
), set the appropriate environment
variables in the local.env
file in the root directory of the project. The
Geoserver Proxy requires a Geoserver URL. Example local.env
file:
WQP_MAP_GEOSERVER_ENDPOINT=<url to Geoserver>
SITES_MAP_GEOSERVER_ENDPOINT=<url to ogcproxy>
SLD_ENDPOINT=<url to SLD endpoint>
CODES_ENDPOINT=<url to lookup codes endpoint>
SEARCH_QUERY_ENDPOINT=<url to search query endpoint - should add with '/'
PUBLIC_SRSNAMES_ENDPOINT=<url to public srsnames endpoint>
NLDI_SERVICES_ENDPOINT=<url to NLDI>
In addition are the following optional environment variables that may be used:
WSGI_STR=<this string will be removed when using really URLS. Defaults to empty string
GA_TRACKING_CODE=<google analytics code, defaults to empty string
NLDI_DISABLED=<include this if NLDI feature should be disabled>
REDIS_CONFIG=<Should be in form: db:password@host:port or absent>
CACHE_TIMEOUT=<integer timeout or don't include to have no timeout>
ROBOTS_WELCOME=<include if you want to allow robot crawling>
LOCAL_BASE_URL=<only needed if url mapping requires it>
# Run in the foreground
docker-compose up
# Run in the background
docker-compose up -d
# Run just the Python dev server on port 5050
docker-compose up server
# Run just the node.js build server on port 9000
docker-compose up assets
# Run Python server tests
docker-compose run server make test
# Run Javascript tests
docker-compose run assets npm test
Application configuration may be specified by creating an instance config in
server/instance/config.py
. This configuration augments the default one.
The make devenv target will copy a sample, server/instance/config.py.sample
,
as a convenience if one doesn't exist. By default these will point to production services.
You will need to fill in the url for the geoserver endpoint, WQP_MAP_GEOSERVER_ENDPOINT
The repository contains a make target to configure a local development environment:
make devenv
To manually configure your environment, please see the READMEs of each separate project.
To run each dev server individually:
cd server && make watch
cd assets && make watch
See the specific project READMEs for additional information, including how to use Redis and Celery with local development.
To run all project tests:
make test
make clean ; clean build artifacts
make cleanenv ; clean environment configuration and build artifacts
make
supports chaining targets, so you could also make clean watch
, etc.