GitLab webhooks to deploy master / production

2019-08-17 05:58发布

问题:

I have set up a gitlab on my server running with Plesk which I use to manage my clients accounts.

Some of my clients have special development requests so I thought GitLab would be a great way to resolve a few issues.

However. What I need to do is:

When I create a git repo for a clients project I add a folder named hooks in the git . directory. and inside that I would like to have a file called site.conf

In this Im thinking of something like this: stage_dir=/var/www/vhosts//subdomains/stage..no stage_production=/var/www/vhosts//httpdocs/

In the project I would set up a webhooks for http://localhost:7900 This would be the same for every repo I create, with the site.conf individual for every project. So when I push to stage, all the stage files get copied / rsynced into the stage_dir variable, and so forth for the production.

I know there are similar solutions out there, but I have been unable to find any examples of them. My ruby skills arent good enough to do this from scratch, so I need something to look at to make this work. Can anyone help me out if you know of anything like this?

回答1:

I'm actually running the same configuration as you, and also try to develop a such thing that should allow me to deploy my local changes to my clients sites (staging, prod, etc ..)

Actually, i wrote a script that works fine, but stop working after some time, and i don't know why for now. I opened a topic on the parallels forum to claim some help about it. If you are interested in, maybe that you could try my script on your side, and help me to debug the last part of it, and maybe then, improve it. I'm not a good shell script developer, so they are a lot of things that we could improve actually, but the first thing to do before it completely works, is to fix the Plesk Gitlab behaviour i've explained one the forum.

The Gitlab deploy script i use can be found on my GitHub.

Do not hesitate to send me some feedbacks, or some pull request if you have any suggestion or fixes for this issue.

Note : To resume, the issue explained on the parallels forum is that connections between Plesk and Gitlab stop working after some time, for an unknown reason yet.