Entry Point
Learn how to configure startup commands for your DevBox project
In Sealos DevBox, entrypoint.sh
is a special script file that defines how your application starts after deployment. This guide will help you understand how to properly configure this file to ensure your application starts and runs correctly in the deployment environment.
What is entrypoint.sh
In a DevBox project, entrypoint.sh
is your application's entry point that:
- Defines the startup command for your application
- Executes automatically after application deployment
- Ensures your application starts correctly
- Serves as a key component when publishing your project as an OCI image
entrypoint.sh
should only be responsible for starting your application, not building it. All build steps should be completed in the development environment.
Building in the Development Environment
Before configuring entrypoint.sh
, complete your application build in the development environment. This approach:
- Reduces application startup time
- Avoids installing build dependencies in production
- Ensures you're deploying verified build artifacts
Build Your Application
Execute the build in your development environment:
Verify Build Results
Confirm your build artifacts were generated correctly:
Configure Startup Command
Configure entrypoint.sh
based on your build artifacts:
Common Configuration Scenarios
Pre-built Web Applications
Compiled Backend Services
Interpreted Backend Services
Best Practices
Ensure Pre-building
- Complete all build steps in the development environment
- Verify the integrity of build artifacts
- Test that the built application starts correctly
Use the Correct Port
Ensure your application listens on the correct port:
- Use the port from environment variables (if available)
- If manually specified, use standard ports (like 3000, 8080, etc.)
- Make sure to listen on 0.0.0.0 rather than localhost
Handle Environment Variables
If your application depends on environment variables:
- Configure environment variables during deployment via the Application Management interface
- Don't hardcode sensitive information in
entrypoint.sh
Don't add background processes or daemons in entrypoint.sh. If you need to run multiple services, create and deploy separate DevBox projects for each.
Common Issues
Build-related Problems
If you encounter build-related issues:
- Ensure all build steps are completed in the development environment
- Check that build artifacts are complete
- Verify runtime dependencies for your build artifacts
Startup Failures
If your application fails to start:
- Check if the startup command points to the correct build artifacts
- Confirm all required environment variables are configured
- Review application logs for detailed error information
Permission Issues
If you encounter permission errors:
- Ensure
entrypoint.sh
has execution permissions:
- Check if the permissions for build artifacts are correct
Testing and Validation
Before publishing your application:
- Complete the build in the development environment
- Test the build artifacts
- Verify that
entrypoint.sh
starts your application correctly:
Next Steps
After completing your application build and configuring entrypoint.sh
, you're ready to publish your application. During the publishing process:
- Ensure all build artifacts are correctly generated
- The system will use your configured
entrypoint.sh
as the application's startup entry point - After publishing is complete, during the deployment phase, your application will start according to the method defined in
entrypoint.sh
Last updated on