GitHub – setup auto deployment with remote server
Currently, my production website is hosted on Azure. I use git and push all my commits to GitHub. With the magic of
git hooks Azure has the ability to pull from GitHub when someone pushes a certain branch to GitHub.
How can I replicate this with my own staging server hosted on-premise? In other words, how can I set a repo on GitHub, and when I push to it, through git hooks send a signal, request or what-have-you to perform an automatic pull on my on-premise server?
- Git diff between master and all files changed in a pull request
- Copy a git-push to another computer, or perform smaller incremental pushes?
- Trying to load files from github through a firewall is impossibly slow. Any suggestions for workarounds?
- Git one-liner to add everything (including untracked files) and commit
- Github working on fork while waiting for pull request
- Pathspec upstream/master is ambiguous
I know Git is not a deployment software, but if I have to write a mechanism on my on-prmise server to make this happen I would like to know where to start. If it’s helpful, we use Microsoft technology, so we are running our staging server on Windows Server, while our production is on Azure.
I understand that I’ll need to use callback url on my server to then perform whatever is needed.I would like to know what methods people use to accomplish this. e.g.: on my call back url, how would I call a script to run a pull/fetch/clone bash command. or other method.
If you need more information, feel free to ask.
One Solution collect form web for “GitHub – setup auto deployment with remote server”
Expanding upon my comment,
You would need to define/create a callback url on your end, which
will need to be publicly accessible.
githubwould make a hit to this url via a
git hookwhenever a
push is made to the branch in question.
You can add authentication for the hit in the hook, if needed.
This call will inform your server that a push has been made to the
certain branch on github.
Now your server should start a deployment task which does the
Regarding this deployment task, there are many ways to do this, and the finer details will vary depending on how you do it.
One way would be to introduce a Continuous Integration tool like Jenkins in your stack, which you could also use for regular and test builds in different environments.
Another way could be to execute a simple bash script which does
cd $REPO_DIR && git pull origin branchname && service apache2 etc restart.