-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
102 lines (82 loc) · 2.78 KB
/
Copy pathjustfile
File metadata and controls
102 lines (82 loc) · 2.78 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
export KUBECONFIG := `pwd`+"/examples/kubernetes/kubeconfig/kubeconfig.yaml"
export DOCKER_BUILDKIT := "1"
export RUST_BACKTRACE := "1"
# Default recipe to display help
default:
@just --list
##########################################
build:
nix build .#default
build-docker:
nix build .#dockerImage
# Update the cargo version, create a new git tag, and push the changes
release type='minor':
cargo release \
--no-publish \
--sign-commit \
--sign-tag \
--no-push \
--execute \
{{type}}
##########################################
# Start the Kubernetes cluster.
kube-start:
cd examples/kubernetes && docker-compose up --detach
# Setup and start the k8s dashboard
kube-setup: kube-start
#!/usr/bin/env bash
set -e
until [ -f "$KUBECONFIG" ] && kubectl --kubeconfig="$KUBECONFIG" get nodes &>/dev/null; do
echo "Waiting for kubeconfig ($KUBECONFIG) to be created..."
sleep 5
done
# Wait for the cluster to be ready.
kubectl --kubeconfig="$KUBECONFIG" wait \
--for=condition=ready node \
--all \
--timeout=60s
kube-create-crd:
cargo run -- export -r server -t crd -f yaml > examples/kubernetes/manifests/CRD.MCPServer.yaml
cargo run -- export -r pool -t crd -f yaml > examples/kubernetes/manifests/CRD.MCPPool.yaml
# Apply the manifests
kube-apply:
kubectl --kubeconfig="$KUBECONFIG" apply \
--filename examples/kubernetes/manifests
kube:
@just kube-start
@just kube-setup
@just kube-create-crd
@just kube-apply
##########################################
# Start the operator
operator:
cargo watch -s 'clear && cargo run -- operator --log-level trace --log-format detailed --show-backtrace'
# Start the gateway API
gateway:
cargo watch -s 'clear && cargo run -- gateway --port 8080 --log-level trace --log-format detailed --show-backtrace'
# Start the manager API
manager:
cargo watch -s 'clear && cargo run -- manager --port 8081 --log-level trace --log-format detailed --show-backtrace'
##########################################
# Build the Docker image
docker-build:
nix build .#dockerImage
docker load < result
rm result
# Run the NMCP operator in Docker
docker-run-operator kubeconfig_path=KUBECONFIG:
@just docker-build
docker run --rm \
--volume {{kubeconfig_path}}:/app/kubeconfig.yaml \
nwrx/nmcp:next operator \
--kubeconfig /app/kubeconfig.yaml
# Run the NMCP gateway in Docker
docker-run-gateway kubeconfig_path=KUBECONFIG port='8080':
@just docker-build
docker run --rm \
--volume {{kubeconfig_path}}:/app/kubeconfig.yaml \
-p {{port}}:{{port}} \
nwrx/nmcp:next gateway \
--kubeconfig /app/kubeconfig.yaml \
--port {{port}} \
--host 0.0.0.0