Coder Social home page Coder Social logo

mbucknell / pubswh-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from usgs/pubswh-ui

0.0 1.0 0.0 95.01 MB

Publications Warehouse UI - both public facing and manager interface

Home Page: https://pubs.er.usgs.gov/

License: Other

Makefile 0.32% JavaScript 36.32% HTML 44.63% CSS 1.38% Python 17.24% Dockerfile 0.11%

pubswh-ui's Introduction

USGS Publications Warehouse User Interface

Build Status Codacy Badge codecov

The Pubs Warehouse provides access to over 150,000 publications written by USGS scientists over the century-plus history of the bureau.

This repo contains the front-end components of the Publications Warehouse:

  • server: A Flask web application that is used to create server-rendered pages
  • assets: Client-side Javascript, CSS, images, etc.

This application should be built using Python 3.X and Node.js version > 10.x.x.

Local Development - Makefile configuration

Application configuration may be specified by creating an instance config in server/instance/config.py. This configuration overrides variables in the default one (server/config.py). The make env target will copy a sample, server/config.py.sample, as a convenience if one doesn't exist. By default these will point to production services.

Install dependencies

The repository contains a make target to configure a local development environment:

make env

To manually configure your environment, please see the READMEs of each separate project.

Development server

To run all development servers in a watch mode at the same time, use the make target:

make watch

... and to run each dev server individually:

make watch-server
make watch-assets

The make env command will create a config.py in the server/instance directory if one does not exist by copy the file server/config.py.sample to the directory. Any config variable defined in server/config.py can be overridden by assigning a value to that variable in the server/instance/config.py file. Please note that variables that are required (as described in the Docker section below) must have values in server/instance/config.py

See the specific project READMEs for additional information.

Run tests

To run all project tests:

make test

Production build

make build

Clean targets

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.

Local Development - Docker configuration

Two containers are provided - one for node-based build tooling, the second for a Python server container. You will need to have a clean directory before starting.

make cleanenv

Docker Build

docker-compose build

There are three build_args that can be used to add additional arguments to the npm, bower, and pip install steps

--build-arg npm_args=--options --build-arg=pip_install_args=--options --build-arg bower_args=--config.options

Docker Development server

You will need to provide the environment variables needed to run the application. The environment variables that can be read can be found in server/config.py. Set the appropriate environment variables in the local.env file in the root directory of the project. Note that if server/instance/config.py is not empty, it's contents will override the environment variables set below. If you may use that rather than create local.env. Example local.env file:

SECRET_KEY=<should not be public>
PUB_URL=<url to pubs service>
LOOKUP_URL=<ulr to pubs lookup service>
BASE_SEARCH_URL=<url to publications search service>
JSON_LD_ID_BASE_URL=<url to use when constructing JSON responses that have a 'url' attribute>
PREVIEW_ENDPOINT_URL=<url to publication that are not public>
PUBSAUTH_CLIENT_ID=<pubs auth client id>
PUBS_AUTH_CLIENT_SECRET=<pubs auth client secret (may be empty)>
PUBSAUTH_ACCESS_TOKEN_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect/token
PUBSAUTH_AUTHORIZE_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect/auth
PUBSAUTH_API_BASE_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect
STATIC_ROOT=http://localhost:9000

In addition, the following optional environment variables should be set appropriately. If not set they will be the empty string unless otherwise noted

DEBUG=<any string to turn on debug mode>
JS_DEBUG=<any string to turn on javascript debugging>
LOGGING_ON=<any string to turn on logging>
NO_VERIFY_CERT=<any string to not verify certs>
RECAPTCHA_PRIVATE_KEY=<private string for recaptcha>
WSGI_STR=<string to be appended to routes - typically needed at EROS>
GOOGLE_ANALYTICS_CODE=<GA code>
GOOGLE_WEBMASTER_TOOLS_CODE=<Google webmaster tools code string>
ANNOUNCEMENT_BLOCK=<string for general announcements>
ROBOTS_WELCOME=<any string to allow robots to scan pages>
CACHE_TYPE=<set to redis if using redis cache>
CACHE_REDIS_HOST=<set to redis host>
CACHE_KEY_PREFIX=<set to prefix to use for caching>
REDIS_CONFIG=<db:password@host:port>
IMAGES_CACHE=<path to image cache for thumbnails>
SCIENCEBASE_PARENT_UUID=<sciencebase foler id for publications warehouse>
GA_KEY_FILE_PATH=< path to the location of the google analytices service account key>
ALTIMETRIC_KEY=<altimetric key>
ASSET_MANIFEST_PATH=<If using hashed assets, PATH_IN_CONTAINER/static/assets/rev-manifest.json
MAIL_SERVER=<Will default to localhost>
# 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

Docker run tests

# Run Python server tests
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run -u root server

# Run Javascript tests
docker-compose -f docker-compose.yml -f docker-compose.ci.yml run assets

pubswh-ui's People

Contributors

mbucknell avatar jkreft-usgs avatar ayan-usgs avatar danielnaab avatar ssoper-usgs avatar skochaver-usgs avatar mwernimont avatar dependabot-preview[bot] avatar abriggs-usgs avatar mamcderm-usgs avatar brandonserna avatar joshbeard avatar orosz-usgs avatar dsteinich avatar ldecicco-usgs 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.