|
1 | 1 | # Polaris Plugin for Nx CLI
|
2 | 2 |
|
3 | 3 | This library is a plugin for the [Nx](https://nx.dev) CLI.
|
| 4 | +It is wrapped by the *Polaris CLI*. |
4 | 5 |
|
5 |
| - |
6 |
| -## Features |
7 |
| - |
8 |
| -This plugin supplies builders and generators for the following types: |
9 |
| -* `slo-mapping-type`: creates a new SLO mapping type that can be used by consumers to apply and configure an SLO. |
10 |
| -* `slo-controller`: creates an SLO controller for an SLO mapping type. |
11 |
| -* `slo-mapping`: creates a new mapping instance for an existing SLO mapping type. |
12 |
| - |
13 |
| - |
14 |
| -## Getting Started |
15 |
| - |
16 |
| -To get started, you need to [create an empty Nx workspace](https://nx.dev/latest/node/getting-started/nx-setup). |
17 |
| -To do this, open a terminal and navigate to the location, where you want to create the workspace. |
18 |
| -Then, do the following (always replace `my-workspace` with your workspace's name): |
19 |
| - |
20 |
| -1. While not strictly required, it is recommended to install Nx CLI globally, because it will allow you to run commands more easily. |
21 |
| - ```shell |
22 |
| - npm install -g nx |
23 |
| - ``` |
24 |
| - |
25 |
| -1. Create an empty workspace. |
26 |
| - ```shell |
27 |
| - npx create-nx-workspace --preset=empty my-workspace |
28 |
| - ``` |
29 |
| - |
30 |
| -1. Add the Polaris plugin to your workspace. |
31 |
| - ```shell |
32 |
| - cd my-workspace |
33 |
| - npm install --save-dev @polaris-sloc/polaris-nx |
34 |
| - ``` |
35 |
| - |
36 |
| - |
37 |
| - |
38 |
| -## `slo-mapping-type` |
39 |
| - |
40 |
| -An `slo-mapping-type` needs to be part of a publishable npm package (i.e., a publishable library project). |
41 |
| - |
42 |
| -If you already have a library project, e.g., `my-slo-lib`, create the SLO Mapping type as follows: |
43 |
| - |
44 |
| -```shell |
45 |
| -nx g @polaris-sloc/polaris-nx:slo-mapping-type cost-efficiency --project=my-slo-lib |
46 |
| -``` |
47 |
| - |
48 |
| -If you don't have a publishable library project yet, you can create one using the `@nrwl/node:library` generator, or let the `slo-mapping-type` generator create one for you: |
49 |
| -
|
50 |
| -```shell |
51 |
| -nx g @polaris-sloc/polaris-nx:slo-mapping-type cost-efficiency --project=my-slo-lib --createLibProject=true --importPath=@my-org/my-slo-lib |
52 |
| -``` |
53 |
| -
|
54 |
| -Both versions will generate the `CostEfficiencySlo` class in the file `cost-efficiency.slo.ts` and export it from the library. |
55 |
| -
|
56 |
| -
|
57 |
| -
|
58 |
| -## `slo-controller` |
59 |
| -
|
60 |
| -An SLO controller is an application that is run as a controller in the orchestrator that watches SLO mapping instances to evaluate an SLO and trigger the configured elasticity strategy. |
61 |
| -
|
62 |
| -1. Create an `slo-controller` application project. |
63 |
| - ```shell |
64 |
| - nx g @polaris-sloc/polaris-nx:slo-controller cost-efficiency-slo-controller --sloMappingTypePkg=@my-org/my-slo-lib --sloMappingType=CostEfficiencySlo |
65 |
| - ``` |
66 |
| -
|
67 |
| -
|
68 |
| -
|
69 |
| -## `slo-mapping` |
70 |
| -
|
71 |
| -An `slo-mapping` needs to be part of an existing library project, which does not need to be buildable, because there is a custom builder for SLO mappings. |
72 |
| -
|
73 |
| -1. Create a node library project, if you don't have one. |
74 |
| - ```shell |
75 |
| - nx g @nrwl/node:library my-slo-mappings |
76 |
| - ``` |
77 |
| - |
78 |
| -1. Create the SLO Mapping. |
79 |
| - ```shell |
80 |
| - nx g @polaris-sloc/polaris-nx:slo-mapping my-slo-mapping --project=my-slo-mappings --sloMappingTypePkg=@my-org/my-slo-lib --sloMappingType=CostEfficiencySlo |
81 |
| - ``` |
82 |
| - |
| 6 | +For more information, please have a look at the [Polaris CLI documentation](https://polaris-slo-cloud.github.io/polaris/features/cli.html). |
83 | 7 |
|
84 | 8 |
|
85 | 9 | ## Running E2E Tests and Manual Testing
|
|
0 commit comments