0

Sorry if the title is confusing... So, we have 2 servers. A Root Server for internal Stuff (GitLab, etc) and one managed server where we don't have SSH. Just Plesk and FTP.

So basically, I git push my commits to the root server running gitlab. After the push is complete I also want that the entire repo or new commits are getting pulled to the managed plesk-server.

Is this possible? Also, one thing worth to mention is that plesk creates subfolders for every domain, so it should be possible to specific a folder.

PoTTii
  • 21
  • 1
  • 4

3 Answers3

3

if you are using the most recent version of gitlab with its ci-runner, you could trigger a job where you can use lftp to upload the latest working copy of the repo to your Plesk server. Avoid using plain FTP, use FTP over SSL

Here are some links for GitLab and CI-Runner

Install a GitLab CE Omnibus package

The TL;DR version of how GitLab CI works

You would hardly get away with something simpler or better documented, this doesn't require a lot of Linux background, very few command line action, mainly editing text files

Hope this helps

kamihack
  • 312
  • 1
  • 6
  • 1
    I have actually done this in production, and can confirm that it works quite well. – Moshe Katz Mar 31 '16 at 18:19
  • Is there any good tutorial on this maybe? I am not really that much experienced with linux. – PoTTii Mar 31 '16 at 19:19
  • I just edited/updated the original answer with a couple of useful links to thorough documentation about gitlab and ci-runner – kamihack Mar 31 '16 at 20:10
  • This is the best answer so far, but it would be better if it included a .gitlab-ci.yml example rather than just pointing at links. This post includes an example if you're up for updating your answer: http://blog.kay-strobach.de/index.php/2016/02/11/how-to-deploy-your-static-website-easily-with-gitlab/ – jb510 Aug 11 '16 at 03:09
2

You should look into git hooks.

Git hooks allow you to fire off a script after a specific command. It's very flexible. So, for example, you could have a shell script that triggers on a git push command to also upload that copy to the FTP server.

Also, I haven't looked into git-ftp, but it seems like it could help you to upload the changed files to an FTP server.

suitablyawesome
  • 351
  • 2
  • 9
  • Git Hooks are only useable with the Enterprise version of Gitlab right? So that's maybe not an option right now. Git-ftp looks nice, but am I right that it runs on the clients side? As I am running windows (and a GUI for Git) – PoTTii Mar 31 '16 at 18:59
  • Doing git hooks through the web interface is a Gitlab enterprise feature, but if you have shell access to the Gitlab server, you can add git hooks through the CLI: http://doc.gitlab.com/ce/hooks/custom_hooks.html Similarly, if you have control over the Gitlab box, you can use git-ftp on it, too, and push the files from the Gitlab repo from the CLI. All that said, kamihack's answer seems simpler. – suitablyawesome Mar 31 '16 at 19:10
0

You can do both actions locally. You can push to your internal server and deploy through FTP to your other server from your own computer.

You can use PHPloy to deploy the changes through FTP.

You can combine the actions by putting the phploy command in a post-commit hook.

Disclaimer: I've developed PHPloy.

Banago
  • 101
  • 2
  • 1
    Sounds interesting. I'm currently doing exactly that using GoodSync. I will absolutely try your tool out. – PoTTii Apr 02 '16 at 11:40