Recently I've read some notes and tutorials digital ocean of how to set up automatic deployment with Git. The problem is that all solutions were about 2 servers - test and live, and server for test had to have repository within itself.
In my case - I have 3 servers:
Is it possible to configure auto deployment in this case?
I was wondering about mounting my production server to repository server or make another connection between them somehow.
Maybe there is some better way to do it?
It came out to be much easier than it looked like.
sshfs user@dev_server:/path/to/www /mnt/dev_server -o ServerAliveInterval=60 -o allow_other
Without allow_other option there is permission denied error on "git push"
cat post-receive
#!/bin/sh git --work-tree=/mnt/dev_serv/path/to/www/website --git-dir=.../repositories/website.git checkout -f
And it is working like a charm. Now I am just searching for some more secure approach. This solution was tested between local to dev_server.
The main goal is to run autodeployment only when something is being pushed from dev server - not local - to production.