-
Notifications
You must be signed in to change notification settings - Fork 16
feat: refactor s6 startup service
#73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Yun Pan <[email protected]>
Signed-off-by: Yun Pan <[email protected]>
startup service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the s6 startup service to improve modularity by extracting inline startup logic into individual executable scripts that run in a deterministic order. The new architecture delegates to a handler script that discovers and executes startup scripts from a designated directory.
- Introduced modular startup handler that executes scripts from a directory in lexical order
- Extracted hostname and pod ID setup logic into separate numbered startup scripts
- Updated configuration to copy startup scripts and delegate to the new handler
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
experimental/base-tools/scripts/svc/handle-startup.sh |
New handler that discovers and executes startup scripts sequentially from STARTUP_SCRIPTS_DIR |
experimental/base-tools/scripts/svc/configure-startup.sh |
Updated to copy startup scripts to the target directory and delegate execution to the handler |
experimental/base-tools/scripts/svc/startup/00-set-hostname.sh |
New modular script that sets the container hostname from environment variable |
experimental/base-tools/scripts/svc/startup/01-set-pod-id.sh |
New modular script that writes pod UID to a file for runtime reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Yun Pan <[email protected]>
This pull request refactors the container startup process to make it more modular and maintainable by moving startup logic into individual scripts that are executed in order. The main script now delegates to a new handler, which runs all executable scripts in a designated directory. This allows for easier customization and extension of startup behavior.
Key changes include:
Startup Process Refactoring:
handle-startup.sh, which runs all executable scripts in theSTARTUP_SCRIPTS_DIRdirectory in lexical order, ensuring deterministic and modular startup behavior. The handler safely exits if no scripts are present.configure-startup.shto copy all scripts fromstartup/into the startup scripts directory and delegate execution tohandle-startup.shinstead of embedding logic directly.New Modular Startup Scripts:
00-set-hostname.shto set the container's hostname from theSEALOS_DEVBOX_NAMEenvironment variable, if provided.01-set-pod-id.shto write the pod UID to a file if theSEALOS_DEVBOX_POD_UIDenvironment variable is set.