Report this

What is the reason for this report?

Droplet Meta Data not being passed

Posted on November 17, 2014

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 serverpilot-installer.py https://download.serverpilot.io/serverpilot-installer.py && \
    sudo python serverpilot-installer.py \
    --server-id=$SERVERID
    --server-apikey=$SERVERAPIKEY
";

// 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!

–Constantine



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!

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.

@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.

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.