I am working on a web application that runs on the LAMP stack (Linux Apache Mysql PHP) and would like recommendations on improving my workflow.
I have 3 environments:
- My local machine AKA my development environment
- A staging account on my dedicated server so that I can test the web app
- A production account on my dedicated server
I do all the development on my local computer and use a subversion server which is located on my dedicated server. I set up a hook script so that whenever I commit, my "staging" account is updated with the new code.
Once in a while I make sure that everything works fine on the staging account and push the changes to my production account via a small script.
This works well enough for the most part, but there are a couple of irritations:
My domain name is hard-coded in a couple of places, making it time-consuming to switch between environments. I can modify my hosts file manually but it's not exactly fast and it doesn't work for the 2 accounts (prod/staging) on the same server.
I've no way of keeping the database up-to-date across all three environments. I could use the same database for all environments but I would have to take the risk of breaking the production environment.
So, my question is: what could I do to mitigate these problems?
UPDATE: The hard coded domain issue is introduced by a 3rd party software and therefore, "not hard coding it" is not an option at the moment.