Skip to main content

Local demo environment

A local environment based on Docker Compose is available for demo and testing. It's designed to be controlled by invoke using a list of predefined commands.

CommandDescription
demo.buildBuild an image with the provided name and Python version.
demo.startStart a local instance of Infrahub within docker compose.
demo.stopStop the running instance of Infrahub.
demo.destroyDestroy all containers and volumes.
demo.cli-gitLaunch a bash shell inside the running Infrahub container.
demo.cli-serverLaunch a bash shell inside the running Infrahub container.
demo.statusDisplay the status of all containers.
demo.load-infra-schemaLoad the infrastructure_base schema into Infrahub.
demo.load-infra-dataGenerate some data representing a small network with 6 devices.

Topology

Container NameImageDescription
databaseneo4j:communityGraph Database
message-queuerabbitmq:3.12-managementMessage bus based on RabbitMQ
cacheredis:7.2Cache based on Redis, mainly used for distributed lock
infrahub-serverDockerfileInstance of the API server, running GraphQL
infrahub-gitDockerfileInstance of the Git agent, managing the Git Repository
Check the architecture diagram to have more information about each component/topics/architecture

Getting started

Prerequisites

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 applications must be installed on the systems:

info

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

First utilization

Initialize the database and start the application

invoke demo.start

Load some data

Once you have an environment up and running you can load your own schema or you can explore the one provided with the project using the following commands.

invoke demo.load-infra-schema
invoke demo.load-infra-data

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.
info

invoke demo.debug can be used as an alternative to invoke demo.start, the main difference is that it will stay attached to the containers and all the logs will be displayed in real time in the CLI.

Advanced settings

Support for sudo

On a Linux system, the system will try to automatically detect if sudo is required to run the docker command or not.

It's possible to control this setting with the environment variable: INVOKE_SUDO

export INVOKE_SUDO=1 to force sudo
export INVOKE_SUDO=0 to disable it completely

Support for pty

On Linux and MacOS, all commands will be executed with PTY enabled by default.

It's possible to control this setting with the environment variable: INVOKE_PTY

export INVOKE_PTY=1 to force pty
export INVOKE_PTY=0 to disable it completely

Troubleshooting

It's recommended to check if all containers are still running using invoke demo.status. The 5 containers should be running and be present.

  • If one is not running, you can try to restart it with invoke demo.start.
  • If the container is still not coming up, you can watch the logs with docker logs <container name> (the container name will include the name of the project and a number, i.e., infrahub-infrahub-git-1 ).

If some containers are still not coming up, it's recommended to start from a fresh install with invoke demo.destroy.