I have 2 sites (staging and live). I want to have a central git repo where we push to and deploy both sites from.
I also need to capture changes that happen to the code on both the staging and live sites (plugin installation, themes, extensions, etc). I need ideas for the best structure please.
Obviously, our team will need to keep working copies of the central repo locally. Thanks!
You can use Capistrano with multistage deployments to handle what you want. The repo being deployed can reside pretty much anywhere that is accessible for pulling by the app server environments.
For example, on a recent project we used a private GitHub repo as the deploying repository. We set up SSH keys on the app server for authenticating with GitHub, and can deploy to either staging or production depending on the Capistrano command we issue from our local workstations. Our local Capistrano instance will remotely (via SSH) tell the app server to checkout and fetch latest from the appropriate branch on Github to its own local repo, copy the latest code to a new directory, and then go through a checklist of tasks (config modifications, asset compilation, database migrations, etc). Upon a successful deploy, Capistrano tells the server to switch over to the latest code. Any hiccups, and it simply rolls back the deploy.
The command to deploy is as simple as:
cap deployorcap production deployYou can read up more about it here, and about multistage setups here.