Skip to content

Conversation

@dinoallo
Copy link
Contributor

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:

  • Introduced handle-startup.sh, which runs all executable scripts in the STARTUP_SCRIPTS_DIR directory in lexical order, ensuring deterministic and modular startup behavior. The handler safely exits if no scripts are present.
  • Updated configure-startup.sh to copy all scripts from startup/ into the startup scripts directory and delegate execution to handle-startup.sh instead of embedding logic directly.

New Modular Startup Scripts:

  • Added 00-set-hostname.sh to set the container's hostname from the SEALOS_DEVBOX_NAME environment variable, if provided.
  • Added 01-set-pod-id.sh to write the pod UID to a file if the SEALOS_DEVBOX_POD_UID environment variable is set.

@dinoallo dinoallo changed the title feat: add startup script handling and hostname/pod ID setup feat: refactor s6 startup service Dec 17, 2025
@dinoallo dinoallo requested a review from Copilot December 17, 2025 07:40
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant