I am interested in a reliable way of launching droplets over API. I want to know how to check for all possible errors and how to detect if a new droplet is finally running.
Just doing POST to /v2/droplets sometimes might not be enough. I had following problems:
It looks quite complex to me.
What would be a reliable yet simple approach to launch droplets that works around all possible cases and keeps working even if you have hundreds of droplets?
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
https://github.com/Radau/DigitalOcean-Starbound-Backup-and-Restore
Make-snapshot-and-destroy or restore in one launch (unless DO API starts bugging again).
Personally on my own projects I use a system where one script sends the create command to the API using the Ruby library (there are libraries for most common languages that make this a lot easier) and store it’s data in a database with a status of “creating”. I then have a second script that checks for droplets that are listed in the db in that status and every 30seconds or so it queries the API for that droplet to get it’s status. Once the API says the droplet is active it updates the db so it stops querying.
That may be a bit more complex that what you need but the overall concept: