data fixes, partial custom indicator support
This commit is contained in:
81
bin/dev
81
bin/dev
@@ -217,16 +217,18 @@ deploy_services() {
|
||||
# Update configs
|
||||
echo -e "${GREEN}→${NC} Updating configs..."
|
||||
|
||||
# Template the gateway-config.yaml with actual image tags
|
||||
sed -i "s/SANDBOX_TAG_PLACEHOLDER/$SANDBOX_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/SIDECAR_TAG_PLACEHOLDER/$SIDECAR_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
# Template gateway-config.yaml with actual image tags (backup first for safe restore)
|
||||
local _gw_bak
|
||||
_gw_bak=$(mktemp)
|
||||
cp "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml" "$_gw_bak"
|
||||
sed -i "s|sandbox_image: dexorder/ai-sandbox:.*|sandbox_image: dexorder/ai-sandbox:$SANDBOX_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s|sidecar_image: dexorder/ai-lifecycle-sidecar:.*|sidecar_image: dexorder/ai-lifecycle-sidecar:$SIDECAR_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
|
||||
"$SCRIPT_DIR/config-update" dev
|
||||
|
||||
# Create a temporary kustomization overlay with image tags
|
||||
echo -e "${GREEN}→${NC} Setting image tags in kustomization..."
|
||||
cat >> kustomization.yaml <<EOF
|
||||
|
||||
# Image tags (added by bin/dev)
|
||||
images:
|
||||
- name: dexorder/ai-relay
|
||||
@@ -258,9 +260,9 @@ EOF
|
||||
# Clean up the appended image tags from kustomization.yaml
|
||||
sed -i '/# Image tags (added by bin\/dev)/,$d' kustomization.yaml
|
||||
|
||||
# Restore gateway-config.yaml placeholders
|
||||
sed -i "s/$SANDBOX_TAG/SANDBOX_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/$SIDECAR_TAG/SIDECAR_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
# Restore gateway-config.yaml from backup
|
||||
cp "$_gw_bak" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
rm "$_gw_bak"
|
||||
|
||||
echo -e "${GREEN}✓ Services deployed${NC}"
|
||||
|
||||
@@ -583,9 +585,11 @@ deploy_service() {
|
||||
gateway)
|
||||
image_name="dexorder/ai-gateway"
|
||||
image_tag="$GATEWAY_TAG"
|
||||
# Also need to template gateway-config.yaml
|
||||
sed -i "s/SANDBOX_TAG_PLACEHOLDER/$SANDBOX_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/SIDECAR_TAG_PLACEHOLDER/$SIDECAR_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
# Also need to template gateway-config.yaml (backup for safe restore)
|
||||
_gw_bak_single=$(mktemp)
|
||||
cp "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml" "$_gw_bak_single"
|
||||
sed -i "s|sandbox_image: dexorder/ai-sandbox:.*|sandbox_image: dexorder/ai-sandbox:$SANDBOX_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s|sidecar_image: dexorder/ai-lifecycle-sidecar:.*|sidecar_image: dexorder/ai-lifecycle-sidecar:$SIDECAR_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
"$SCRIPT_DIR/config-update" dev
|
||||
;;
|
||||
web)
|
||||
@@ -604,7 +608,6 @@ deploy_service() {
|
||||
|
||||
# Create a temporary kustomization overlay with ONLY this service's image tag
|
||||
cat >> kustomization.yaml <<EOF
|
||||
|
||||
# Image tags (added by bin/dev)
|
||||
images:
|
||||
- name: $image_name
|
||||
@@ -616,10 +619,10 @@ EOF
|
||||
# Clean up the appended image tags from kustomization.yaml
|
||||
sed -i '/# Image tags (added by bin\/dev)/,$d' kustomization.yaml
|
||||
|
||||
# Restore gateway-config.yaml placeholders if we modified it
|
||||
# Restore gateway-config.yaml from backup if we modified it
|
||||
if [ "$service" == "gateway" ]; then
|
||||
sed -i "s/$SANDBOX_TAG/SANDBOX_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/$SIDECAR_TAG/SIDECAR_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
cp "$_gw_bak_single" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
rm "$_gw_bak_single"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✓ $service deployed${NC}"
|
||||
@@ -685,6 +688,19 @@ case "$COMMAND" in
|
||||
fi
|
||||
done
|
||||
|
||||
# Sandbox restart requires gateway to redeploy with the new sandbox image tag.
|
||||
# If gateway wasn't explicitly listed, rebuild and deploy it automatically.
|
||||
if [ "$sandbox_requested" == "1" ]; then
|
||||
gateway_in_list=0
|
||||
for svc in "${deploy_services_list[@]}"; do
|
||||
[ "$svc" == "gateway" ] && gateway_in_list=1 && break
|
||||
done
|
||||
if [ "$gateway_in_list" == "0" ]; then
|
||||
rebuild_images "gateway"
|
||||
deploy_services_list+=("gateway")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Deploy all non-sandbox services together in one kustomize apply
|
||||
if [ ${#deploy_services_list[@]} -gt 0 ]; then
|
||||
if [ -f "$ROOT_DIR/.dev-image-tag" ]; then
|
||||
@@ -693,18 +709,20 @@ case "$COMMAND" in
|
||||
|
||||
cd "$ROOT_DIR/deploy/k8s/dev"
|
||||
|
||||
# Template gateway-config if gateway is in the list
|
||||
# Template gateway-config if gateway is in the list (backup for safe restore)
|
||||
_ms_gw_bak=""
|
||||
for svc in "${deploy_services_list[@]}"; do
|
||||
if [ "$svc" == "gateway" ]; then
|
||||
sed -i "s/SANDBOX_TAG_PLACEHOLDER/$SANDBOX_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/SIDECAR_TAG_PLACEHOLDER/$SIDECAR_TAG/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
_ms_gw_bak=$(mktemp)
|
||||
cp "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml" "$_ms_gw_bak"
|
||||
sed -i "s|sandbox_image: dexorder/ai-sandbox:.*|sandbox_image: dexorder/ai-sandbox:$SANDBOX_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s|sidecar_image: dexorder/ai-lifecycle-sidecar:.*|sidecar_image: dexorder/ai-lifecycle-sidecar:$SIDECAR_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
"$SCRIPT_DIR/config-update" dev
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Build the images stanza for all services at once
|
||||
echo "" >> kustomization.yaml
|
||||
echo "# Image tags (added by bin/dev)" >> kustomization.yaml
|
||||
echo "images:" >> kustomization.yaml
|
||||
for svc in "${deploy_services_list[@]}"; do
|
||||
@@ -722,18 +740,29 @@ case "$COMMAND" in
|
||||
|
||||
sed -i '/# Image tags (added by bin\/dev)/,$d' kustomization.yaml
|
||||
|
||||
# Restore gateway-config placeholders if gateway was deployed
|
||||
for svc in "${deploy_services_list[@]}"; do
|
||||
if [ "$svc" == "gateway" ]; then
|
||||
sed -i "s/$SANDBOX_TAG/SANDBOX_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s/$SIDECAR_TAG/SIDECAR_TAG_PLACEHOLDER/g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Restore gateway-config from backup if we modified it
|
||||
if [ -n "$_ms_gw_bak" ]; then
|
||||
cp "$_ms_gw_bak" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
rm "$_ms_gw_bak"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Handle sandbox separately
|
||||
if [ "$sandbox_requested" == "1" ]; then
|
||||
if [ -f "$ROOT_DIR/.dev-image-tag" ]; then
|
||||
source "$ROOT_DIR/.dev-image-tag"
|
||||
fi
|
||||
echo -e "${GREEN}→${NC} Updating gateway config with new sandbox image tag ($SANDBOX_TAG)..."
|
||||
cd "$ROOT_DIR/deploy/k8s/dev"
|
||||
_sb_bak=$(mktemp)
|
||||
cp "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml" "$_sb_bak"
|
||||
sed -i "s|sandbox_image: dexorder/ai-sandbox:.*|sandbox_image: dexorder/ai-sandbox:$SANDBOX_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
sed -i "s|sidecar_image: dexorder/ai-lifecycle-sidecar:.*|sidecar_image: dexorder/ai-lifecycle-sidecar:$SIDECAR_TAG|g" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
"$SCRIPT_DIR/config-update" dev
|
||||
cp "$_sb_bak" "$ROOT_DIR/deploy/k8s/dev/configs/gateway-config.yaml"
|
||||
rm "$_sb_bak"
|
||||
echo -e "${GREEN}→${NC} Restarting gateway to pick up new sandbox image tag..."
|
||||
kubectl rollout restart deployment/gateway
|
||||
echo -e "${GREEN}→${NC} Deleting user container deployments in sandbox namespace..."
|
||||
kubectl delete deployments --all -n sandbox 2>/dev/null || true
|
||||
echo -e "${GREEN}✓ User containers will be recreated by gateway on next login${NC}"
|
||||
|
||||
Reference in New Issue
Block a user