Installing Infrahub
This guide provides step-by-step instructions for installing Infrahub Community and Enterprise editions. The installation methods covered here are for non-resilient deployment architectures suitable for development, testing, and single-node production environments.
For resilient, high-availability deployments, refer to the high availability architecture documentation.
Prerequisites
- Ensure your system meets the hardware requirements before installing Infrahub
- Each installation method has additional prerequisites listed in their respective sections
Allocating more CPU cores to the Neo4j database will only improve performance on Infrahub Enterprise as it leverages parallel query execution.
Community
Infrahub Community is deployed as a container-based architecture and can be installed using several methods.
- Docker compose via curl
- Local development (git clone)
- Kubernetes with Helm
Using curl and Docker Compose
To quickly spin up the latest Infrahub locally, retrieve the Docker Compose file from infrahub.opsmill.io.
You can also specify a specific version or the develop
branch in the URL:
Prerequisites
- Docker (version 24.x minimum)
- Docker Compose
Start an Infrahub environment
- macOS
- Linux
curl https://infrahub.opsmill.io | docker compose -p infrahub -f - up -d
curl https://infrahub.opsmill.io | sudo docker compose -p infrahub -f - up -d
After running the command, you should see Docker downloading the necessary images and starting the containers.
Verify that Infrahub is running by accessing the web interface or checking container status:
docker ps | grep infrahub
Stop and remove an Infrahub environment
- macOS
- Linux
curl https://infrahub.opsmill.io | docker compose -p infrahub -f - down -v
curl https://infrahub.opsmill.io | sudo docker compose -p infrahub -f - down -v
Cloning the repository
The recommended method for running Infrahub for development uses the Docker Compose files included with the project combined with helper commands defined in invoke
.
This method is suitable for local development and demo environments. It is not recommended for production deployments.
Prerequisites
Step 1: clone the repository
Create the base directory for the Infrahub installation. For this guide, we'll use /opt/infrahub
.
cd /opt/
Usage of the /opt/infrahub
directory is merely a suggestion. You can use any directory on your system, especially for development or demo purposes.
mkdir -p ~/source/
cd ~/source/
Clone Infrahub repository into the current directory:
git clone --recursive https://github.com/opsmill/infrahub.git
The git clone
command should generate output similar to the following:
Cloning into '.'...
remote: Enumerating objects: 1312, done.
remote: Counting objects: 100% (1312/1312), done.
remote: Compressing objects: 100% (1150/1150), done.
remote: Total 1312 (delta 187), reused 691 (delta 104), pack-reused 0
Receiving objects: 100% (1312/1312), 33.37 MiB | 14.46 MiB/s, done.
Resolving deltas: 100% (187/187), done.
Step 2: install dependencies
Navigate to the cloned Infrahub directory:
cd infrahub
Install the poetry dependencies by running:
poetry install
You should see Poetry installing the required dependencies. When complete, you'll be returned to the command prompt without errors.
Step 3: start Infrahub
Start and initialize Infrahub:
poetry run invoke demo.start
Using Helm and Kubernetes
It's possible to deploy Infrahub on Kubernetes using Helm charts. This method is suitable for production deployments and provides a more resilient architecture.
Infrahub Helm Charthttps://github.com/opsmill/infrahub-helm/tree/stable/charts/infrahubArtifactHubhttps://artifacthub.io/packages/helm/infrahub/infrahubPrerequisites
- A Kubernetes cluster
- Helm installed on your system
Production deployment requirements
The following are required for production deployments using Helm:
- Data persistence for the database must be enabled
- Multiple replicas of the Infrahub API Server and Infrahub Task workers should be deployed: you can use the
affinity
variable to define the affinity policy for the pods - S3 storage should be configured for the Infrahub API Server, it is required if you have multiple replicas
We do not recommend using the included dependencies (Neo4j, RabbitMQ, Redis) for production. They are present to ease deployment on non-production environments.
Step 1: Fill in the values file
Create a values.yml
file with the following configuration:
infrahubServer:
replicas: 3
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: service
operator: In
values:
- infrahub-server
topologyKey: topology.kubernetes.io/zone
persistence:
enabled: false
ingress:
enabled: true
infrahubServer:
env:
INFRAHUB_ALLOW_ANONYMOUS_ACCESS: "true"
INFRAHUB_CACHE_PORT: 6379
INFRAHUB_DB_TYPE: neo4j
INFRAHUB_LOG_LEVEL: INFO
INFRAHUB_PRODUCTION: "true"
INFRAHUB_INITIAL_ADMIN_TOKEN: 06438eb2-8019-4776-878c-0941b1f1d1ec
INFRAHUB_SECURITY_SECRET_KEY: 327f747f-efac-42be-9e73-999f08f86b92
INFRAHUB_STORAGE_DRIVER: s3
AWS_ACCESS_KEY_ID: xxxx
AWS_SECRET_ACCESS_KEY: xxxx
AWS_S3_BUCKET_NAME: infrahub-data
AWS_S3_ENDPOINT_URL: https://s3
infrahubTaskWorker:
replicas: 3
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: service
operator: In
values:
- infrahub-task-worker
topologyKey: topology.kubernetes.io/zone
neo4j:
services:
admin:
enabled: true
volumes:
data:
mode: dynamic
dynamic:
storageClassName: premium-rwo
requests:
storage: 100Gi
Be sure to replace the placeholder values with your actual values.
Step 2: install the chart
Install using a local chart:
helm install infrahub -f values.yml path/to/infrahub/chart
Or install using the OpsMill registry:
helm install infrahub -f values.yml oci://registry.opsmill.io/opsmill/chart/infrahub
Verify the installation by checking that all pods are running:
kubectl get pods -l app=infrahub
EnterpriseEnterprise Edition
Infrahub Enterprise is based on the Community version, with several enhancements for:
- Enterprise features
- High availability
- Better performance
- Security hardening (Docker image, etc.)
Infrahub Enterprise can be deployed using the same methods as Infrahub Community.
- Docker compose via curl
- Kubernetes with Helm
Using curl and Docker Compose
To quickly spin up the latest Infrahub Enterprise locally, retrieve the Docker Compose file from infrahub.opsmill.io/enterprise.
You can also specify a specific version in the URL:
Prerequisites
- Docker (version 24.x minimum)
- Docker Compose
Start an Infrahub Enterprise environment
- macOS
- Linux
curl https://infrahub.opsmill.io/enterprise | docker compose -p infrahub -f - up -d
curl https://infrahub.opsmill.io/enterprise | sudo docker compose -p infrahub -f - up -d
Stop and remove an Infrahub Enterprise environment
- macOS
- Linux
curl https://infrahub.opsmill.io/enterprise | docker compose -p infrahub -f - down -v
curl https://infrahub.opsmill.io/enterprise | sudo docker compose -p infrahub -f - down -v
Using Helm and Kubernetes
The Enterprise Helm chart is based on the original Infrahub chart and uses it as a Helm dependency.
Most configuration related to Infrahub goes inside the infrahub
top-level key.
Production deployment requirements
The following are required for production deployments using Helm:
- Data persistence for the database must be enabled
- Multiple replicas of the Infrahub API Server and Infrahub Task workers should be deployed: you can use the
affinity
variable to define the affinity policy for the pods - S3 storage should be configured for the Infrahub API Server, it is required if you have multiple replicas
We do not recommend using the included dependencies (Neo4j, RabbitMQ, Redis) for production. They are present to ease deployment on non-production environments.
Prerequisites
- A Kubernetes cluster
- Helm installed on your system
Step 1: Fill in the values file
Create a values.yml
file with the following configuration:
infrahub:
infrahubServer:
replicas: 3
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: service
operator: In
values:
- infrahub-server
topologyKey: topology.kubernetes.io/zone
persistence:
enabled: false
ingress:
enabled: true
infrahubServer:
env:
INFRAHUB_ALLOW_ANONYMOUS_ACCESS: "true"
INFRAHUB_CACHE_PORT: 6379
INFRAHUB_DB_TYPE: neo4j
INFRAHUB_LOG_LEVEL: INFO
INFRAHUB_PRODUCTION: "true"
INFRAHUB_INITIAL_ADMIN_TOKEN: 06438eb2-8019-4776-878c-0941b1f1d1ec
INFRAHUB_SECURITY_SECRET_KEY: 327f747f-efac-42be-9e73-999f08f86b92
INFRAHUB_STORAGE_DRIVER: s3
AWS_ACCESS_KEY_ID: xxxx
AWS_SECRET_ACCESS_KEY: xxxx
AWS_S3_BUCKET_NAME: infrahub-data
AWS_S3_ENDPOINT_URL: https://s3
infrahubTaskWorker:
replicas: 3
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: service
operator: In
values:
- infrahub-task-worker
topologyKey: topology.kubernetes.io/zone
neo4j:
services:
admin:
enabled: true
volumes:
data:
mode: dynamic
dynamic:
storageClassName: premium-rwo
requests:
storage: 100Gi
Be sure to replace the placeholder values with your actual values.
Step 2: install the chart
Install using a local chart:
helm install infrahub -f values.yml path/to/infrahub-enterprise/chart
Or install using the OpsMill registry:
helm install infrahub -f values.yml oci://registry.opsmill.io/opsmill/chart/infrahub-enterprise
Verify the installation by checking that all pods are running:
kubectl get pods -l app=infrahub
Related resources
- Database backup and restore - Learn how to backup and restore your Infrahub database
- High availability architecture - Understand resilient deployment architectures
- Local demo environment - Explore the demo environment configuration
- Hardware requirements - Review system requirements