Skip to content

giranm/pd-live-react

Repository files navigation

PagerDuty Live

This repository hosts the source code for PagerDuty Live, an open-source, single page application which enables organisations to manage their PagerDuty incidents in real-time through a unified console view.

Live URL: https://giranm.github.io/pd-live-react/

⚠️ Disclaimer

This project is not officially supported by PagerDuty and therefore no issues can be reported to or resolved by PagerDuty Support. This is an open-source project designed to be used in a safe/test environment before users can leverage on their primary domains.

Screenshot

Screenshot 2021-11-05 at 18 35 16

Development

Register PagerDuty App

If you wish to maintain + deploy your own version of PagerDuty Live, we recommend registering a new OAuth app as follows:

  • Within PagerDuty developer mode, register a new app
  • Add OAuth 2.0 workflow to the app and update the URL to the app host URL

Local Development

  1. Install NodeJS v16.19 via asdf install / nvm

  2. $ git clone repo to desired destination and $ cd pd-live-react into directory

  3. Create .env file in project root with overriding configuration (see section below for details)

  4. Install dependencies with $ yarn install and run application locally using $ yarn start
    The app will be available under http://localhost:3000/pd-live-react

Environment Overrides

The following optional parameters can be used in a .env file to override PagerDuty Live during $ yarn start:

Parameter Usage
REACT_APP_PD_ENV PagerDuty Live Environment Tag; defaults to localhost-dev if not set
REACT_APP_PD_OAUTH_CLIENT_ID PagerDuty OAuth App client ID (created upon registering app)
REACT_APP_PD_OAUTH_CLIENT_SECRET PagerDuty OAuth App client secret (created upon registering app)
REACT_APP_PD_USER_TOKEN PagerDuty Personal API Token; this will override OAuth login workflow if set and should be used for integration tests
REACT_APP_PD_SUBDOMAIN_ALLOW_LIST Comma separated list of allowed subdomains (e.g. acme-prod,acme-dev)
REACT_APP_PD_REQUIRED_ABILITY PagerDuty account-level ability required to use application
REACT_APP_DD_APPLICATION_ID Datadog RUM Application ID
REACT_APP_DD_CLIENT_TOKEN Datadog RUM Client Token
REACT_APP_DD_SITE Datadog site (e.g. datadoghq.com)
REACT_APP_DD_SAMPLE_RATE Datadog RUM Sample Rate (e.g. 100)
REACT_APP_DD_TRACK_INTERACTIONS Datadog RUM Track Interactions (e.g. true)
REACT_APP_DD_DEFAULT_PRIVACY_LEVEL Datadog RUM Default Privacy Level (e.g. mask-user-input)

Testing

The following scripts have been created to run unit, component, and integration tests:

  • $ yarn jest (Jest Unit/Component)
  • $ yarn cypress:run:local (Cypress Integration with headless Chromedriver)

Please note that running integration tests will require environment variable REACT_APP_PD_USER_TOKEN set.

The integration tests also assume the PagerDuty account associated with the above user token has been setup with the following Terraform environment.

Versioning & Release

To prepare PagerDuty Live for release, the current workflow should be carried out:

  1. Checkout to develop branch and verify if it's stable - i.e. no test and linting failures.

  2. Update version information in package.json using npm version - example commands given below:

    • Bumping patch version for beta release
      $ npm --no-git-tag-version version preminor --preid beta
      v0.1.0-beta.0
      
    • Bumping minor version for main release
      $ npm --no-git-tag-version version minor
      v0.2.0
      
  3. Update application code version using $ yarn genversion

  4. Prepare the appropriate release branch via $ git checkout -b release/<VERSION> (following above semver)

  5. Stage modified files, commit, and push changes upstream:

    $ git add .
    $ git commit -m "Publishing release <VERSION>"
    $ git push --set-upstream origin release/<VERSION>
    
  6. Raise pull requests to merge into main branch.

  7. Build static bundle via $ yarn build or use appropriate CI/CD workflow.

License

MIT License

Copyright (c) 2021 Giran Moodley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.