From 44c0fe4452e1ad02ea19fee14cfc2b589fbb9e5d Mon Sep 17 00:00:00 2001 From: Pete Crocker Date: Sat, 7 Jun 2025 18:35:33 +0100 Subject: [PATCH 1/3] add docs for service catalog --- README.md | 19 ++++--- docs/docs-service-catalog/readme.mdx | 77 ++++++++++++++++++++++++++++ docs/docusaurus.config.ts | 16 ++++++ docs/sidebars-service-catalog.ts | 9 ++++ 4 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 docs/docs-service-catalog/readme.mdx create mode 100644 docs/sidebars-service-catalog.ts diff --git a/README.md b/README.md index c7bd191..b3f2095 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ tasks.py labeler.yml labels.yml workflows/ - ci.yml (only adding part) + ci.yml ## only adding part sync-docs.yml ``` @@ -63,22 +63,25 @@ tasks.py docs/ docusaurus.config.ts sidebars.ts - docs/ <โ€” Put docs here + docs/ ## Put docs here .github/ workflows/ - ci.yml (only adding part) - sync-docs.yml (paths) + ci.yml ## only adding part + sync-docs.yml ## paths ``` - `chmod 755 .github/build-docs.sh` -- In `infrahub-docs`: +### In `infrahub-docs` modify the following ```console -docs/sidebars-.ts -docs/docs-//readme.mdx <-- Placeholder -docs/docusaurus.config.ts <-- Add a plugin and navbar entry +touch docs/sidebars-.ts +mkdir docs/docs- +touch docs/docs-/readme.mdx ### Placeholder +vi docs/docusaurus.config.ts ### Add a plugin and navbar entry ``` +### Remaining tasks + - Setup Cloudflare Pages Integration - Create PRs and test diff --git a/docs/docs-service-catalog/readme.mdx b/docs/docs-service-catalog/readme.mdx new file mode 100644 index 0000000..eb8c85d --- /dev/null +++ b/docs/docs-service-catalog/readme.mdx @@ -0,0 +1,77 @@ +--- +title: PoC for Service Catalog +--- + +import CodeBlock from '@theme/CodeBlock'; + +This repository is a proof of concept for service catalog using Infrahub and Streamlit. + +## Running the demo + +### Clone the repository + +Clone the GitHub repository to the server you will run this demo on: + +```shell +git clone https://github.com/opsmill/poc-service-catalog.git +cd poc-service-catalog +``` + +### Prerequisites + +Before you get started, make sure the following tools are installed: + +- โœ… **Infrahub Docker Compose Requirements** + Follow the [Infrahub installation guide](https://docs.infrahub.app/guides/installation#docker-compose) to set up the necessary Docker Compose environment. + +- ๐Ÿ **Poetry** + Install Poetry by following the [official installation guide](https://python-poetry.org/docs). + +- ๐Ÿงช **Containerlab (For Lab Testing)** + If you plan to run lab topologies, you'll also need [Containerlab](https://containerlab.dev/install/). + +### Set environmental variables + +```shell +export INFRAHUB_ADDRESS="http://localhost:8000" +export INFRAHUB_API_TOKEN="06438eb2-8019-4776-878c-0941b1f1d1ec" +``` + +### Install the Infrahub SDK + +Our demos use [poetry](https://python-poetry.org/) to manage the Python environment. + +```shell +poetry install +``` + +### Start Infrahub + +```shell +poetry run invoke start +``` + +### Load schema and data into Infrahub + +```shell +infrahubctl schema load schemas/ +infrahubctl object load data/ +``` + +### Connect read-only repository + +```shell +infrahubctl repository add --ref main --read-only infrahub-demo https://github.com/opsmill/poc-service-catalog.git +``` + +### Spin service catalog app + +```shell +streamlit run service_catalog/๐Ÿ _Home_Page.py` +``` + +### Login + +๐Ÿ‘‰ Login to [Infrahub UI](http://localhost:8000/login) on port `8000` with username `admin` and password `infrahub` + +๐Ÿ‘‰ You can connect to [Service catalog](http://localhost:8501/) on port `8501` diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index ff4ff85..102dc00 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -174,6 +174,16 @@ const config: Config = { sidebarPath: './sidebars-infrahubctl.ts', }, ], + [ + '@docusaurus/plugin-content-docs', + { + id: 'docs-service-catalog', + path: 'docs-service-catalog', + routeBasePath: 'service-catalog', + sidebarCollapsed: false, + sidebarPath: './sidebars-service-catalog.ts', + }, + ], ], themes: [ [ @@ -260,6 +270,12 @@ const config: Config = { label: "demo-dc-fabric", docsPluginId: "docs-demo", }, + { + type: "docSidebar", + sidebarId: "servicecatalogSidebar", + label: "poc-service-catalog", + docsPluginId: "docs-service-catalog", + }, { type: "docSidebar", sidebarId: "schemaSidebar", diff --git a/docs/sidebars-service-catalog.ts b/docs/sidebars-service-catalog.ts new file mode 100644 index 0000000..1b87bd0 --- /dev/null +++ b/docs/sidebars-service-catalog.ts @@ -0,0 +1,9 @@ +import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; + +const sidebars: SidebarsConfig = { + servicecatalogSidebar: [ + 'readme', + ] +}; + +export default sidebars; From 2c8f5db87806aa5c51557657b6bd687ca8f4a2f3 Mon Sep 17 00:00:00 2001 From: Pete Crocker Date: Sat, 7 Jun 2025 18:45:40 +0100 Subject: [PATCH 2/3] fixes --- .vale/styles/spelling-exceptions.txt | 1 + docs/docs/getting-started/next-steps.mdx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.vale/styles/spelling-exceptions.txt b/.vale/styles/spelling-exceptions.txt index 9df918b..4abab69 100644 --- a/.vale/styles/spelling-exceptions.txt +++ b/.vale/styles/spelling-exceptions.txt @@ -124,6 +124,7 @@ schema_mapping scrollbar scrollable sdk +Streamlit subcommand subnet subtyping diff --git a/docs/docs/getting-started/next-steps.mdx b/docs/docs/getting-started/next-steps.mdx index 6947221..817bf17 100644 --- a/docs/docs/getting-started/next-steps.mdx +++ b/docs/docs/getting-started/next-steps.mdx @@ -96,7 +96,7 @@ Then you can connect the repository to Infrahub using the Infrahub CLI or the we -## Going Further +## Going further :::success From 401b6341fba6e1aa98b37fa41b4a987351afb415 Mon Sep 17 00:00:00 2001 From: Pete Crocker Date: Mon, 9 Jun 2025 16:50:49 +0100 Subject: [PATCH 3/3] change repo name --- docs/docs-service-catalog/readme.mdx | 6 +++--- docs/docusaurus.config.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs-service-catalog/readme.mdx b/docs/docs-service-catalog/readme.mdx index eb8c85d..248bd9a 100644 --- a/docs/docs-service-catalog/readme.mdx +++ b/docs/docs-service-catalog/readme.mdx @@ -13,8 +13,8 @@ This repository is a proof of concept for service catalog using Infrahub and Str Clone the GitHub repository to the server you will run this demo on: ```shell -git clone https://github.com/opsmill/poc-service-catalog.git -cd poc-service-catalog +git clone https://github.com/opsmill/infrahub-demo-service-catalog.git +cd infrahub-demo-service-catalog ``` ### Prerequisites @@ -61,7 +61,7 @@ infrahubctl object load data/ ### Connect read-only repository ```shell -infrahubctl repository add --ref main --read-only infrahub-demo https://github.com/opsmill/poc-service-catalog.git +infrahubctl repository add --ref main --read-only infrahub-demo https://github.com/opsmill/infrahub-demo-service-catalog.git ``` ### Spin service catalog app diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 102dc00..99d78c9 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -179,7 +179,7 @@ const config: Config = { { id: 'docs-service-catalog', path: 'docs-service-catalog', - routeBasePath: 'service-catalog', + routeBasePath: 'demo-service-catalog', sidebarCollapsed: false, sidebarPath: './sidebars-service-catalog.ts', }, @@ -273,7 +273,7 @@ const config: Config = { { type: "docSidebar", sidebarId: "servicecatalogSidebar", - label: "poc-service-catalog", + label: "demo-service-catalog", docsPluginId: "docs-service-catalog", }, {