I’m in the process of building a platform that will make use of DigitalOcean’s APIs to auto-deploy and provision web apps required by our users. The API is well documented and lots of great Community content, but I’ve now hit a few roadblocks and hoping for some pointers from the Community to help resolve them
For reference, we’re primarily using DO’s Python library (python-digitalocean) for any DO API interactions, and can use Fabric (Python SSH) to access the Droplet once created to semi-automated other actions that need completing.
Here’s my end goal, to be achieved purely via API interactions:
This is the basic config of each Droplet:
Here’s where I’m hitting a brick wall and appreciate any suggestions:
I’ve tried with a bash script and cloud-config via the API and Dashboard, even stripping the actions back to a simple update and install task.
To verify this, once the Droplet has been created, I connect to the Console and use
node -v to confirm whether the Node install task has been run, and
node is not found meaning the task has failed or not been run at all.
Here’s the super basic User Data I’m using to try and debug this:
User Data: bash Version
sudo apt update
sudo apt-get install nodejs
User Data: CloudConfig Version
To standardise the way we access Droplet’s from our platform I’d like to assign a domain to each Droplet created. We’ll follow a domain naming pattern that means each ‘Project’ and the Droplet’s within it, exist under a subdomain.
I’ve already setup a wildcard
*.cluster-1.domain.net and added DigitalOcean’s nameservers to this, meaning any new subdomain added in DO will automatically work as DO’s nameservers are already handling the traffic.
When I create a new subdomain in the DO Dashboard, I can link that domain directly to a Droplet. As I understand it, this means if the Droplet IP changes DO will ensure all traffic to that domain is re-routed to the new IP.
So firstly, is this correct or when you add a domain and link it to a Droplet via the dashboard, is this just taking the ‘current’ IP of the Droplet and generating the DNS record for simplicity - or will it be dynamic?
If the latter, and it’s dynamically linked, how is it possible to recreate this via the API? I can only see the option to “Create a New Domain” which has a required
ip_address param, and no option to set a Droplet (by ID, for example).
Is it therefore possible to link a Domain to a Droplet by ID when using the API, or will the domain need to be linked to an IP address directly, and any Droplet IP update would need to be handled by use to ensure it remains linked with the domain name?
This isn’t really an ‘issue’ so much as being curious about the best way to do it… For each new Droplet we need to install and configure an SSL certificate. Initial thought was to use “Let’s Encrypt” as its free, and to do this via SSH using Fabric (Python lib) once everything has been setup.
However, if there was a company I could buy a wildcard certificate from that isn’t too expensive and would be quicker, easier and more reliable to install onto Droplet’s without needing much config, I’d certainly consider that.
Preference, of course, would be if DigitalOcean had a place to buy one and also then offered some platform-friendly way to install it.
Open to recommendations on this one 🙏
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.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.