Skip to content
Open
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
68 changes: 36 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
markdown: ${{ steps.changes.outputs.markdown_all }}
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
- name: Check for file changes
uses: opsmill/[email protected]
id: changes
Expand All @@ -44,7 +44,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
Expand All @@ -66,7 +66,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
Expand All @@ -82,7 +82,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
- uses: actions/setup-node@v6
with:
node-version: 20
Expand All @@ -91,32 +91,36 @@ jobs:
- name: "Run markdownlint"
run: markdownlint "**/*.{md,mdx}"

# integration-test:
# needs: ["python-lint", "yaml-lint", "markdown-lint"]
# runs-on:
# group: "huge-runners"
# strategy:
# fail-fast: false
# matrix:
# include:
# - os: ubuntu-latest
# timeout-minutes: 60
# env:
# INFRAHUB_DB_TYPE: neo4j
# INFRAHUB_API_TOKEN: '06438eb2-8019-4776-878c-0941b1f1d1ec'
# INFRAHUB_TIMEOUT: 600
# steps:
# - name: "Check out repository code"
# uses: "actions/checkout@v5"
# - name: Install uv
# uses: astral-sh/setup-uv@v7
# with:
# version: "0.9.18"
# - run: uv sync
# - name: "Run tests"
# run: uv run pytest tests/
# env:
# REPOSITORY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
integration-test:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
needs: ["files-changed", "python-lint", "yaml-lint", "markdown-lint"]
runs-on:
group: "huge-runners"
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
timeout-minutes: 60
env:
INFRAHUB_DB_TYPE: neo4j
INFRAHUB_API_TOKEN: '06438eb2-8019-4776-878c-0941b1f1d1ec'
INFRAHUB_TIMEOUT: 600
steps:
- name: "Check out repository code"
uses: "actions/checkout@v6"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.18"
- run: uv sync
- name: "Run tests"
run: uv run pytest tests/ -v
env:
REPOSITORY_TOKEN: ${{ secrets.GITHUB_TOKEN }}

documentation:
defaults:
Expand All @@ -132,7 +136,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
with:
submodules: true
- name: Install NodeJS
Expand Down Expand Up @@ -162,7 +166,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
uses: "actions/checkout@v6"
with:
submodules: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
path: source-repo

- name: Checkout target repository
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
repository: opsmill/infrahub-docs
token: ${{ secrets.PAT_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-infrahub-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
BRANCH_NAME: ${{ matrix.branch-name }}-infrahub-sdk-${{ github.event_name == 'repository_dispatch' && github.event.client_payload.version || github.event.inputs.version }}
steps:
- name: Check out code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-infrahub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
BRANCH_NAME: ${{ matrix.branch-name }}-${{ github.event_name == 'repository_dispatch' && github.event.client_payload.version || github.event.inputs.version }}
steps:
- name: Check out code
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# This Dockerfile serves two purposes:
# 1. It builds a custom Infrahub image with the `service_catalog` python module included. It can now be imported and used within the Infrahub environment (in generators for example).
# 2. It builds a container that runs streamlit to serve the service catalog web application.
ARG INFRAHUB_BASE_VERSION=1.4.3
ARG INFRAHUB_BASE_VERSION=1.6.2
FROM registry.opsmill.io/opsmill/infrahub:${INFRAHUB_BASE_VERSION}

WORKDIR /opt/local
COPY pyproject.toml poetry.lock README.md ./
COPY pyproject.toml uv.lock README.md ./
COPY service_catalog/ service_catalog/

RUN poetry install --no-ansi --no-interaction
# Install service_catalog package and its dependencies into the existing Infrahub venv
# Using uv pip install instead of uv sync to avoid overwriting Infrahub dependencies
RUN uv pip install -e .

WORKDIR /source
WORKDIR /source
6 changes: 3 additions & 3 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
x-infrahub-custom-build: &infrahub_custom_build
image: opsmill/infrahub-demo-service-catalog:${INFRAHUB_BASE_VERSION:-1.4.3}
image: opsmill/infrahub-demo-service-catalog:${INFRAHUB_BASE_VERSION:-1.6.2}
build:
context: .
dockerfile: Dockerfile
args:
INFRAHUB_BASE_VERSION: "${INFRAHUB_BASE_VERSION:-1.4.3}"
INFRAHUB_BASE_VERSION: "${INFRAHUB_BASE_VERSION:-1.6.2}"

services:
service-catalog:
Expand All @@ -15,7 +15,7 @@ services:
INFRAHUB_API_TOKEN: ${INFRAHUB_API_TOKEN:-44af444d-3b26-410d-9546-b758657e026c}
ports:
- 8501:8501
command: poetry run streamlit run /opt/local/service_catalog/🏠_Home_Page.py
command: uv run streamlit run /opt/local/service_catalog/🏠_Home_Page.py
infrahub-server:
<<: *infrahub_custom_build
task-worker:
Expand Down
17 changes: 12 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ x-infrahub-config: &infrahub_config
INFRAHUB_BROKER_USERNAME: &broker_username ${INFRAHUB_BROKER_USERNAME:-infrahub}
INFRAHUB_BROKER_VIRTUALHOST: ${INFRAHUB_BROKER_VIRTUALHOST:-/}
INFRAHUB_CACHE_ADDRESS: ${INFRAHUB_CACHE_ADDRESS:-localhost}
INFRAHUB_CACHE_CLEAN_UP_DEADLOCKS_INTERVAL_MINS: ${INFRAHUB_CACHE_CLEAN_UP_DEADLOCKS_INTERVAL_MINS:-15}
INFRAHUB_CACHE_DATABASE: ${INFRAHUB_CACHE_DATABASE:-0}
INFRAHUB_CACHE_DRIVER: ${INFRAHUB_CACHE_DRIVER:-redis}
INFRAHUB_CACHE_ENABLE: ${INFRAHUB_CACHE_ENABLE:-true}
Expand Down Expand Up @@ -68,8 +69,13 @@ x-infrahub-config: &infrahub_config
INFRAHUB_EXPERIMENTAL_GRAPHQL_ENUMS: ${INFRAHUB_EXPERIMENTAL_GRAPHQL_ENUMS:-false}
INFRAHUB_EXPERIMENTAL_VALUE_DB_INDEX: ${INFRAHUB_EXPERIMENTAL_VALUE_DB_INDEX:-false}
INFRAHUB_GIT_APPEND_GIT_SUFFIX:
INFRAHUB_GIT_GLOBAL_CONFIG_FILE: ${INFRAHUB_GIT_GLOBAL_CONFIG_FILE:-/opt/infrahub/.gitconfig}
INFRAHUB_GIT_IMPORT_SYNC_BRANCH_NAMES:
INFRAHUB_GIT_REPOSITORIES_DIRECTORY: ${INFRAHUB_GIT_REPOSITORIES_DIRECTORY:-repositories}
INFRAHUB_GIT_SYNC_INTERVAL: ${INFRAHUB_GIT_SYNC_INTERVAL:-10}
INFRAHUB_GIT_USER_EMAIL: ${INFRAHUB_GIT_USER_EMAIL:[email protected]}
INFRAHUB_GIT_USER_NAME: ${INFRAHUB_GIT_USER_NAME:-Infrahub}
INFRAHUB_GIT_USE_EXPLICIT_MERGE_COMMIT: ${INFRAHUB_GIT_USE_EXPLICIT_MERGE_COMMIT:-false}
INFRAHUB_HTTP_TIMEOUT: ${INFRAHUB_HTTP_TIMEOUT:-10}
INFRAHUB_HTTP_TLS_CA_BUNDLE:
INFRAHUB_HTTP_TLS_INSECURE: ${INFRAHUB_HTTP_TLS_INSECURE:-false}
Expand Down Expand Up @@ -121,6 +127,7 @@ x-infrahub-config: &infrahub_config
INFRAHUB_WORKFLOW_ENABLE: ${INFRAHUB_WORKFLOW_ENABLE:-true}
INFRAHUB_WORKFLOW_EXTRA_LOGGERS:
INFRAHUB_WORKFLOW_EXTRA_LOG_LEVEL: ${INFRAHUB_WORKFLOW_EXTRA_LOG_LEVEL:-INFO}
INFRAHUB_WORKFLOW_FLOW_RUN_COUNT_CACHE_THRESHOLD: ${INFRAHUB_WORKFLOW_FLOW_RUN_COUNT_CACHE_THRESHOLD:-100000}
INFRAHUB_WORKFLOW_PORT:
INFRAHUB_WORKFLOW_TLS_ENABLED: ${INFRAHUB_WORKFLOW_TLS_ENABLED:-false}
INFRAHUB_WORKFLOW_WORKER_POLLING_INTERVAL: ${INFRAHUB_WORKFLOW_WORKER_POLLING_INTERVAL:-2}
Expand Down Expand Up @@ -170,7 +177,7 @@ services:
- 15692:15692

cache:
image: ${CACHE_DOCKER_IMAGE:-redis:7.2.4}
image: ${CACHE_DOCKER_IMAGE:-redis:7.2.11}
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
Expand Down Expand Up @@ -199,7 +206,7 @@ services:
- 6362:6362

task-manager:
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.4.3}"
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.6.2}"
command: uvicorn --host 0.0.0.0 --port 4200 --factory infrahub.prefect_server.app:create_infrahub_prefect
restart: unless-stopped
depends_on:
Expand All @@ -208,7 +215,7 @@ services:
environment:
PREFECT_API_DATABASE_CONNECTION_URL: postgresql+asyncpg://${INFRAHUB_TASKMANAGER_DB_USER:-postgres}:${INFRAHUB_TASKMANAGER_DB_PASSWORD:-postgres}@task-manager-db:5432/${INFRAHUB_TASKMANAGER_DB_DATABASE:-prefect}
healthcheck:
test: /usr/local/bin/httpx http://localhost:4200/api/health || exit 1
test: curl -s -f -o /dev/null http://localhost:4200/api/health || exit 1
interval: 5s
timeout: 5s
retries: 20
Expand All @@ -232,7 +239,7 @@ services:
retries: 5

infrahub-server:
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.4.3}"
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.6.2}"
restart: unless-stopped
command: >
gunicorn --config backend/infrahub/serve/gunicorn_config.py
Expand Down Expand Up @@ -278,7 +285,7 @@ services:
deploy:
mode: replicated
replicas: 2
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.4.3}"
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.6.2}"
command: prefect worker start --type infrahubasync --pool infrahub-worker --with-healthcheck
restart: unless-stopped
depends_on:
Expand Down
20 changes: 10 additions & 10 deletions docs/docs/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Before you get started, make sure you have these tools installed:
- Or Docker Engine on a Linux VM for server deployments
- Minimum 4GB RAM allocated to Docker

- 🐍 **Poetry**: Python dependency management tool
- Install via the [official installation guide](https://python-poetry.org/docs)
- 🐍 **uv**: Fast Python package and project manager
- Install via the [official installation guide](https://docs.astral.sh/uv/getting-started/installation/)
- Used to manage Python packages and virtual environments
- Version 1.2.0 or higher recommended
- Version 0.4.0 or higher recommended

### System requirements

Expand Down Expand Up @@ -81,10 +81,10 @@ export INFRAHUB_API_TOKEN="06438eb2-8019-4776-878c-0941b1f1d1ec"

### Step 3: Install Python dependencies

Use Poetry to create a virtual environment and install all required Python packages.
Use uv to create a virtual environment and install all required Python packages.

```shell
poetry install
uv sync
```

This command:
Expand All @@ -94,16 +94,16 @@ This command:
- Installs Streamlit for the web portal interface
- Sets up development tools (pytest, ruff, mypy)

:::note First Time Using Poetry?
Poetry automatically manages virtual environments. All subsequent commands should be run with `poetry run` prefix to ensure they use the correct environment.
:::note First time using uv?
uv automatically manages virtual environments. All subsequent commands should be run with `uv run` prefix to ensure they use the correct environment.
:::

### Step 4: Start the application stack

Launch Infrahub and the Service Catalog using Docker Compose. This single command starts multiple services.

```shell
poetry run invoke start
uv run invoke start
```

:::important Why Use Invoke?
Expand All @@ -130,7 +130,7 @@ This command launches:
Connect the demo repository to Infrahub for infrastructure as code workflows.

```shell
poetry run infrahubctl repository add --ref main --read-only infrahub-demo https://github.com/opsmill/infrahub-demo-service-catalog.git
uv run infrahubctl repository add --ref main --read-only infrahub-demo https://github.com/opsmill/infrahub-demo-service-catalog.git
```

#### Why Git integration?
Expand Down Expand Up @@ -196,7 +196,7 @@ Confirm everything is working by accessing both interfaces:

- Ensure Docker is running and has sufficient resources
- Check for port conflicts (8000, 8501, 5432, 6379)
- Run `poetry run invoke destroy` then `poetry run invoke start` to reset
- Run `uv run invoke destroy` then `uv run invoke start` to reset

### Schema load fails

Expand Down
29 changes: 21 additions & 8 deletions generators/implement_dedicated_internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@
from infrahub_sdk.generator import InfrahubGenerator
from infrahub_sdk.node import InfrahubNode
from infrahub_sdk.protocols import CoreIPPrefixPool, CoreNumberPool
from service_catalog.protocols_async import (
DcimDevice,
DcimInterfaceL3,
IpamIPAddress,
IpamPrefix,
IpamVLAN,
ServiceDedicatedInternet,
)

try:
# When imported as part of a package (e.g., within Infrahub)
from .protocols import (
DcimDevice,
DcimInterfaceL3,
IpamIPAddress,
IpamPrefix,
IpamVLAN,
ServiceDedicatedInternet,
)
except ImportError:
# When imported directly (e.g., in unit tests)
from protocols import ( # type: ignore[no-redef]
DcimDevice,
DcimInterfaceL3,
IpamIPAddress,
IpamPrefix,
IpamVLAN,
ServiceDedicatedInternet,
)

ACTIVE_STATUS = "active"
SERVICE_VLAN_POOL: str = "Customer vlan pool"
Expand Down
Loading
Loading