Configure a startup script for new Lightsail servers in Blesta
Use PD AWS Lightsail's User data / startup script setting to give new Linux servers a consistent initial setup. For example, a hosting company can prepare a script that installs the packages its offering requires, instead of repeating those steps after every new order.
Choose the operating-system image first
Choose the Blueprint (OS) for this offering before preparing the script. Its commands and package names must suit that image. A script prepared for one Linux distribution is not automatically suitable for another, and an application image may already include some of the software you intend to install.
If customers can choose different images at checkout, make sure your script supports each choice. Alternatively, use separate offerings with a script matched to each image.
Save the startup script
- Open Packages → your package → Module Options for the PD AWS Lightsail offering.
- Review Blueprint (OS) and the image choices available to customers.
- Find User data / startup script.
- Paste the cloud-init configuration or shell script your team has prepared and checked for that image. Leave the field blank when no startup script is needed.
- Save, then reopen the settings and confirm the script was retained.
The setting is used when a new instance is created. Saving it does not run the script on existing customer servers. It is not a recurring maintenance task.
Example: prepare a standard web-server offering
Suppose you sell a Linux web-server package with a fixed image. Your team prepares a first-boot script to install the required web-server packages and apply your standard initial configuration. Save that script on this offering, then verify it on the next intentional test deployment before making the offering available to customers.
This example describes the setup process; the script itself depends on the chosen image and your service requirements. Keep private deployment credentials out of a script delivered to customer-controlled servers.
Verify the result on a new service
Wait for the server to be created and for its initial setup to finish. Connect using the service's connection details and check the result your script was meant to produce: installed packages, the intended configuration and the application's actual response.
A running instance does not, by itself, prove that every script step succeeded. If the result is missing, check that the intended script was saved before this service was created and that the order selected an image it supports. Review the operating system's startup-script output for the command that needs correcting.
Know what happens during reinstall
Do not reinstall a customer's server just to test a revised startup script. The module's reinstall action replaces the operating-system disk and reapplies the service's SSH keys; it does not replay the startup script saved on the offering. Plan application setup separately when intentionally reinstalling a service.
For the other offering settings, see create a Lightsail package.