Is should be simple but perhaps I don't understand the big picture here. I have setup a GitLab (omnibus) that is working wonderful on Ubuntu 16.04/Apache. On the same machine (the same Apache) I have the www that is supposed to be updated through GitLab.
Since I am on the same machine, it's useless to use webhooks or other complicated mechanisms. I just want to copy "on commit to master" to www folder so I choose custom_hooks as explained here http://docs.gitlab.com/ce/administration/custom_hooks.html
I created a file post-receive, gave git rights (and folder too) and trigger is working
#!/bin/bash
mkdir testdir
The directory is created on commits.
May be a stupid question but where are the GIT repo files to be copied?
I saw a lot of tutorials that are creating hooks on client side, should I make another GIT client in www folder and use it's hooks?
This can't be done on GIT server side in gitlab master folder?
Thanks in advance for guidance,
Ok, I figured out myself. In case anyone needs, first I found a excellent tutorial here: https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
What I've completely missed, is that installation of GitLab doesn't install the git itself :) Just creates a user+group 'git'. So all GitLab projects folders with git structure in:
are just (git) folders, pushed by clients like I tried and successfully pushed from another machine in my network (from windows)
Now the problem resumes to install git of course on server machine, where GitLab resides:
Then, test that you can checkout some branch and copy to /www/ folder (folder must have permissions for user so for future, git)
Success. All the files appeared in deploy folder now.
Further, the problem resumes to trigger automatic deploy when someone is pushing the repo and for this, you MUST create a folder named custom_hooks inside GitLab project folder
Inside, create a new file called post-receive and give +x rights for git user I haven't complete this part yet since I haven't decide what language to use for post-receive. Seems that can be any type, even a C compiled executable as long as have +x rights and is ready to accept some (poor doccumented) GIT callback arguments.
Cheers,