The v1.1a and v1.1b will be your alternating "LIVE" and "TEST".Ĭreating symlinks is very fast so you can probably recreate them when you want to swap versions with the site under light load without too much disruption. Instead, on the same directory level as the website's "home" directory (i.e. The easiest is to setup a level of indirection using symlinks. There are other ways to switch versions on the fly however. hostname is almost always checked just once on process startup. The O/S expects the hostname to be set when the system is installed and remain unchanged. dynamically changing the server's hostname will likely cause a great many of the system daemons to malfunction, and often in ways that are not immediately apparent. Is there a way I can make the error message go away without having to reboot?Īhem. I can see that this would be fine for many use cases, but is far from ideal for us since we're modifying the hostname routinely and programmatically we don't want to have to wait for a reboot every time we run our swap script. I figure it also might end up breaking stuff in future if I try to chain commands that pipe output to each other, so I guess it's technically not just an aesthetics issue.Īll the solutions I've seen to the 'unable to resolve hostname' message involve modifying /etc/hosts or some similar file and then rebooting the server. Which doesn't seem to break anything, but is fairly irritating. Sudo: unable to resolve host ourwebsiteLIVE It works, but now every time I sudo anything on either of our servers it prints e.g. in our IP-swapping script, and have already implemented this. I know I can do this by running hostname ourwebsiteLIVE etc. To avoid confusion when SSHing into either of these servers, especially if some silly person (like me) leaves an SSH session open for a long time and gets confused about which server they're on, I want to modify the hostnames of the two servers so that the prompt and title in the terminal window will read or depending upon whether the server is currently live or testing. We have two webservers, and at any given time one of them is 'live' and one is 'testing', but when we've got our new features or bugfixes working on the 'testing' server, we run a script that uses the AWS API to swap the IP addresses assigned to the two boxes so that the domains being served by the two servers are swapped.Ĭonsequently, at any given moment, one of these servers can be either our 'live' server or our 'testing' server, but these are not permanent states. At work, I work on a small website using Ubuntu servers hosted on Amazon EC2 instances.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |