Code to generate and deploy the dashboard for the Earthdata Pub API.
- Contributing
- Configuration
- Installing
- Running
- Building
- Deploying
- Testing
- Branching
- Releasing
- Documentation
See CONTRIBUTING.md for instruction for contributing to
the EDPub project. Be sure to read that before submitting pull requests.
The dashboard is populated from the Earthdata Pub API. The dashboard has to point to a working version of the Earthdata Pub API before it is installed and built.
The information needed to configure the dashboard is stored at app/src/js/config.
The following environment variables override the default values in config.js.
To locate environment variables, see webpack.common.js:
| Env Name | Description | Default |
|---|---|---|
| APIROOT | the API URL. This must be set by the user. | https://pub.earthdata.nasa.gov/api |
| OVERVIEW_URL | URL of the instructional overview of Earthdata Pub Dashboard | https://pub.earthdata.nasa.gov/ |
| FORMS_URL | URL of the questions and answer forms that are outside of Earthdata Pub Dashboard | https://pub.earthdata.nasa.gov/forms |
| INITIATE_REQUEST_SELECT_DAAC_URL | https://pub.earthdata.nasa.gov/forms/daacs/selection, | |
| SEND_USER_TO_MEDITOR | https://pub.earthdata.nasa.gov/meditor, | |
| AWS_REGION | Region in which Earthdata Pub API is running. | us-west-2 |
| DAAC_NAME | e.g. LPDAAC, | Local |
| STAGE | e.g. PROD, UAT, | development |
| LABELS | gitc or daac localization. | daac |
| AUTH_METHOD | The type of authorization method protecting the Earthdata Pub API. [launchpad or earthdata] | earthdata |
| REQUEST_HIDE_BUTTON_VERBAGE | The hide button verbage displayed on the request detail page. | Withdraw |
| REQUEST_UNHIDE_BUTTON_VERBAGE | The hide button verbage displayed on the request detail page. | Restore |
| KIBANAROOT | <optional> Should point to a Kibana endpoint. Must be set to examine distribution metrics details. | |
| SHOW_DISTRIBUTION_API_METRICS | <optional> Display metrics from Earthdata Pub Distribution API. | false |
| ESROOT | <optional> Should point to an Elasticsearch endpoint. Must be set for distribution metrics to be displayed. | |
| ES_USER | <optional> Elasticsearch username, needed when protected by basic authorization | |
| ES_PASSWORD | <optional> Elasticsearch password,needed when protected by basic authorization | |
| HELP_PAGE_DEFAULT | URL of the instructional how to use Earthdata Pub in Overview | https://pub.earthdata.nasa.gov/data_producer_resources/how_to_use_edpub |
| FILE_UPLOAD_DEFAULT | Turns on and off file-upload functionality | false |
The dashboard uses node v18.14.1. To build/run the dashboard on your local machine, install nvm following the nvm Install & Update Script instructions.
We use npm for local package management to install the requirements, but the first step is to clone the repo!
git clone https://github.com/eosdis-nasa/earthdata-pub-dashboard.git
cd api
nvm install v18.14.1
nvm use
npm installnpm install
npm run startThe Dashboard application is dependent on the EDPub API and Forms. Follow instructions in each repo or the EDPub core repo.
The API Swagger documentation will available at http://localhost:8080/docs/
The Forms application will available at http://localhost:8081/
If you have previously built using docker, you may need to remove docker orphans.
docker-compose down --remove-orphansIf something is not running correctly, or you're just interested, you can view the logs with a helper script, this will print out logs from each of the running docker containers.
npm run view-logsThis can be helpful in debugging problems with the docker application.
A common error is running the dashboard containers when other containers are running on your machine. Just stop that stack and restart the dashboard stack to resolve.
ERROR: for localapi_shim_1 Cannot start service shim: driver failed programming external connectivity on endpoint localapi_shim_1 (7105603a4ff7fbb6f92211086f617bfab45d78cff47232793d152a244eb16feb): Bind for 0.0.0.0:9200 failed: port is already allocated
ERROR: for shim Cannot start service shim: driver failed programming external connectivity on endpoint localapi_shim_1 (7105603a4ff7fbb6f92211086f617bfab45d78cff47232793d152a244eb16feb): Bind for 0.0.0.0:9200 failed: port is already allocatedA permission denied error in an npm run script usually means permissions are
incorrect in node_modules. A quick fix is to delete the directory and
reinstall with npm install.
The Earthdata Pub Dashboard can be built inside of a Docker container, without needing to install any local dependencies.
DAAC_NAME=LPDAAC STAGE=production LABELS=daac APIROOT=https://myapi.com ./bin/build_in_docker.shNOTE: Only the APIROOT environment variable is required.
The compiled files will be placed in the dist directory.
To build the dashboard:
nvm use
[SERVED_BY_EDPUB_API=true] [DAAC_NAME=LPDAAC] [STAGE=production] [LABELS=daac] APIROOT=https://myapi.com npm run buildNOTE: Only the APIROOT environment variable is required.
Earthdata Pub Dashboard versions are distributed using tags in github. You can pull a specific version in the following manner:
git clone https://github.com/eosdis-nasa/earthdata-pub-dashboard.git
cd dashboard
git fetch origin ${tagNumber}:refs/tags/${tagNumber}
git checkout ${tagNumber}Then follow the steps noted above to build the dashboard locally or using Docker.
Deployment is done through Bamboo. The following deprecated instructions are included in case Bamboo becomes unavailable.
First build the site
nvm use
npm run buildThen deploy the dist folder
aws s3 sync dist s3://my-bucket-to-be-used --acl public-readnpm run testFor the integration tests to work, you have to first run the localstack application, launch the localAPI and serve the dashboard first. Run the following commands in separate terminal sessions:
Run background localstack application.
npm run start-localstackServe the dashboard web application (another terminal)
[SHOW_DISTRIBUTION_API_METRICS=true ESROOT=http://example.com APIROOT=http://localhost:8080] npm run serveIf you're just testing dashboard code, you can generally run all of the above commands as a single docker-compose stack.
npm run start-dashboardThis brings up LocalStack, Elasticsearch, the Earthdata Pub localAPI, and the dashboard.
Run the test suite (yet another terminal window)
npm run validate
npm run cypressWhen the cypress editor opens, click on run all specs.
You can run all of the cypress tests locally that circleCI runs with a single command:
npm run e2e-testsThis will stands up the entire stack as well as begin the e2e service that will run all cypress commands and report an exit code for their success or failure. This is primarily used for CircleCI, but can be useful to developers.
Likewise the validation tests can be run with this command:
npm run validation-testsESLint is used for linting. It adheres to the
Airbnb JavaScript Style Guide with a few
exceptions. The configuration can be viewed in eslint.config.json.
Output from these commands in formatted for Bamboo for use in the CI/CD pipeline.
Markdownlint is used for linting Markdown. No markdownlint output is used in the CI/CD pipeline.
The main branch is the branch where the source code of HEAD always reflects
the latest product release. The test branch is the branch where the source code
of HEAD always reflects the latest UAT release. The develop branch is the branch
where the source code of HEAD always reflects the latest merged development changes
for the next release. The develop branch is the branch where we should branch off.
When the source code in the develop branch reaches a stable point and is ready to be released, all of the changes should be merged back into test and then main and then tagged with a release number.
See RELEASE.md.