Skip to content

Commit

Permalink
chore(readme): Update to mention useProxy and minor corecctions
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian authored and akofink committed Aug 23, 2021
1 parent 68d287d commit 9d712ba
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ UI application for Red Hat Insights Compliance.

## Running the frontend

This application requires the use of [Insights Proxy](https://github.com/RedHatInsights/insights-proxy), which is configured with default routes that proxy a staging environment for services that are not available locally.
The frontend itself will run via the `webpack-dev-server`.
This application requires the use of [useProxy](https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#useproxy),
which serves the frontend and is configured with default routes that proxy a staging environment for services that are not available locally.

Both can be run either manually and separately or in a container setup.
It can be run either locally or in a container setup.

Both will require to have hostnames like `ci.foo.redhat.com` resolve to the local host.
[Insights Proxy](https://github.com/RedHatInsights/insights-proxy/blob/master/scripts/patch-etc-hosts.sh) provides a script to patch the `/etc/hosts` file for this purpose.
Expand All @@ -24,7 +24,7 @@ $ npm run start:proxy
$ npm run start:proxy:beta # Will run the UI with beta chrome
```

### In containers (recommended)
### In containers

To run the container setup either Podman or Docker and their compose commands can be used to

Expand All @@ -48,23 +48,6 @@ To run tests or lint your code you might want to run a shell container, this can

To configure the proxy to use local services the `.env` contains a few `LOCAL_` variables that can be uncommented and adjusted.

### Running on localhost

To run a [insights-proxy](https://github.com/RedHatInsights/insights-proxy) follow the preparation steps, to then be able and run the following **within** this repositories directory.

```shell
$ SPANDX_CONFIG="./config/spandx.config.js" bash $PROXY_PATH/scripts/run.sh
```

This will start a proxy with proper configuration for this frontend.

The frontend itself can be started with `npm run start` once all dependencies are install.

```shell
$ npm install # installs all packages
$ npm run start # starts webpack bundler and serves the files with webpack dev server
```

## Code Notes

### Technology stack
Expand All @@ -80,6 +63,7 @@ ESlint is configured with standards to follow and can be checked via:

```shell
$ npm run lint
$ npm run lint:js:fix # Fixes linting issues
```

The CI pipeline is also setup to validate pull requests.
Expand All @@ -89,8 +73,7 @@ The CI pipeline is also setup to validate pull requests.
* Patternfly (based) components should always be preferred
* Prefer functional components and [hooks](https://reactjs.org/docs/hooks-intro.html) over class components
* The [insights-frontend-components](https://www.npmjs.com/package/@red-hat-insights/insights-frontend-components) package is included to provide components shared across the Insights Platform.
* [Insights Chrome](https://github.com/RedHatInsights/insights-chrome) which provides header and sidebar, as well as authentication and related functions, which is injected/included via
[insights-proxy](https://github.com/RedHatInsights/insights-chrome)
* [Insights Chrome](https://github.com/RedHatInsights/insights-chrome) which provides header and sidebar, as well as authentication and related functions, which is injected/included via webpack-dev-servers `useProxy`.

#### Inventory Components

Expand All @@ -112,11 +95,10 @@ Some components are "hot loaded" via [Insights Chrome](https://github.com/RedHat

### Testing

Tests use [jest](https://jestjs.io/) and [enzyme](https://github.com/enzymejs/enzyme).
Tests use [jest](https://jestjs.io/) and [enzyme](https://github.com/enzymejs/enzyme) and the (React) (Testing Library)[https://testing-library.com].
Each component should have at least on test to verify it still renders correctly with changes.
The tests for an component should be in a file referencing the component filename and have `.test` appended (`_COMPONENT_NAME_.test.js`).


They run on every PR and can locally be executed with:

```shell
Expand All @@ -136,6 +118,16 @@ $ npm run test -- -u
This repository has [dependabot](https://dependabot.com/) configured in order to update (some) packages automatically via a pull request.
Occasionally these updates will fail snapshot tests and require to update the snapshots as mentioned in the "Testing" section.

#### Bumping Patternfly and RedHatServices packages

Two common sets of packages that should be updated regularly are packages from RedHatServices and Patternfly.
For these there are two npm tasks to update them in bulk:

```
$ npm run bump:redhatservices
$ npm run bump:patternfly
```

#### Running Sonarqube

Follow instructions to set up self-signed certs, as described [here](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/).
Expand Down

0 comments on commit 9d712ba

Please sign in to comment.