Skip to content

Pmc-20250102-menu #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions docs/docs-infrahub/convert_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import re
from pathlib import Path
import os


def convert_absolute_to_relative(source_path: Path, absolute_path: str) -> str:
"""Convert an absolute path to a relative path based on the source file location."""
# Remove leading slash to make it relative to the root
target_path = Path(absolute_path.lstrip("/"))

# Get the relative path from source directory to target
relative_path = os.path.relpath(target_path, source_path.parent)

return relative_path


def process_file(file_path: Path) -> None:
"""Process a single markdown file and convert absolute links to relative."""
content = file_path.read_text()

# Regular expression to find markdown links
pattern = r"\[([^\]]+)\]\((/[^)]+)\)"

def replace_link(match):
link_text = match.group(1)
absolute_path = match.group(2)
relative_path = convert_absolute_to_relative(file_path, absolute_path)
return f"[{link_text}]({relative_path})"

new_content = re.sub(pattern, replace_link, content)

# Only write if content has changed
if new_content != content:
print(f"Updating {file_path}")
file_path.write_text(new_content)


def main():
# Find all markdown files in current directory and subdirectories
root_dir = Path(".")
markdown_files = list(root_dir.rglob("*.md")) + list(root_dir.rglob("*.mdx"))

for file_path in markdown_files:
process_file(file_path)


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ infrahub-database-1 memgraph/memgraph:2.13.0 "/usr/lib/memgraph/m…"
infrahub-message-queue-1 rabbitmq:3.12-management "docker-entrypoint.s…" message-queue 2 hours ago Up 2 hours (healthy) 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp
```

When following a guide, like the [installation guide](/guides/installation.mdx), the command `demo.start` is mentioned. It is slightly different from the `dev.deps` that is mentioned here. The `demo.start` will bring up a demo environment as a whole including services and Infrahub while the `dev.deps` will only start the services as seen in the code block above.
When following a guide, like the [installation guide](../guides/installation.mdx), the command `demo.start` is mentioned. It is slightly different from the `dev.deps` that is mentioned here. The `demo.start` will bring up a demo environment as a whole including services and Infrahub while the `dev.deps` will only start the services as seen in the code block above.

## Running Infrahub test suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ For a deeper dive into reference docs, refer to the [diátaxis reference page](h

## Application screenshots

To ensure that Infrahub's screenshots remain up to date and to check that our guides work properly, we use [end-to-end (e2e) tests](/development/frontend/testing-guidelines#e2e-tests). You'll find the e2e tests specifically designed for tutorials located in `frontend/app/tests/e2e/tutorial`.
To ensure that Infrahub's screenshots remain up to date and to check that our guides work properly, we use [end-to-end (e2e) tests](../development/frontend/testing-guidelines#e2e-tests). You'll find the e2e tests specifically designed for tutorials located in `frontend/app/tests/e2e/tutorial`.

### Updating all screenshots manually

Expand Down Expand Up @@ -279,7 +279,7 @@ The screenshots will be saved in `docs/docs/media`. You can then use them in our

#### 1. Locate on which test the screenshot should be added

If the test does not exist yet, create must create it first. Refer to the [write e2e tests](/development/frontend/testing-guidelines#writing-e2e-tests) for more information.
If the test does not exist yet, create must create it first. Refer to the [write e2e tests](../development/frontend/testing-guidelines#writing-e2e-tests) for more information.

#### 2. Add the screenshot

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ npm install
npm start
```

To can access your local server at [http://localhost:8080/](http://localhost:8080/). If you are not familiar with Infrahub, learn by following our [tutorial](/tutorials/getting-started/).
To can access your local server at [http://localhost:8080/](http://localhost:8080/). If you are not familiar with Infrahub, learn by following our [tutorial](../../tutorials/getting-started).

## 3. Run all tests

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem';
In Infrahub, managing access and control starts with creating accounts, assigning them to groups, and managing their roles and permissions.
This guide outlines how to create new accounts, accounts groups, and assign roles and permissions.

For more information on roles and permissions, see the [Roles and Permissions](/topics/permissions-roles) topic.
For more information on roles and permissions, see the [Roles and Permissions](../topics/permissions-roles) topic.

## Creating a new account

Expand Down Expand Up @@ -131,8 +131,7 @@ In the GraphQL sandbox, execute the following mutation to create a new role:
## Managing permissions

Permissions can be managed through roles assigned to users or groups.
Infrahub supports **Global** and **Object-specific** permissions, allowing fine-grained control over what users can do within the system.
For a complete list of available global and object permissions, see the [Roles and Permissions documentation](/reference/permissions.mdx).
For a complete list of available global and object permissions, see the [Roles and Permissions documentation](../reference/permissions.mdx).

### Creating and global permissions

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: Creating a Check
<!-- vale off -->
## Creating a Check
<!-- vale on -->
Within Infrahub a [Check](/topics/check) is defined in an [external repository](/topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the check using [infrahubctl check](/infrahubctl/infrahubctl-check).
Within Infrahub a [Check](../topics/check) is defined in an [external repository](../topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the check using [infrahubctl check](../infrahubctl/infrahubctl-check).

The goal of this guide is to develop a `Check` and add it to Infrahub, we will achieve this by following these steps.

1. Identify the relevant data in the database that you want to use as input for the check using a [GraphQL query](/topics/graphql), that can take an input parameter to filter the data
1. Identify the relevant data in the database that you want to use as input for the check using a [GraphQL query](../topics/graphql), that can take an input parameter to filter the data
2. Write a Python script that will process and validate the data using your custom business logic
3. Create an entry for the check within an .infrahub.yml file
4. Create a Git repository
Expand Down Expand Up @@ -110,7 +110,7 @@ Then save the `TagsQuery` as a text file named `tags_check.gql`.

### 2. Create the Python check file

The next step is to create the Check Python business logic. The check is a Python class that inherits from `InfrahubCheck` from the [Python SDK](/python-sdk). Create a file called `tags_check.py`:
The next step is to create the Check Python business logic. The check is a Python class that inherits from `InfrahubCheck` from the [Python SDK](../python-sdk). Create a file called `tags_check.py`:

```python
import re
Expand Down Expand Up @@ -234,7 +234,7 @@ We have now successfully created a check. Most of the checks you will create wou

### 6. Adding the repository to Infrahub

In order to avoid having the same instructions over and over please refer to the guide [adding a repository to Infrahub](/guides/repository) in order to sync the repository you created and make it available within Infrahub.
In order to avoid having the same instructions over and over please refer to the guide [adding a repository to Infrahub](../guides/repository) in order to sync the repository you created and make it available within Infrahub.

### 7. Using the check within Infrahub

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ In this guide we will create a schema for a network device and its interfaces.

By no mean this is meant to be a complete schema for a network device, there is far more complexity that goes into modeling a schema for a network device, it is just used as an example to guide you through the process.

For a more detailed explanation of the different Attributes and Relations, you can check out our [Schema Topic](/topics/schema).
For a more detailed explanation of the different Attributes and Relations, you can check out our [Schema Topic](../topics/schema).

Throughout this guide we will load different schemas into Infrahub into different branches. The fact that multiple schemas can exist simultaneously is a core feature of Infrahub. It is a recommendation and best practice to always use a branch to make changes to the schema.

:::note

To help with the development process of a schema definition file, you can leverage [schema validation](/reference/schema-validation) within your editor.
To help with the development process of a schema definition file, you can leverage [schema validation](../reference/schema-validation) within your editor.

:::

Expand Down Expand Up @@ -341,7 +341,7 @@ In the detailed view of the device in the Web UI, we can now see that the device

## 4. Improving our schema

Although the schema already closely represents what we wanted to achieve, there are still a few improvements we would like to make. For this, we are going to use Infrahub's schema migrations feature. More details can be found in [the Schema topic](/topics/schema#schema-update-and-data-migrations).
Although the schema already closely represents what we wanted to achieve, there are still a few improvements we would like to make. For this, we are going to use Infrahub's schema migrations feature. More details can be found in [the Schema topic](../topics/schema#schema-update-and-data-migrations).

1. adding and `mtu` and `enabled` attribute on the generic `NetworkInterface`
4. deleting the `description` attribute of the generic `NetworkInterface`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Database backup and restore
# Database backup and restore examples

This is a guide on how to backup and restore your database using an Infrahub command line tool.
Please [see this topic](/topics/database-backup) for the requirements for using the tool and an explanation of how it works.
Please [see this topic](../topics/database-backup) for the requirements for using the tool and an explanation of how it works.

This guide assumes that you cloned the Infrahub repository to your machine, but you can also copy the content of [this tool's Python file](https://github.com/opsmill/infrahub/tree/stable/utilities/db_backup/__main__.py) into a local Python file and run it that way.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import TabItem from '@theme/TabItem';

# Creating a generator in Infrahub

Within Infrahub a generator is defined in an [external repository](/topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the transform using [infrahubctl generator](/infrahubctl/infrahubctl-generator).
Within Infrahub a generator is defined in an [external repository](../topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the transform using [infrahubctl generator](../infrahubctl/infrahubctl-generator).

The goal of this guide is to develop a Generator and add it to Infrahub, we will achieve this by following these steps.

1. Identify the relevant data you want to extract from the database using a [GraphQL query](/topics/graphql), that can take an input parameter to filter the data
1. Identify the relevant data you want to extract from the database using a [GraphQL query](../topics/graphql), that can take an input parameter to filter the data
2. Write a Python script that uses the GraphQL query to read information from the system and generates new data based on the response
3. Create an entry for the generator within an .infrahub.yml file.
4. Create a Git repository
Expand All @@ -24,7 +24,7 @@ What your generator will look like will depend on what your schema looks like an

As the default Infrahub schema doesn't have a lot of object types to use as a test, we will illustrate how this could work by adding two nodes to the schema.

Load the following schema using the [infrahubctl schema](/infrahubctl/infrahubctl-schema) command.
Load the following schema using the [infrahubctl schema](../infrahubctl/infrahubctl-schema) command.

```yaml
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
Expand Down Expand Up @@ -122,7 +122,7 @@ Store this class within a new file called widget_generator.py.

## 3. Create an .infrahub.yml file

The [.infrahub.yml](/topics/infrahub-yml) file allows you to tie the different [components of a generator](/topics/generator) together into a working unit.
The [.infrahub.yml](../topics/infrahub-yml) file allows you to tie the different [components of a generator](../topics/generator) together into a working unit.

```yaml
# yaml-language-server: $schema=https://schema.infrahub.app/python-sdk/repository-config/latest.json
Expand Down Expand Up @@ -156,7 +156,7 @@ queries:
</TabItem>
</Tabs>

See [this topic](/topics/infrahub-yml) for a full explanation of everything that can be defined in the `.infrahub.yml` file.
See [this topic](../topics/infrahub-yml) for a full explanation of everything that can be defined in the `.infrahub.yml` file.

## 4. Create a Git repository

Expand Down Expand Up @@ -185,7 +185,7 @@ widget_generator (widget_generator.py::Generator) Target: widgets

:::note

When running a generator with `infrahubctl` the [SDK tracking](/python-sdk/topics/tracking) feature isn't used. The reason for this is that internally Infrahub uses the ID of the generator_definition to control the tracking, this isn't available from the outside. For this reason it is recommended to create test branches when developing generators and validating the results.
When running a generator with `infrahubctl` the [SDK tracking](../python-sdk/topics/tracking) feature isn't used. The reason for this is that internally Infrahub uses the ID of the generator_definition to control the tracking, this isn't available from the outside. For this reason it is recommended to create test branches when developing generators and validating the results.

:::

Expand All @@ -202,4 +202,4 @@ infrahubctl generator widget_generator --branch=test-branch1 name=widget2

Now you should see the tree TestResource objects within `test-branch1` one for the first widget and two for the second one.

With this step completed you can [add your repository to Infrahub](/guides/repository) and then the generators will be executed as part of the proposed change pipeline.
With this step completed you can [add your repository to Infrahub](../guides/repository) and then the generators will be executed as part of the proposed change pipeline.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Creating a Group
# Creating a Group in Infrahub
<!-- vale on -->

Within Infrahub a [Group](/topics/groups) can be created in multiple ways: in the UI, GraphQL, SDK and allow you to create and manage collections of objects.
Within Infrahub a [Group](../topics/groups) can be created in multiple ways: in the UI, GraphQL, SDK and allow you to create and manage collections of objects.

As the first step we need to create a group.
We will be adding the `red` and `blue` tag to the `TagConfigGroup` group that we created in the previous step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extensions:

:::note

To help with the development process of a schema definition file, you can leverage [schema validation](/reference/schema-validation) within your editor.
To help with the development process of a schema definition file, you can leverage [schema validation](../reference/schema-validation) within your editor.

:::

Expand All @@ -50,7 +50,7 @@ infrahubctl schema load <path to schema file or a directory> <path to schema fil

### Git integration

You can defined a schema in an [external repository](/topics/repository).
You can defined a schema in an [external repository](../topics/repository).
The schemas that should be loaded must be declared in the ``.infrahub.yml`` file, under schemas.

Individual files and directory are both supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Infrahub is deployed as a container-based architecture, and can be deployed for

## Hardware requirements

Please ensure the systems on which you want to install Infrahub meet the [hardware requirements](/topics/hardware-requirements).
Please ensure the systems on which you want to install Infrahub meet the [hardware requirements](../topics/hardware-requirements).

## Quick start via curl

Expand Down Expand Up @@ -193,14 +193,14 @@ cd infrahub
invoke demo.start
```

<ReferenceLink title="Check the documentation of the demo environment for more information" url="/topics/local-demo-environment" />
<ReferenceLink title="Check the documentation of the demo environment for more information" url="../topics/local-demo-environment" />

### GitHub Codespaces

The Infrahub GitHub repository is designed to launch an instance via [GitHub Codespaces](https://docs.github.com/en/codespaces/overview). We have two devcontainer configurations:
<!-- vale off -->
* **infrahub:** a deployment running without any [Schema](/tutorials/getting-started/schema) or data pre-installed
* **infrahub-demo:** a deployment running the [demo environment](/topics/local-demo-environment)
* **infrahub:** a deployment running without any [Schema](../tutorials/getting-started/schema) or data pre-installed
* **infrahub-demo:** a deployment running the [demo environment](../topics/local-demo-environment)
<!-- vale on -->
| No Data | Demo Data |
|---|---|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ title: Creating a Jinja transform

# Creating a Jinja rendered file (transform)

Within Infrahub a [Transform](/topics/transformation) is defined in an [external repository](/topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the render using [infrahubctl render](/infrahubctl/infrahubctl-render).
Within Infrahub a [Transform](../topics/transformation) is defined in an [external repository](../topics/repository). However, during development and troubleshooting it is easiest to start from your local computer and run the render using [infrahubctl render](../infrahubctl/infrahubctl-render).

The goal of this guide is to develop a Jinja Transform and add it to Infrahub, we will achieve this by following these steps.

1. Identify the relevant data you want to extract from the database using a [GraphQL query](/topics/graphql), that can take an input parameter to filter the data
1. Identify the relevant data you want to extract from the database using a [GraphQL query](../topics/graphql), that can take an input parameter to filter the data
2. Write a Jinja2 file that use the GraphQL query to read information from the system and render the data into a new format
3. Create an entry for the Jinja2 Transform within an .infrahub.yml file.
4. Create a Git repository
Expand Down Expand Up @@ -226,7 +226,7 @@ If `--branch` is not provided it will automatically use the name of the local br

## 6. Adding the repository to Infrahub

In order to avoid having the same instructions over and over please refer to the guide [adding a repository to Infrahub](/guides/repository) in order to sync the repository you created and make it available within Infrahub.
In order to avoid having the same instructions over and over please refer to the guide [adding a repository to Infrahub](../guides/repository) in order to sync the repository you created and make it available within Infrahub.

## 7. Accessing the Transform from the API

Expand Down
Loading
Loading