Thought it was time for a tutorial on the feature called
script_url which seems to be relatively unknown. Although it's a great feature in terms of saving time while working with large clusters of servers.
So here's the thing, say that I have this bash script below:
apt-get update && apt-get upgrade
apt-get install htop nmap nload apache2 php-common mysql
And I want it to run once during deployment. What I do is that I place it anywhere it can be reached by a server, i.e on Github, on a object storage or even on another server. Then during deployment via API, I do my call to
/v1/server/create as usual:
"label": "Second Web server",
Now, observe the
script_url parameter at the bottom of the list, just change it to the url pointing to your install script and it will run during the creation of the server. So what makes this feature useful compared to cloud-init for instance?
Well, if you're developing your app and want to give people an easy way to install your app, you usually have to provide documentation and plenty of instructions. But with this all you need to provide is a button "Deploy on 99Stack" and let it do this API call with
script_url set to your installation script.