Skip to main content

Getting started with Infrahub

note

This tutorial doesn't require any prior knowledge, but knowledge of Git, GraphQL, and Python will make things easier to understand.

This tutorial will get you started with using Infrahub and it will help you get familiar with some of the main components and concepts behind Infrahub. To do this we'll use a sample dataset that represents a small network with 6 devices. This tutorial will teach you:

  • How to manage branches and query any branches.
  • How to integrate a Git repository within Infrahub.
  • How to generate Jinja2 template.
  • How to expose a new Data Transformation endpoint.
  • How to validate data within the CI/CD pipeline.
  • How to extend the current schema.
  • How to query data via the GraphQL interface.
  • How to modify data via the REST API.
  • How to query for past state via the GraphQL interface.

The tutorial is meant to be executed in order, as we'll be making some changes along the way that might be required later.

Prepare the demo environment

Pre-requisites

The system that you want to use to run the demo environment has to meet the hardware requirements. Alternatively you can run Infrahub in GitHub codespaces.

In order to run the demo environment, the following packages or applications must be installed on the systems:

  • Docker (version 24.x minimum) & Docker Compose
  • git
  • pyinvoke
  • toml
tip

On a Laptop, both Docker & Docker Compose can be installed by installing Docker Desktop.

Download Infrahub

Refer to the Installation Documentation.

First utilization

Initialize the database and start the application

invoke demo.start

Control the local environment

  • invoke demo.start : Start all the containers in detached mode.
  • invoke demo.stop : Stop All the containers
  • invoke demo.destroy : Destroy all containers and volumes.

Accounts available for the tutorial

At this stage only one login account exists on Infrahub: admin.

info

The default token for the Admin account is 06438eb2-8019-4776-878c-0941b1f1d1ec While using the API the Authentication Token must be provided in a header named X-INFRAHUB-KEY

More accounts will be loaded with the demo data.

Refer to User management page for more information regarding the possible rights.

To follow the tutorial you should use the admin account but you can try the other accounts too to see how the interface behaves with different permission levels.

nameusernamepasswordrole
Administratoradmininfrahubadmin
Chloe O'BrianChloe O'BrianPassword123read-write
David PalmerDavid PalmerPassword123read-write
Jack BauerJack BauerPassword123read-only

Access the Infrahub interfaces

Confirm access to the Infrahub web interface and the GraphQL interface by visiting the following links:

Access the Web interfacehttp://localhost:8000 Access the GraphQL interfacehttp://localhost:8000/graphql