D
D
deshaser2014-03-30 15:59:07
git
deshaser, 2014-03-30 15:59:07

How to set up project synchronization on github and production servers?

The situation is this:
As soon as the master branch on github is updated, these changes should automatically be sent to my server. No additional operations need to be performed.
The server is a computer that is in my house and is completely in my power. Works on Win and IIS.
Yes, I googled long and hard. But either I don’t understand something, or is it true that no one does this, but do everything by hand without automation?
And an additional question (but not required):
How to automatically restart the node.js server at the same time?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Keith, 2014-03-30
@deshaser

It's quite simple - a webhook on github that knocks `post`, for example, to ` http://mydomain/fetch`. There is a handler on the server that runs a script, which in turn does a `git pull`. That's all.
Here is an example of how to run a third-party script, you can also run `git fetch --all` / `git reset --hard origin/master`
And this is how you can make a `touch` file, and since `iisnode` listens to `index.js` by default, the server will restart.

require('fs').utimesSync('index.js', new Date(), new Date());

P
Puma Thailand, 2014-03-30
@opium

Since Windows, hooks are probably difficult to fasten and the easiest thing to add to the scheduler is git pull once a minute.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question