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

The developer cloud

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

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.