this is likely answered before, but is it possible to have a droplet execute a single script after deployment (the script is inside the snapshoot used)
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.
Heya, @nullx8
You can use cloud-init to inject a file into your Droplets at deployment that automatically sets up things like new users, firewall rules, app installations, and SSH keys. DigitalOcean’s User Data feature leverages cloud-init so you can deploy and automate the set up of several Droplets simultaneously. Learning to use cloud-init can save you a lot of set up time when deploying new Droplets.
https://docs.digitalocean.com/products/droplets/how-to/automate-setup-with-cloud-init/
Regards
There are a few ways to do it. You can use rc.local file or Cloud init to do it. You can also use crontab for this like below,
Create the script,
Paste your commands,
Make it executable
And then add following to your crontab,
Source Linux: How to execute a bash script at system startup using crontab
Heya,
Yep, that is what Cloud-init is for and can help you greatly. Here is an example usage of Cloud-init:
https://www.digitalocean.com/community/questions/automate-nginx-reverse-proxy-setup-for-node-js-with-cloud-init
You can take inspiration from there.