I’m setting up a service that requires automatically creating droplets and running a fairly lengthy provisioning process, supplied as a bash script in the user data parameter. I’ve found that this process can vary significantly, taking as little as three or as many as ten minutes. To be able to show users that progress is being made and to detect problems, I’d like to be able to monitor the provisioning and know what step it’s at.
A large component of my service is Nginx which is just functioning as a reverse proxy so I can use SSL/TLS. This is currently in the middle of the script, but I could easily move it to the front so almost immediately I’d have a way of responding to HTTP requests. Then, I could just configure a route to serve the contents of a txt file, which my script could echo messages into as it goes through the provisioning steps.
This is one way that might work but I haven’t attempted it yet, so I wanted to post here to see if there are better ways to do this sort of thing.
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.
Indeed the approach that you’ve mentioned is definitely a valid one.
Another option would be to use a configuration management tool like Ansible for example:
That way Ansible will take care of the stages and report back to you what stage has been executed already.