Dennis Philpot Dennis Philpot - 4 months ago 29
PHP Question

Jenkins Ant deploy/release on multiple remote server at same time

i try to solve the case where i need to make a PHP release on multiple remote Server nodes at the same time.

We got a Jenkins server wich does the following steps in his build (ant) script:


  • Git Checkout

  • PHP QA Tools Check (like PHPUnit, phpmd etc.)

  • Do some other tests



After everything is OK i want to deploy the sources to 3(later maybe more) remote Servers.
After everything is pushed to the Webnodes i want to execute a symlink change on all 3 nodes at the same time.

Sounds kind of impossible to me, but i hoped that i get a solution somewhere here, but i didn't found anything that helps.

So hopefully someone here got a good idea or some experience to share.

Cheers,

Dennis

Answer

You should look at this link because PHP deployments are a bit different from Java/.Net related deployments. However, if you feel that using Phing along with Jenkins OR using Phing independently is not what you want, and would like to simply have some plugin which copies your content to few remote servers, then you should try using Publish Over SSH plugin. After the steps in ant script mentioned above completes, you can add the task of deploying the sources to remote servers in Post-build Actions section. Once you've installed the plugin, you will find Send build artifacts over SSH option in the drop-down menu of Post-build Actions. Here you will find options to select multiple servers and you also have option to run command over those machines once the sources have been copied using Exec command that i have highlighted in the snapshot below. Also don't forget to check the Advanced... options and the help (?) section for each option.

enter image description here