{"id":23691208,"url":"https://github.com/usgs/pubswh-ui","last_synced_at":"2025-10-24T10:28:54.421Z","repository":{"id":48271435,"uuid":"198898349","full_name":"usgs/pubswh-ui","owner":"usgs","description":"Publications Warehouse UI - both public facing and manager interface","archived":false,"fork":false,"pushed_at":"2021-08-03T19:51:27.000Z","size":98329,"stargazers_count":3,"open_issues_count":37,"forks_count":10,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-14T13:53:08.815Z","etag":null,"topics":["flask","pubswh"],"latest_commit_sha":null,"homepage":"https://pubs.er.usgs.gov/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usgs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T20:39:14.000Z","updated_at":"2024-03-12T12:44:55.000Z","dependencies_parsed_at":"2022-09-19T01:00:50.156Z","dependency_job_id":null,"html_url":"https://github.com/usgs/pubswh-ui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usgs%2Fpubswh-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usgs%2Fpubswh-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usgs%2Fpubswh-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usgs%2Fpubswh-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usgs","download_url":"https://codeload.github.com/usgs/pubswh-ui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231807368,"owners_count":18429521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","pubswh"],"created_at":"2024-12-30T02:55:59.527Z","updated_at":"2025-10-24T10:28:54.192Z","avatar_url":"https://github.com/usgs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# USGS Publications Warehouse User Interface\r\n\r\n[![Build Status](https://travis-ci.com/usgs/pubswh-ui.svg?branch=master)](https://travis-ci.com/usgs/pubswh-ui)\r\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1f1df7eea3b04596bdb66fcaccb095e1)](https://www.codacy.com/app/usgs_wma_dev/pubswh-ui?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=usgs/pubswh-ui\u0026amp;utm_campaign=Badge_Grade)\r\n[![codecov](https://codecov.io/gh/usgs/pubswh-ui/branch/master/graph/badge.svg)](https://codecov.io/gh/usgs/pubswh-ui)\r\n\r\nThe Pubs Warehouse provides access to over 150,000 publications written by USGS\r\nscientists over the century-plus history of the bureau.\r\n\r\nThis repo contains the front-end components of the Publications Warehouse:\r\n\r\n- [`server`](server): A Flask web application that is used to create server-rendered pages\r\n- [`assets`](assets): Client-side Javascript, CSS, images, etc.\r\n\r\nThis application should be built using Python 3.X and Node.js version \u003e 10.x.x.\r\n\r\n## Local Development - Makefile configuration\r\nApplication configuration may be specified by creating an instance config in server/instance/config.py. This \r\nconfiguration overrides variables in the default one (server/config.py). The make env target will copy a \r\nsample, server/config.py.sample, as a convenience if one doesn't exist. By default these will point to \r\nproduction services.\r\n\r\n### Install dependencies\r\n\r\nThe repository contains a make target to configure a local development environment:\r\n\r\n```bash\r\nmake env\r\n```\r\n\r\nTo manually configure your environment, please see the READMEs of each separate project.\r\n\r\n### Development server\r\n\r\nTo run all development servers in a watch mode at the same time, use the make target:\r\n\r\n```bash\r\nmake watch\r\n```\r\n\r\n... and to run each dev server individually:\r\n\r\n```bash\r\nmake watch-server\r\nmake watch-assets\r\n```\r\n\r\nThe make env command will create a config.py in the ```server/instance``` directory if one\r\ndoes not exist by copy the file ```server/config.py.sample``` to the directory. Any config\r\nvariable defined in ```server/config.py``` can be overridden by assigning a value\r\nto that variable in the ```server/instance/config.py``` file. Please note that\r\nvariables that are required (as described in the Docker section below) must have\r\nvalues in ```server/instance/config.py```\r\n\r\nSee the specific project READMEs for additional information.\r\n\r\n- [Flask Server README](./server/README.md)\r\n- [Assets README](./assets/README.md)\r\n\r\n### Run tests\r\n\r\nTo run all project tests:\r\n\r\n```bash\r\nmake test\r\n```\r\n\r\n### Production build\r\n\r\n```bash\r\nmake build\r\n```\r\n\r\n### Clean targets\r\n\r\n```bash\r\nmake clean      ; clean build artifacts\r\nmake cleanenv   ; clean environment configuration and build artifacts\r\n```\r\n\r\n`make` supports chaining targets, so you could also `make clean watch`, etc.\r\n\r\n## Local Development - Docker configuration\r\n\r\nTwo containers are provided - one for node-based build tooling, the second for\r\na Python server container. You will need to have a clean directory before starting.\r\n```bash\r\nmake cleanenv\r\n```\r\n### Docker Build\r\n\r\n```bash\r\ndocker-compose build\r\n```\r\nThere are three build_args that can be used to add additional arguments to the npm, bower, and pip install steps\r\n```text\r\n--build-arg npm_args=--options --build-arg=pip_install_args=--options --build-arg bower_args=--config.options\r\n```\r\n\r\n### Docker Development server\r\n\r\nYou will need to provide the environment variables needed to run the application. The environment variables that\r\ncan be read can be found in ```server/config.py```. Set the appropriate environment\r\nvariables in the `local.env` file in the root directory of the project.  Note that if ```server/instance/config.py```\r\nis not empty, it's contents will override the environment variables set below. If you may use that rather than create\r\n```local.env```. Example `local.env` file:\r\n```text\r\nSECRET_KEY=\u003cshould not be public\u003e\r\nPUB_URL=\u003curl to pubs service\u003e\r\nLOOKUP_URL=\u003culr to pubs lookup service\u003e\r\nBASE_SEARCH_URL=\u003curl to publications search service\u003e\r\nJSON_LD_ID_BASE_URL=\u003curl to use when constructing JSON responses that have a 'url' attribute\u003e\r\nPREVIEW_ENDPOINT_URL=\u003curl to publication that are not public\u003e\r\nPUBSAUTH_CLIENT_ID=\u003cpubs auth client id\u003e\r\nPUBS_AUTH_CLIENT_SECRET=\u003cpubs auth client secret (may be empty)\u003e\r\nPUBSAUTH_ACCESS_TOKEN_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect/token\r\nPUBSAUTH_AUTHORIZE_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect/auth\r\nPUBSAUTH_API_BASE_URL=https://www.sciencebase.gov/auth/realms/PubsWH/protocol/openid-connect\r\nSTATIC_ROOT=http://localhost:9000\r\n```\r\n\r\nIn addition, the following optional environment variables should be set appropriately. If not set they will be\r\nthe empty string unless otherwise noted\r\n```text\r\nDEBUG=\u003cany string to turn on debug mode\u003e\r\nJS_DEBUG=\u003cany string to turn on javascript debugging\u003e\r\nLOGGING_ON=\u003cany string to turn on logging\u003e\r\nNO_VERIFY_CERT=\u003cany string to not verify certs\u003e\r\nRECAPTCHA_PRIVATE_KEY=\u003cprivate string for recaptcha\u003e\r\nWSGI_STR=\u003cstring to be appended to routes - typically needed at EROS\u003e\r\nGOOGLE_ANALYTICS_CODE=\u003cGA code\u003e\r\nGOOGLE_WEBMASTER_TOOLS_CODE=\u003cGoogle webmaster tools code string\u003e\r\nANNOUNCEMENT_BLOCK=\u003cstring for general announcements\u003e\r\nROBOTS_WELCOME=\u003cany string to allow robots to scan pages\u003e\r\nCACHE_TYPE=\u003cset to redis if using redis cache\u003e\r\nCACHE_REDIS_HOST=\u003cset to redis host\u003e\r\nCACHE_KEY_PREFIX=\u003cset to prefix to use for caching\u003e\r\nREDIS_CONFIG=\u003cdb:password@host:port\u003e\r\nIMAGES_CACHE=\u003cpath to image cache for thumbnails\u003e\r\nSCIENCEBASE_PARENT_UUID=\u003csciencebase foler id for publications warehouse\u003e\r\nGA_KEY_FILE_PATH=\u003c path to the location of the google analytices service account key\u003e\r\nALTIMETRIC_KEY=\u003caltimetric key\u003e\r\nASSET_MANIFEST_PATH=\u003cIf using hashed assets, PATH_IN_CONTAINER/static/assets/rev-manifest.json\r\nMAIL_SERVER=\u003cWill default to localhost\u003e\r\n```\r\n```bash\r\n# Run in the foreground\r\ndocker-compose up\r\n\r\n# Run in the background\r\ndocker-compose up -d\r\n\r\n# Run just the Python dev server on port 5050\r\ndocker-compose up server\r\n\r\n# Run just the node.js build server on port 9000\r\ndocker-compose up assets\r\n```\r\n\r\n### Docker run tests\r\n\r\n```bash\r\n# Run Python server tests\r\ndocker-compose -f docker-compose.yml -f docker-compose.ci.yml run -u root server\r\n\r\n# Run Javascript tests\r\ndocker-compose -f docker-compose.yml -f docker-compose.ci.yml run assets\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusgs%2Fpubswh-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusgs%2Fpubswh-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusgs%2Fpubswh-ui/lists"}