DO Ideas 2

run shell script on start or install software after droplet is created

Basically, a droplet is created for a user, and each time this is done, an array of software will be installed on the ubuntu to prepare it for use.

How can I make digital ocean execute a shell script which will install various linux applications and start those processes in the background automatically?

This would save me a lot of time manuall having to create each droplet, if there's a workaround please post something.

  • John
  • Sep 11 2018
  • Shipped
  • Sep 11, 2018

    Admin Response

    We've recently launched a new metadata service which allows users to provide arbitrary user-data. This includes scripts that will be run on first boot. For all the information, you can check out the blog post announcing the feature: https://www.digitalocean.com/company/blog/easily-automate-the-provisioning-of-your-droplets/ And this tutorial: https://www.digitalocean.com/community/tutorials/an-introduction-to-droplet-metadata This opens up a lot of new possibilities for users to customize their droplets. We hope you find it useful.
  • Attach files
  • Bruno PAZ commented
    September 11, 2018 18:54

    @Moisey Uretsky, I think, the init script and configuration management tools are complementary and have different purposes. For example, in a masterless Puppet setup, its a common practice to use an init script to install puppet and run puppet apply on the machine. Also It might be usefull to setup env vars or settings needed by Configuration Management tools. (server roles,, custom facts etc).

  • Alex Bradbury commented
    September 11, 2018 18:54

    Moisey: what you want to provide is something like cloud-init which is rapidly becoming a de-facto standard. It neatly sidesteps the problem you mention (of the fact there are just so many possible config management solutions). They all allow themselves to be bootstrapped from cloud-init, but for simple cases just throwing some logic in the cloud-init script is good enough.

    See:
    http://docs.openstack.org/trunk/openstack-compute/admin/content/user-data.html
    https://help.ubuntu.com/community/CloudInit
    http://brandon.fuller.name/archives/2011/05/02/06.40.57/

    The steps to support this feature request would be 1) provide an API for uploading some instance-specific metadata (much like EC2), 2) provide cloud-init preinstalled on the default images.

  • Moisey Uretsky commented
    September 11, 2018 18:54

    We've thought about this but with the proliferation of config management open source projects like Puppet and Chef we would essentially be overlapping.

    You may want to look into one of those projects.