Droplet Meta Data not being passed

Using DO’s api v.2, attempting to create droplets and pass user_data however the user_data isnt being recognized.

Currently have two functions, first function creates a server on serverpilot, returning the $SERVERID & $SERVERAPIKEY and passing them into a callback function, which creates the DigitalOcean droplet passing in the user_data to run the server pilot installer, and thats where this fails.

Below is a snippet of my code ( Unfortunately cant provide full code base - but problem lies within user_data nonetheless ). Both server vars are accessible however running this only creates the server on server pilots side and the droplet, however the installer never runs.

$userData = "#!/bin/bash
    (test -e /usr/bin/wget || (sudo apt-get update && sudo apt-get -y install wget)) && \
    sudo wget -nv -O && \
    sudo python \

// create new droplet, connect to serverpilot, run installer
$data = array(
    'name'               => $appName,
    'region'             => 'nyc3',
    'size'               => '512mb',
    'image'              => 'ubuntu-14-04-x64',
    'user_data'          => $userData

Any ideas? Hope to hear from you guys soon!


Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted

@asb, Everytime I attempy to run that curl command for user-data pointing to my droplet ip, i get an error - failed to connect port 80: Connection Refused.