rubenf
rubenf12mo ago

Ask Inkeep

@Ask Inkeep how can I use init scripts
3 Replies
Ask Inkeep
Ask Inkeep12mo ago
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you in less than a minute. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Preinstall Binaries * Workers and Worker Groups * Custom Environment Variables * Worker Groups Management UI -----------------------------
Ask Inkeep
Ask Inkeep12mo ago
Answer In Windmill, init scripts are a convenient method to pre-install binaries or set initial configurations without needing to modify the base image (1) . These scripts are executed when the worker starts, and ensure all necessary binaries or configurations are set up before the worker undertakes any other task. To use init scripts, here are the steps you need to follow: 1. Navigate to the Worker Management UI in Windmill. 2. Go the worker group level and specify your script content in the INIT_SCRIPT field. It's important to note that your script will be executed at the beginning when each worker of the worker group starts. 3. When you make adjustments here, the workers will shut down and are expected to be restarted by their supervisor (this could be Docker or k8s). 4. The execution progress of init scripts is inspectable in the superadmin workspace, with Kind = All filter, with the path of those executions being init_script_{worker_name}. For example, if you want to install Playwright using pip, your init script may look like this:
pip install playwright
export PATH=$PATH:/tmp/.local/bin
playwright install
playwright install-deps
pip install playwright
export PATH=$PATH:/tmp/.local/bin
playwright install
playwright install-deps
Do bear in mind that the options to manage and to add init scripts through UI are available only under Windmill's Enterprise Edition (2) .
Ask Inkeep
Ask Inkeep12mo ago
Feel free to tag me @Ask Inkeep for any follow-ups on this thread. Also appreciate any feedback, it helps me improve.