I have a question regarding workflow in web development. I’m building my project in Symfony, and it’s in Git.
Right now, I have three environments, dev (local), staging and prod. The project itself is hosted on GitHub in a private repo.
I’m wondering what a good way is to update the staging & production environments. Should I somehow setup a push based system so I can push the prod/staging branch directly to my server, and use Git hooks to regenerate cache files and run database migrations?
Right now on similar projects I use a manual pull system, where I SSH to the server, pull down changes from the prod Git branch and manually run cache/migrations. This obviously is not ideal.
1
I’m now deploying server to staging/production by using command:
git push stating master
git push production master
And finished, I don’t have to go to the servers to pull the code.
This is might be the thing you want. Please read on this link
https://stackoverflow.com/questions/279169/deploy-a-project-using-git-push
Have you considered a service like Beanstalk or Codebase ? They will host your git repositories, but they also have “native” support for deploying web applications, unlike Github. You would probably still have to write hooks to handle stuff like database migrations, but such services do automate much of the deployment process.
I think your current situation is most ideal, provided that you are not (a) load balancing, and (b) you have automated the regen-refresh-restart cycle once you do the git operation. Too much more automation, and you run the risk of accidental deployments.
There are various complexities related to real-life deployments, such as database modifications, cache-regeneration, minification, etc, web server configurations, etc… What about when you need a new rewrite rule added? Is that automated? It is for us, and I would never do it differently.
If load balancing, then deploy to a “push” server, and rsync from there.