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!
@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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.