By 1linweb
I would like to create a ‘production’ environment that hosts a few of my websites. This would involve creating a droplet and configuring apache/nginx, bind/dns, mysql, exim/dovecot, vsftpd, etc.
I would then take a snapshot/backup of the droplet to use as a failover.
Since there is no guarantee you will get the same IP address when scaling or creating a new droplet from a previous snapshot, I wanted to know the best method to deal with the IP change.
Would something simple like find/replace using grep or another utility from the command line work, or would it require a more complex solution?
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!
Hi there. You could try this combo of find and sed to find/replace: <br> <br>find . -type f -name ‘.ext’ -exec sed -i ‘s|0.0.0.0|123.123.123.123|g’ {} ; <br> <br>Where 0.0.0.0 is your old IP and 123.123.123.123 is your new one; and -name '.ext’ is file extension (probly best to use . if you want to change everything, including logs—might take a while)… <br> <br>Good luck!
@nooblag Thank you for that example, I think that has me started in the right direction. I would use . and exclude multiple directories to speed things up. <br> <br>With not being able to secure IP address for our droplets, surely this has been dealt with before. Everyone, please do share how you would deal with changing all occurrences of an old IP to the new one in a droplet after you’ve already setup and configured everything.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.