📜 ⬆️ ⬇️

Githubizer: autodeploy from Github to server

I wonder how many of you had to at least occasionally, but repeat the routine actions to set up auto-heating from the github to the server: create an ssh-key, add it to the repository of the project on GitHub, create a script that will listen to some address, add a webhuk in the interface github, which will pull this script ... Uff ... And what if I tell you that I have automated all these actions to the maximum? Yes, now you need to execute only a couple of commands and auto-running is up and running! And all this thanks to Giethabiser.

So, the repository address is github.com/chvanikoff/githubizer
How to use it:

Now more detailed:
1. Clone Githabizer repository
$> git clone github.com/chvanikoff/githubizer
2. go to the repository directory and edit the config for yourself
$> cd githubizer && vim priv / application.config
3. Compile and run the Gitchabizer:
$> make all run

More about the config (it has comments in English, I'll write here in Russian):
{http_server, [ %%        . ,   - ,    {nba, 10}, %% ,    ,     {port, 8989}, %% URL,         {url, ["/secret/hook/url"]} ]}. {github, [ %%     {username, "login"}, %% Email    {email, "email"}, %%  ,     {password, "m3g1p1$$w0rd"}, %%   ( - githubizer) {repository, "repo_name, not url!"} ]}. {server, [ %%   ,       (  ).    {REPO}   ,     {docroot, "/home/chvanikoff/erlang/{REPO}"}, %%   (  ,  IP-) {domain, "http://site.com"} ]}. 


What happens after the above actions:
  1. If not existed before, ssh-keys ~ / .ssh / githubizer and ~ / .ssh / githubizer.pub will be created
  2. They will be added to the github repository.
  3. The repository will be cloned locally (if the directory specified in the server.docroot config is empty, otherwise it is assumed that the repository is already cloned there)
  4. A small web server (Cowboy) with 2 http handlers will be launched, which will listen to the port specified in the config and handle 2 types of requests: requests to the address from the config (eg “secret / hook / url”) and all the others. 404 will respond to all requests, but the first type of requests will be made by git pull from the repository directory
  5. ...
  6. "That's all guys" (c)

')
PS: the code may be dirty in some places - do not kick, I'm still learning.

Source: https://habr.com/ru/post/171195/


All Articles