You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
24
24
25
-
```bash
25
+
```shell
26
26
export INFRAHUB_PRODUCTION=false
27
27
export INFRAHUB_SECURITY_SECRET_KEY=super-secret
28
28
export INFRAHUB_USERNAME=admin
@@ -48,32 +48,32 @@ Infrahub uses several external services to work:
48
48
49
49
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.
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:
56
56
57
-
```bash
57
+
```shell
58
58
cd infrahub # or the directory of your choice
59
59
poetry install
60
60
```
61
61
62
62
Now it's time to bring the required services up, and for that we have demo commands:
63
63
64
-
```bash
64
+
```shell
65
65
invoke dev.destroy dev.deps
66
66
```
67
67
68
68
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:
69
69
70
-
```bash
70
+
```shell
71
71
poetry run invoke dev.status
72
72
```
73
73
74
74
This should yield a Docker output like the following:
75
75
76
-
```bash
76
+
```shell
77
77
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
78
78
infrahub-cache-1 redis:7.2 "docker-entrypoint.s…" cache 2 hours ago Up 2 hours (healthy) 0.0.0.0:6379->6379/tcp
79
79
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),
86
86
87
87
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.
@@ -96,7 +96,7 @@ The environment variable at the beginning of the command is useful to have a muc
96
96
97
97
We can run the Infrahub server with the built-in command:
98
98
99
-
```bash
99
+
```shell
100
100
infrahub server start --debug
101
101
```
102
102
@@ -111,14 +111,14 @@ For running the frontend, please refer to its [dedicated documentation section](
111
111
112
112
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:
113
113
114
-
```bash
114
+
```shell
115
115
poetry run infrahubctl schema load ${PATH_TO_SCHEMA_FILE}
116
116
```
117
117
118
118
## Code format
119
119
120
120
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:
Copy file name to clipboardExpand all lines: docs/docs/development/frontend/testing-guidelines.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ E2E tests are located in `/frontend/app/tests/e2e`.
30
30
31
31
[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:
Copy file name to clipboardExpand all lines: docs/docs/faq/faq.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,7 +129,7 @@ Please see the documentation on [integrations](../integrations) for more informa
129
129
130
130
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`:
0 commit comments