Skip to content

Commit bde6d31

Browse files
committed
better bootstrap
1 parent 0a7d4b1 commit bde6d31

File tree

5 files changed

+61
-16
lines changed

5 files changed

+61
-16
lines changed

docs/docs/developer-guide.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ uv sync
483483
uv run invoke start
484484
485485
# Load bootstrap data
486-
./scripts/bootstrap.sh
486+
uv run invoke bootstrap
487487
```
488488

489489
### Making changes

docs/docs/enterprise.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ uv run infrahubctl menu load menu
102102
uv run infrahubctl object load objects/bootstrap
103103
```
104104

105-
Or use the bootstrap script:
105+
Or use the bootstrap command:
106106

107107
```bash
108-
./scripts/bootstrap.sh
108+
uv run invoke bootstrap
109109
```
110110

111111
## Switching back to Community edition

docs/docs/install.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ Now that Infrahub is running, load the demo schemas and data. You can use the au
115115

116116
### Option A: automated bootstrap (recommended)
117117

118-
Run the bootstrap script to load everything in one command:
118+
Run the bootstrap command to load everything in one step:
119119

120120
```bash
121-
uv run ./scripts/bootstrap.sh
121+
uv run invoke bootstrap
122122
```
123123

124-
This script performs all the steps in Option B automatically.
124+
This command performs all the steps in Option B automatically.
125125

126126
### Option B: manual bootstrap
127127

scripts/bootstrap.sh

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,66 @@
11
#!/bin/bash
22
BRANCH=${1:-main}
33

4-
echo "Load schemas"
4+
echo ""
5+
echo "============================================================"
6+
echo " Infrahub Demo Bootstrap"
7+
echo "============================================================"
8+
echo " Branch: $BRANCH"
9+
echo "============================================================"
10+
echo ""
11+
12+
echo "[1/7] Loading schemas..."
513
uv run infrahubctl schema load schemas --branch $BRANCH
14+
echo "✓ Schemas loaded successfully"
15+
echo ""
616

7-
echo "Load menu"
17+
echo "[2/7] Loading menu definitions..."
818
uv run infrahubctl menu load menu --branch $BRANCH
19+
echo "✓ Menu loaded successfully"
20+
echo ""
921

10-
echo "Load initial data"
22+
echo "[3/7] Loading bootstrap data (locations, platforms, roles, etc.)..."
1123
uv run infrahubctl object load objects/bootstrap/ --branch $BRANCH
24+
echo "✓ Bootstrap data loaded successfully"
25+
echo ""
1226

13-
echo "Load security data"
27+
echo "[4/7] Loading security data (zones, policies, rules)..."
1428
uv run infrahubctl object load objects/security/ --branch $BRANCH
29+
echo "✓ Security data loaded successfully"
30+
echo ""
1531

16-
echo "Populate security relationships"
32+
echo "[5/7] Populating security relationships..."
1733
uv run python scripts/populate_security_relationships.py
34+
echo "✓ Security relationships populated successfully"
35+
echo ""
1836

19-
echo "Add demo repository"
20-
uv run infrahubctl repository add DEMO https://github.com/opsmill/infrahub-demo.git --ref main --read-only --ref main || echo "Repository already exists, skipping..."
37+
echo "[6/7] Adding demo repository..."
38+
uv run infrahubctl repository add DEMO https://github.com/opsmill/infrahub-demo.git --ref main --read-only --ref main || echo "⚠ Repository already exists, skipping..."
39+
echo "✓ Repository added"
40+
echo ""
2141

22-
echo "Wait for repo sync - let's sleep for 120 seconds"
23-
sleep 120
42+
echo "[7/7] Waiting for repository sync (120 seconds)..."
43+
for i in {1..12}; do
44+
echo -n "."
45+
sleep 10
46+
done
47+
echo ""
48+
echo "✓ Repository sync complete"
49+
echo ""
2450

25-
echo "Add event actions"
51+
echo "Loading event actions..."
2652
uv run infrahubctl object load objects/events/ --branch $BRANCH
53+
echo "✓ Event actions loaded successfully"
54+
echo ""
55+
56+
echo "============================================================"
57+
echo " Bootstrap Complete!"
58+
echo "============================================================"
59+
echo " All data has been loaded into Infrahub"
60+
echo " Branch: $BRANCH"
61+
echo " Next steps:"
62+
echo " - Create a branch: uv run infrahubctl branch create <name>"
63+
echo " - Load a DC design: uv run infrahubctl object load objects/dc-cisco-s.yml --branch <name>"
64+
echo "============================================================"
65+
echo ""
2766

tasks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ def load_objects(
8080
context.run(f"infrahubctl object load {path} --branch {branch}")
8181

8282

83+
@task(optional=["branch"])
84+
def bootstrap(context: Context, branch: str = "main") -> None:
85+
"""Run the complete bootstrap process (schemas, menu, data, security, repository)."""
86+
context.run(f"./scripts/bootstrap.sh {branch}")
87+
88+
8389
@task
8490
def destroy(context: Context) -> None:
8591
"""Destroy all containers."""

0 commit comments

Comments
 (0)