You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: serverless-fleets/README.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -558,6 +558,43 @@ An IBM Cloud Logs instance is being setup and enabled by default during the auto
558
558
559
559

560
560
561
+
### How to customize fleet workers
562
+
563
+
> **Note:** This is an experimental feature to unlock specific use cases and might change or will be deprecated.
564
+
565
+
Fleet workers can be customized using startup hooks to prepare the environment before tasks are executed. These hooks are configured through special environment variables that you set when creating the fleet. This customization capability allows you to install additional software, pull container images, or configure services that your tasks will use—all automatically before your workload begins processing.
566
+
567
+
#### Example 1: Running Ollama on Fleet Workers
568
+
569
+
See `run_hook_ollama` for a complete example that demonstrates:
570
+
- Running Ollama (local LLM runtime) on fleet workers
571
+
- Automatic GPU detection and configuration
572
+
- Preloading AI models during worker startup
573
+
- Using the environment variable `__CE_INTERNAL_HOOK_AFTER_STARTUP` to execute setup scripts
574
+
575
+
Key environment variables used:
576
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP`: Script to run after worker startup
577
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP_RETRY_LIMIT=3`: Retry attempts if hook fails
578
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP_MAX_EXECUTION_TIME=30m`: Maximum hook execution time
579
+
580
+
#### Example 2: Running Podman-in-Podman
581
+
582
+
See `run_hook_podman_in_podman` for a complete example that demonstrates:
583
+
- Running Podman inside fleet workers for nested containerization
584
+
- Preloading container images during startup
585
+
- Using privileged containers and host path mounts
586
+
587
+
Additional environment variables used:
588
+
- `__CE_INTERNAL_PRIVILEGED_CONTAINER=true`: Enable privileged mode (required for nested containers)
589
+
- `__CE_INTERNAL_HOSTPATH_MOUNTS=/var/lib/containers:/var/lib/containers`: Mount host paths
590
+
591
+
**Available Hook Environment Variables:**
592
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP`: The script to execute after worker startup
593
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP_RETRY_LIMIT`: Number of retry attempts if the hook fails
594
+
- `__CE_INTERNAL_HOOK_AFTER_STARTUP_MAX_EXECUTION_TIME`: Maximum time allowed for hook execution
0 commit comments