-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulti-team-setup.sh
More file actions
executable file
·76 lines (63 loc) · 2.07 KB
/
Copy pathmulti-team-setup.sh
File metadata and controls
executable file
·76 lines (63 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# Multi-Team Setup Demo
#
# Demonstrates Mantle's Phase 6 multi-tenancy and RBAC features.
# This script creates teams, users with different roles, and API keys,
# then shows how to run a workflow scoped to a team.
#
# Prerequisites:
# - Mantle binary built (make build)
# - Postgres running (docker compose up -d)
# - Migrations applied (./mantle init)
#
# This is a demonstration script — it requires a running database to execute.
set -euo pipefail
MANTLE="./mantle"
echo "==> Creating teams..."
$MANTLE teams create --name engineering
$MANTLE teams create --name data-science
echo ""
echo "==> Creating users with different roles..."
# Team owner — can manage team members and workflows
$MANTLE users create \
--email alice@example.com \
--name "Alice Chen" \
--team engineering \
--role team_owner
# Operator — can run and monitor workflows
$MANTLE users create \
--email bob@example.com \
--name "Bob Martinez" \
--team engineering \
--role operator
# Another team with its own owner
$MANTLE users create \
--email carol@example.com \
--name "Carol Kim" \
--team data-science \
--role team_owner
echo ""
echo "==> Listing users by team..."
$MANTLE users list --team engineering
$MANTLE users list --team data-science
echo ""
echo "==> Creating API keys for programmatic access..."
# Generate keys for CI/CD and automation
$MANTLE users api-key --email alice@example.com --key-name ci-deploy
$MANTLE users api-key --email bob@example.com --key-name monitoring
echo ""
echo "==> Applying a workflow (scoped to team via API key)..."
$MANTLE apply examples/scheduled-health-check.yaml
echo ""
echo "==> Running the workflow..."
$MANTLE run scheduled-health-check
echo ""
echo "========================================"
echo " Multi-tenant setup complete!"
echo "========================================"
echo ""
echo "Each team's workflows, executions, and secrets are isolated."
echo "Users authenticate via API keys when using the REST API:"
echo ""
echo " curl -H 'Authorization: Bearer mtl_...' http://localhost:8080/api/v1/workflows"
echo ""