The situation is this: I have a site repository on a remote server. I need that when I upload changes to the server (push), the site files are updated, i.e. Immediately it showed changes.
2 answers
You confuse control versions and deploy in one dish.
Examine capistrano.
There are deploy hooks, but this is not what you want and what you should get used to. This is not ftp.
- Well, what's wrong with the site automatically pulling changes from the repository? Given that this is a test version. - oldy
- Nothing bad. But the site must pull changes into its directory. This can be done via hook. - Nofate ♦
- @oldy: at least in that you could delete some important for the application file from the repository, and forget to add it on the server, while adding at your place locally, for example database.yml. You can fix it on your test version, and then the same story with a site that refuses to start, will happen on production. - pirj
- Well, I will add it again through the repository, from where the test site will update it - oldy
- It does not need to be added to the repository, there passwords - pirj
I have a similar implemented as follows.
There is a server with repositories, it works through gitolite. It also has repositories with dev versions of sites. By a simple post-receive hook on a bash executing the following command:
/var/.../hook_git.php "$GL_REPO_BASE" "$GL_REPO" a script is launched that determines the required repository and directory with dev versions and rigidly tightens the changes:
git fetch --all git reset --hard origin/master Total we have 4 repositories for each project:
- Local.
- Main (in which we push from local).
- Dev-repository (changes from the main one by hooks are automatically pulled into it).
- Production (in it handles).
And everything works on Feng Shui. Those. in the non-bare repository, we do not push, but pull up changes from the main repository. We always have the actual version of the site dev.
You can upgrade this all a bit. For example, commit in dev branch pull on dev version, master - on production. But I hold the opinion that it is better to do the latter with hands (at least for ordinary projects where hellish deployment systems are not needed).
- Finally, he designed it more fully in the form of an article intsystem.org/server / ... maybe someone will be interested. - IntellectSys