|
| 1 | +# CloudForecast Cortex Plugin |
| 2 | + |
| 3 | +View CloudForecast data for your Cortex entities! |
| 4 | + |
| 5 | +<div align="center"><img src="img/cf_ss1.png" /></div> |
| 6 | + |
| 7 | +The CloudForecast Plugin for Cortex shows current highlights from CloudForecast reports related to your Cortex entities, and deeplinks back to the full report in CloudForecast. The data is ingested from CloudForecast webhooks using a Cortex Custom Integration. |
| 8 | + |
| 9 | +## Setup |
| 10 | + |
| 11 | +This plugin is available from the Cortex Plugin Marketplace. If you want to build the plugin yourself, follow the steps under **Build the Plugin** at the end of this document. |
| 12 | + |
| 13 | +### Cortex Setup |
| 14 | + |
| 15 | +This plugin uses a Custom Integration to take in webhooks from CloudForecast. To set up the Custom Integration in Cortex, follow these steps: |
| 16 | + |
| 17 | +- Click on your user icon on the bottom left, then click Settings |
| 18 | +- Click on Custom Integrations under the Integrations heading |
| 19 | +- Under the New Custom Integration heading, fill in the three fields as below: |
| 20 | + - Name: `CloudForecast` |
| 21 | + - Entity Tag JQ: `.entityTag` |
| 22 | + - Key: `cloudforecast` |
| 23 | +- Click Save. |
| 24 | + |
| 25 | +Once you are done, your Custom Integration should look like this: |
| 26 | + |
| 27 | +<div align="center"><img src="img/cf_ss2.png" /></div> |
| 28 | + |
| 29 | +Copy the URL that's shown under the key. This will be the integration URL that you add to CloudForecast. |
| 30 | + |
| 31 | +### CloudForecast Basic Setup |
| 32 | + |
| 33 | +- In CloudForecast, click on Settings > Cortex |
| 34 | +- Paste in the Custom Integration URL that you copied from the **Cortex Setup** above |
| 35 | +- Click on Save Changes |
| 36 | + |
| 37 | +<div align="center"><img src="img/cf_ss3.jpg" /></div> |
| 38 | + |
| 39 | +### CloudForecast Report Setup |
| 40 | + |
| 41 | +- Click on Reports > Cost Groups |
| 42 | +- Click the Configure button on a Cost Group that you want to send to a Cortex entity |
| 43 | +- Under "How would you like to receive your reports?" click on Cortex |
| 44 | +- Type in the tag of the entity where you want this report to appear, and click on Save Changes |
| 45 | +- Repeat these steps for all the Cost Groups you want to link to Cortex |
| 46 | + |
| 47 | +<div align="center"><img src="img/cf_ss4.jpg" /></div> |
| 48 | + |
| 49 | +_If you don't see the Cortex button in CloudForecast, reach out to your CloudForecast support team to enable it._ |
| 50 | + |
| 51 | +After the webhooks are delivered from Cortex, you will be able to see your CloudForecast data in your Entity Details page in Cortex, under the Plugins section! |
| 52 | + |
| 53 | +### Build the Plugin (optional) |
| 54 | + |
| 55 | +- Build the plugin: |
| 56 | +- Make sure you have npm or yarn. |
| 57 | +- In your terminal, in the `cloudforecast` directory, type `yarn` or `npm install` to install the dependencies; then type `npm run build` or `yarn build` to build the plugin. |
| 58 | +- The compiled plugin will be created in `dist/ui.html`. |
| 59 | +- In Plugins > All, click **Register Plugin**. |
| 60 | +- Give the plugin a name, like CloudForecast. This is the name users will see in the plugin listing. |
| 61 | +- Under **Plugin Context**, click on Add another context; choose Selection type: Include, and Entity types: service. |
| 62 | +- This plugin does not work in the Global context. Turn off the switch labeled **Include in global context**. |
| 63 | +- In The **Plugin code** section, upload the `dist/ui.html` file you just built. |
| 64 | +- Click on **Save plugin**. |
| 65 | + |
| 66 | +# Setting up your dev environment |
| 67 | + |
| 68 | +SonarQube Issues Cortex Plugin is a [Cortex](https://www.cortex.io/) plugin. To see how to run the plugin inside of Cortex, see [our docs](https://docs.cortex.io/docs/plugins). |
| 69 | + |
| 70 | +### Prerequisites |
| 71 | + |
| 72 | +Developing and building this plugin requires either [yarn](https://classic.yarnpkg.com/lang/en/docs/install/) or [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). |
| 73 | + |
| 74 | +## Getting started |
| 75 | + |
| 76 | +1. Run `yarn` or `npm install` to download all dependencies |
| 77 | +2. Run `yarn build` or `npm run build` to compile the plugin code into `./dist/ui.html` |
| 78 | +3. Upload `ui.html` into Cortex on a create or edit plugin page |
| 79 | +4. Add or update the code and repeat steps 2-3 as necessary |
| 80 | + |
| 81 | +### Notable scripts |
| 82 | + |
| 83 | +The following commands come pre-configured in this repository. You can see all available commands in the `scripts` section of [package.json](./package.json). They can be run with npm via `npm run {script_name}` or with yarn via `yarn {script_name}`, depending on your package manager preference. For instance, the `build` command can be run with `npm run build` or `yarn build`. |
| 84 | + |
| 85 | +- `build` - compiles the plugin. The compiled code root is `./src/index.tsx` (or as defined by [webpack.config.js](webpack.config.js)) and the output is generated into `dist/ui.html`. |
| 86 | +- `test` - runs all tests defined in the repository using [jest](https://jestjs.io/) |
| 87 | +- `lint` - runs lint and format checking on the repository using [prettier](https://prettier.io/) and [eslint](https://eslint.org/) |
| 88 | +- `lintfix` - runs eslint in fix mode to fix any linting errors that can be fixed automatically |
| 89 | +- `formatfix` - runs Prettier in fix mode to fix any formatting errors that can be fixed automatically |
| 90 | + |
| 91 | +### Available React components |
| 92 | + |
| 93 | +See available UI components via our [Storybook](https://cortexapps.github.io/plugin-core/). |
0 commit comments