Skip to content

Commit d348aad

Browse files
Merge pull request #4405 from opsmill/pmc-20240920-install-docs
install docs cleanup
2 parents 79b7e20 + ab469e9 commit d348aad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+204
-205
lines changed

docs/docs/development/backend.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In order start developing on Infrahub backend, it is recommended to have a decen
1313

1414
To fetch Infrahub's code, we will use Git and we will use the `develop` branch (default).
1515

16-
```bash
16+
```shell
1717
git clone --recursive [email protected]:opsmill/infrahub.git
1818
cd infrahub
1919
```
@@ -22,7 +22,7 @@ cd infrahub
2222

2323
Most of Infrahub and tools around it rely on some settings. These settings are in general set as environment variables, dealing with many of these can be hard to maintain and manage. We can use a tool such as [direnv](https://direnv.net/) to help. It allows to define environment variables (or pretty much anything bash can make sense of) in a file that will be interpreted when entering a given directory. Here is an example of a `.envrc` file providing development friendly setting values:
2424

25-
```bash
25+
```shell
2626
export INFRAHUB_PRODUCTION=false
2727
export INFRAHUB_SECURITY_SECRET_KEY=super-secret
2828
export INFRAHUB_USERNAME=admin
@@ -48,32 +48,32 @@ Infrahub uses several external services to work:
4848

4949
To run all these services, we will use Docker, but for local development some ports will need to be bound to local ones. To do so, a very basic Docker Compose override file is provided in the `development` directory, but it has a `tmp` extension which makes Compose ignore it by default. We will copy this file to a new one without the `tmp` extension. In a development environment, having only the services in Docker and Infrahub running on local Python is convenient to take advantage of the server auto-reload feature when making changes.
5050

51-
```bash
51+
```shell
5252
cp development/docker-compose.dev-override.yml.tmp development/docker-compose.dev-override.yml
5353
```
5454

5555
Now we need to make sure we have a compatible version of Python that Infrahub can run on top of, Poetry to create virtual environment and Invoke to run commands. Invoke can be installed in many ways, but we recommend to use the `pipx` way to get it available user wide while without messing with the system Python. Assuming we have these utilities ready, we can run the following commands to build a proper Python environment:
5656

57-
```bash
57+
```shell
5858
cd infrahub # or the directory of your choice
5959
poetry install
6060
```
6161

6262
Now it's time to bring the required services up, and for that we have demo commands:
6363

64-
```bash
64+
```shell
6565
invoke dev.destroy dev.deps
6666
```
6767

6868
This will actually pass two commands, one to destroy any remains of a previous run and one to start services. So this will effectively bring up clean services without leftovers. We can see which services are running by using:
6969

70-
```bash
70+
```shell
7171
poetry run invoke dev.status
7272
```
7373

7474
This should yield a Docker output like the following:
7575

76-
```bash
76+
```shell
7777
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
7878
infrahub-cache-1 redis:7.2 "docker-entrypoint.s…" cache 2 hours ago Up 2 hours (healthy) 0.0.0.0:6379->6379/tcp
7979
infrahub-database-1 memgraph/memgraph:2.13.0 "/usr/lib/memgraph/m…" database 2 hours ago Up 2 hours (healthy) 0.0.0.0:7444->7444/tcp, 0.0.0.0:7474->7474/tcp, 0.0.0.0:7687->7687/tcp
@@ -86,7 +86,7 @@ When following a guide, like the [installation guide](/guides/installation.mdx),
8686

8787
With the required services working and properly setup Python virtual environment we can now run the Infrahub test suite to make sure the code works as intended.
8888

89-
```bash
89+
```shell
9090
INFRAHUB_LOG_LEVEL=CRITICAL pytest -v backend/tests/unit
9191
```
9292

@@ -96,7 +96,7 @@ The environment variable at the beginning of the command is useful to have a muc
9696

9797
We can run the Infrahub server with the built-in command:
9898

99-
```bash
99+
```shell
100100
infrahub server start --debug
101101
```
102102

@@ -111,14 +111,14 @@ For running the frontend, please refer to its [dedicated documentation section](
111111

112112
For testing code changes, you may want to load a new schema from a YAML file. This can be performed in the development environment using:
113113

114-
```bash
114+
```shell
115115
poetry run infrahubctl schema load ${PATH_TO_SCHEMA_FILE}
116116
```
117117

118118
## Code format
119119

120120
Formatting code in the backend relies on [Ruff](https://docs.astral.sh/ruff/) and [yamllint](https://yamllint.readthedocs.io/en/stable/). To ensure all files are as close as possible to the expected format, it is recommended to run the `format` command:
121121

122-
```bash
122+
```shell
123123
poetry run invoke format
124124
```

docs/docs/development/docs.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The recommended way to run and build the docs locally is with Infrahub's suite o
1818

1919
Once these requirements are met, you'll have access to the doc task list.
2020

21-
```bash
21+
```shell
2222
invoke -l docs
2323
```
2424

@@ -195,7 +195,7 @@ await saveScreenshotForDocs(page, "my-screenshot-name");
195195

196196
To update all documentation screenshots, run:
197197

198-
```bash
198+
```shell
199199
cd frontend/app
200200
npm run test:e2e:screenshots
201201
```
@@ -292,7 +292,7 @@ Feature: Explanation of feature
292292
When creating a code block or snippet with three backticks, make sure to include a language designation.
293293
<!-- markdownlint-disable -->
294294
~~~md
295-
```bash
295+
```shell
296296
this is a shell script
297297
```
298298
~~~

docs/docs/development/frontend/getting-set-up.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ title: Getting set up
88

99
Make sure [Infrahub Backend](../backend.mdx) is up and running. If not, in your terminal execute:
1010

11-
```bash
11+
```shell
1212
invoke demo.destroy demo.build demo.start demo.load-infra-schema demo.load-infra-data
1313
```
1414

1515
:::
1616

1717
Infrahub is built with React. Make sure you're running Node.js 20+ and NPM 9+, to verify do:
1818

19-
```bash
19+
```shell
2020
node --version
2121
npm --version
2222
```
2323

2424
## 1. Install dependencies
2525

26-
```bash
26+
```shell
2727
cd frontend/app
2828
npm install
2929
```
3030

3131
## 2. Start a local server
3232

33-
```bash
33+
```shell
3434
npm start
3535
```
3636

@@ -40,7 +40,7 @@ To can access your local server at [http://localhost:8080/](http://localhost:808
4040

4141
### Unit tests
4242

43-
```bash
43+
```shell
4444
npm run test
4545

4646
# same with coverage
@@ -49,13 +49,13 @@ npm run test:coverage
4949

5050
### Integration tests
5151

52-
```bash
52+
```shell
5353
npm run cypress:run:component
5454
```
5555

5656
### E2E tests
5757

58-
```bash
58+
```shell
5959
npm run test:e2e
6060
```
6161

docs/docs/development/frontend/readme.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For testing, we rely on:
2727

2828
To access Infrahub's codebase, use Git and switch to the `develop` branch to access the latest changes. All frontend code resides in `/frontend`.
2929

30-
```bash
30+
```shell
3131
git clone --recursive [email protected]:opsmill/infrahub.git
3232
cd infrahub/frontend
3333
```

docs/docs/development/frontend/testing-guidelines.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ E2E tests are located in `/frontend/app/tests/e2e`.
3030

3131
[Playwright](https://playwright.dev/docs/codegen) can automatically generate tests as you perform actions in the browser, making it a quick way to start testing:
3232

33-
```bash
33+
```shell
3434
npx playwright codegen
3535
```
3636

@@ -81,7 +81,7 @@ page.getByRole("button", { name: "Save" });
8181

8282
2. Structure tests with steps for better readability:
8383

84-
```bash
84+
```shell
8585
# headless mode
8686
npm run test:e2e
8787

@@ -97,13 +97,13 @@ npm run test:e2e:ui
9797

9898
## Integration tests
9999

100-
```bash
100+
```shell
101101
npm run cypress:run:component
102102
```
103103

104104
## Unit tests
105105

106-
```bash
106+
```shell
107107
npm run test
108108

109109
# same with coverage

docs/docs/faq/faq.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Please see the documentation on [integrations](../integrations) for more informa
129129

130130
Infrahub collects anonymous usage metrics and sends them to OpsMill servers for analysis and improvement purposes. No personally identifiable information is collected. If you prefer to opt-out of telemetry collection, you can do so by setting the `INFRAHUB_TELEMETRY_OPTOUT` environment variable to `true`:
131131

132-
```bash
132+
```shell
133133
export INFRAHUB_TELEMETRY_OPTOUT=true
134134
```
135135

docs/docs/guides/artifact.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ More details on the `.infrahub.yml` file format can be found in [.infrahub.yml t
4545

4646
Commit the changes to the repository and push them to the Git server
4747

48-
```bash
48+
```shell
4949
git add .
5050
git commit -m "add tags_config_file artifact definition"
5151
git push origin main

docs/docs/guides/check.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ As the first step we need to have some data in the database to actually query.
2525
Create three tags, called "color-red", "color-green", "blue", either using the frontend or by submitting three GraphQL mutations as per below (just swapping out the name of the color each time).
2626
Note that the "blue" tag is following a different naming scheme compared to the other tags. This is on purpose and is needed for the rest of the guide.
2727

28-
```GraphQL
28+
```graphql
2929
mutation CreateTags {
3030
BuiltinTagCreate(
3131
data: {name: {value: "color-red"}, description: {value: "The red tag"}}
@@ -40,7 +40,7 @@ mutation CreateTags {
4040

4141
The next step is to create a query that returns the data we just created. The rest of this guide assumes that the following query will return a response similar to the response below the query.
4242

43-
```GraphQL
43+
```graphql
4444
query TagsQuery {
4545
BuiltinTag {
4646
edges {
@@ -102,7 +102,7 @@ Response to the tags query:
102102

103103
Create a local directory on your computer.
104104

105-
```bash
105+
```shell
106106
mkdir tags_check
107107
```
108108

@@ -207,7 +207,7 @@ Within the `tags_check` folder you should now have 3 files:
207207

208208
Before we can test our transform we must add the files to a local Git repository.
209209

210-
```bash
210+
```shell
211211
git init --initial-branch=main
212212
git add .
213213
git commit -m "First commit"
@@ -217,14 +217,14 @@ git commit -m "First commit"
217217

218218
Using infrahubctl you can first verify that the `.infrahub.yml` file is formatted correctly by listing available checks.
219219

220-
```bash title="❯ infrahubctl check --list"
220+
```shell title="❯ infrahubctl check --list"
221221
Python checks defined in repository: 1
222222
check_color_tags_name (tags_check.py::ColorTagsCheck) Target: -global-
223223
```
224224

225225
Run the check by specifying the name of the check as an argument.
226226

227-
```bash title="❯ infrahubctl check check_color_tags_name"
227+
```shell title="❯ infrahubctl check check_color_tags_name"
228228
[09:23:25] INFO HTTP Request: POST http://localhost:8000/graphql "HTTP/1.1 200 OK"
229229
ERROR tags_check::ColorTagsCheck: FAILED
230230
ERROR Invalid tag name: blue
@@ -352,7 +352,7 @@ We need to modify the GraphQL query with the `name` parameter. The GraphQL query
352352

353353
Replace the contents of the `tags_check.gql` file with the following contents.
354354

355-
```GraphQL
355+
```graphql
356356
query TagsQuery($name: String!) {
357357
BuiltinTag(name__value: $name) {
358358
edges {
@@ -371,7 +371,7 @@ query TagsQuery($name: String!) {
371371

372372
### 5. Test the `check_color_tags_name` check
373373

374-
```bash title="❯ infrahubctl check check_color_tags_name"
374+
```shell title="❯ infrahubctl check check_color_tags_name"
375375
``[11:50:43] INFO HTTP Request: GET http://localhost:8000/api/schema/?branch=main "HTTP/1.1 200 OK"
376376
INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"
377377
INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"
@@ -493,15 +493,15 @@ We now have 2 targeted checks defined, each targeting its own set of tags, with
493493

494494
Verify that we have 2 checks defined using the `infrahubctl` command.
495495

496-
```bash title="❯ infrahubctl check --list"
496+
```shell title="❯ infrahubctl check --list"
497497
Python checks defined in repository: 2
498498
check_color_tags_name (tags_check.py::ColorTagsCheck) Target: ColorTags
499499
check_number_tags_name (tags_check.py::NumberTagsCheck) Target: NumberTags
500500
```
501501

502502
Check that the `check_color_tags_name` fails because of the tag `blue` not complying with the naming scheme:
503503

504-
```bash title="❯ infrahubctl check check_color_tags_name"
504+
```shell title="❯ infrahubctl check check_color_tags_name"
505505
[14:04:50] INFO HTTP Request: GET http://localhost:8000/api/schema/?branch=main "HTTP/1.1 200 OK
506506
[14:04:51] INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"
507507
INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"
@@ -518,7 +518,7 @@ Check that the `check_color_tags_name` fails because of the tag `blue` not compl
518518

519519
Check that the `check_number_tags_name` succeeds:
520520

521-
```bash title="❯ infrahubctl check check_number_tags_name"
521+
```shell title="❯ infrahubctl check check_number_tags_name"
522522
[14:09:32] INFO HTTP Request: GET http://localhost:8000/api/schema/?branch=main "HTTP/1.1 200 OK"
523523
INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"
524524
INFO HTTP Request: POST http://localhost:8000/graphql/main "HTTP/1.1 200 OK"

0 commit comments

Comments
 (0)