Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ make devbox-stop

`FLYTE_DEV=True` is required when you intend to run the manager locally — it disables the in-cluster manager so your local process can take over. The value is case-insensitive. `make devbox-run` writes a kubeconfig pointing at the devbox cluster in global kubeconfig, so `kubectl` will target it automatically.

`APPLE_SILICON=True` activates the Apple MLX bridge (requires an M-series Mac).

@Icewind52 Icewind52 Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: make -C manager run needs APPLE_SILICON=True too, but CONTRIBUTING.md doesn't mention it. Without the flag, the manager uses plain config.yaml even with the bridge running, so Apple Silicon tasks fail with APPLE_SILICON_NOT_AVAILABLE, and the message says the backend has no bridge. Could we add make -C manager run APPLE_SILICON=True to this doc?

### Build and Run the Manager

With the devbox running, start the manager locally:
Expand Down
58 changes: 58 additions & 0 deletions docker/devbox-bundled/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,57 @@ build-gpu: build
--build-arg BASE_IMAGE=base \
--tag flyte-devbox:gpu-latest .

APPLE_SILICON_PORT ?= 30090
FLYTE_PYTHON ?= uv run --isolated --no-project --with flyte python
APPLE_SILICON_DIR := $(HOME)/.flyte/apple-silicon
APPLE_SILICON_PORT_ENV = --env FLYTE_DEVBOX_APPLE_SILICON_PORT=$(APPLE_SILICON_PORT)
APPLE_SILICON_SECRET_ENV = --env FLYTE_DEVBOX_APPLE_SILICON_TOKEN_SECRET=$$(cat $(APPLE_SILICON_DIR)/secret)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we use flyte start devbox to execute on apple silicon, we will start the devbox on a local reachable only port here to prevent access from others devices in the same intranet. We should do the same here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
APPLE_SILICON_SECRET_ENV = --env FLYTE_DEVBOX_APPLE_SILICON_TOKEN_SECRET=$$(cat $(APPLE_SILICON_DIR)/secret)
APPLE_SILICON_SECRET_ENV = --env FLYTE_DEVBOX_APPLE_SILICON_TOKEN_SECRET=$$(cat $(APPLE_SILICON_DIR)/secret)
APPLE_SILICON_PUBLISH_IP = $(if $(filter True,$(APPLE_SILICON)),127.0.0.1:)


if_mlx_bridge_healthy = curl -fs -o /dev/null http://127.0.0.1:$(APPLE_SILICON_PORT)/healthz

.PHONY: start-mlx-bridge
start-mlx-bridge:
@if [ ! -d $(APPLE_SILICON_DIR) ]; then \
mkdir -p $(APPLE_SILICON_DIR); \
echo "$(APPLE_SILICON_DIR) not found, create dir"; \
fi
@if $(if_mlx_bridge_healthy); then \
echo "Using existing MLX bridge on 127.0.0.1:$(APPLE_SILICON_PORT)"; \
exit 0; \
fi; \
nohup $(FLYTE_PYTHON) -m flyte._internal.apple_silicon._bridge --port $(APPLE_SILICON_PORT) \
--state-dir $(APPLE_SILICON_DIR) </dev/null >>$(APPLE_SILICON_DIR)/bridge.log 2>&1 & \
pid=$$!; \
echo "{\"pid\": $$pid, \"port\": $(APPLE_SILICON_PORT)}" > $(APPLE_SILICON_DIR)/bridge.json; \
for i in $$(seq 60); do \
if $(if_mlx_bridge_healthy); then \
break; \
fi; \
sleep 0.5; \
done; \
if $(if_mlx_bridge_healthy); then \
echo "MLX bridge is serving on 127.0.0.1:$(APPLE_SILICON_PORT)"; \
else \
echo "MLX bridge failed to start, log is at $(APPLE_SILICON_DIR)/bridge.log"; \
tail -5 $(APPLE_SILICON_DIR)/bridge.log; \
exit 1; \
fi

.PHONY: stop-mlx-bridge
stop-mlx-bridge:
@pid=$$(sed -n 's/.*"pid": *\([0-9]*\).*/\1/p' $(APPLE_SILICON_DIR)/bridge.json 2>/dev/null); \
rm -f $(APPLE_SILICON_DIR)/bridge.json; \
if [ -z "$$pid" ]; then \
echo "MLX bridge pid is empty, skip it"; \
else \
if ps -o command= -p $$pid | grep -q apple_silicon._bridge; then \
kill $$pid; \
echo "MLX bridge stopped (pid $$pid)"; \
else \
echo "MLX bridge (pid $$pid) not found, skip it"; \
fi; \
fi

override DEVBOX_NAME := flyte-devbox
override DEVBOX_CONTEXT := flyte-devbox

Expand All @@ -158,16 +209,22 @@ override DEVBOX_CONTEXT := flyte-devbox
# 30300 - Grafana (only serves something after `make monitoring`)
.PHONY: start
start: FLYTE_DEVBOX_IMAGE := flyte-devbox:latest
start: APPLE_SILICON := False

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking maybe we could also make this case-insensitive like #8236 does.

start: FLYTE_DEV := False
start:
[ -n "$(shell docker volume ls --filter name=^flyte-devbox$$ --format {{.Name}})" ] || \
docker volume create flyte-devbox
@if [ -z "$(shell docker ps --filter name=^flyte-devbox$$ --format {{.Names}})" ]; then \
if [ "$(APPLE_SILICON)" = True ]; then \
$(MAKE) --no-print-directory start-mlx-bridge || exit 1; \
fi; \
rm -f $(PWD)/.kube/kubeconfig; \
docker run --detach --rm --privileged --name flyte-devbox \
--add-host "host.docker.internal:host-gateway" \
--env FLYTE_DEV=$(FLYTE_DEV) \
--env K3S_KUBECONFIG_OUTPUT=/.kube/kubeconfig \
$(if $(filter True,$(APPLE_SILICON)),$(APPLE_SILICON_PORT_ENV)) \
$(if $(filter True,$(APPLE_SILICON)),$(APPLE_SILICON_SECRET_ENV)) \
--volume $(PWD)/.kube:/.kube \
--volume flyte-devbox:/var/lib/flyte/storage \
--publish "6443":"6443" \
Expand Down Expand Up @@ -251,4 +308,5 @@ monitoring-clean:

.PHONY: stop
stop:
@$(MAKE) --no-print-directory stop-mlx-bridge
docker stop --time 5 flyte-devbox
49 changes: 47 additions & 2 deletions go.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ BIN_DIR ?= bin
BIN_NAME ?= $(SERVICE_NAME)
GOLANGCI_LINT_VERSION ?= v2.14.0
LOCALBIN ?= $(shell pwd)/bin
APPLE_SILICON_PORT ?= 30090
APPLE_SILICON_DIR := $(HOME)/.flyte/apple-silicon
APPLE_SILICON_CONFIG := $(APPLE_SILICON_DIR)/$(SERVICE_NAME)-config.yaml

# ANSI color codes for prettier output
COLOR_RESET := \033[0m
Expand Down Expand Up @@ -118,12 +121,54 @@ bench: ## Run benchmarks
.PHONY: run
run: build-fast ## Build and run the service
@echo "$(COLOR_GREEN)Running $(SERVICE_NAME)...$(COLOR_RESET)"
@./$(BIN_DIR)/$(BIN_NAME) $(RUN_ARGS)
@if [ "$(APPLE_SILICON)" != True ]; then \
./$(BIN_DIR)/$(BIN_NAME) $(RUN_ARGS); \
else \
$(MAKE) --no-print-directory apple-silicon-config && \
./$(BIN_DIR)/$(BIN_NAME) --config $(APPLE_SILICON_CONFIG); \
fi

.PHONY: run-dev
run-dev: ## Run service directly with go run (no build)
@echo "$(COLOR_GREEN)Running $(SERVICE_NAME) (dev mode)...$(COLOR_RESET)"
@go run $(CMD_PATH) $(RUN_ARGS)
@if [ "$(APPLE_SILICON)" != True ]; then \
go run $(CMD_PATH) $(RUN_ARGS); \
else \
$(MAKE) --no-print-directory apple-silicon-config && \
go run $(CMD_PATH) --config $(APPLE_SILICON_CONFIG); \
fi

.PHONY: apple-silicon-config
apple-silicon-config: ## Generate a config with the MLX bridge settings
@if [ ! -s $(APPLE_SILICON_DIR)/secret ]; then \
echo "$(APPLE_SILICON_DIR)/secret not found, run 'make devbox-run FLYTE_DEV=True APPLE_SILICON=True' first"; \
exit 1; \
fi
@ip=$$(docker exec flyte-devbox cat /etc/hosts | awk '$$2 == "host.docker.internal" { print $$1; exit }'); \
if [ -z "$$ip" ]; then \
echo "host.docker.internal not found in flyte-devbox, is the devbox running?"; \
exit 1; \
fi; \
type=$$(kubectl --context flyte-devbox -n flyte get svc flyte-binary-http -o jsonpath='{.spec.type}' 2>/dev/null); \
if [ -z "$$type" ]; then \
kubectl --context flyte-devbox -n flyte create service externalname flyte-binary-http \
--external-name flyte-devbox-local.flyte.svc.cluster.local --tcp 8090:8090 >/dev/null || exit 1; \
echo "Created flyte-binary-http in flyte-devbox, pointing at the manager on the host"; \
elif [ "$$type" != ExternalName ]; then \
echo "flyte-binary-http is already served inside flyte-devbox, run 'make devbox-run FLYTE_DEV=True APPLE_SILICON=True' first"; \
exit 1; \
fi; \
umask 077; \
{ \
echo ' apple-silicon-bridge:'; \
echo " endpoint: \"http://$$ip:$(APPLE_SILICON_PORT)\""; \
echo " token-secret: \"$$(cat $(APPLE_SILICON_DIR)/secret)\""; \
echo ' host-platform: "darwin/arm64"'; \
} | sed -e '/^ k8s:$$/r /dev/stdin' \
-e 's|rustfs-svc\.flyte\.svc\.cluster\.local:9000|rustfs-svc.flyte:9000|' \
-e '/_U_EP_OVERRIDE/s|host\.docker\.internal:8090|flyte-binary-http.flyte:8090|' \
config.yaml > $(APPLE_SILICON_CONFIG); \
echo "Apple MLX bridge config set successfully, at $(APPLE_SILICON_CONFIG)"

##@ Cleanup

Expand Down
Loading