phpjenkinsdockerbehatahoy

Use behat with jenkins in amazon ec2 server


How can I setup and configure behat,ahoy,docker with jenkins in amazon ec2 server?

I want to run my behat feature's every time I push something in my Git A/c with help of jenkins and sauce labs in the ec2 server.


Solution

  • There are lots of ways to do this. What do you know about Amazon EC2? And Selenium? And Docker? There are lot's of technologies here... Do you want to configure a Selenium grid? I'll try to answer some of this. But you are asking so many things... xD

    I'll tell you my solution (Selenium grid) on that first:

    First of all you need to create a Selenium hub with an EC2 ubuntu 14.04 AMI without UI and link it as a jenkins slave to your Jenkins master. Or as directly a master. What you want. Only command line. Download Selenium Server standalone. (be careful on downloading the version. If you Download the Selenium3Beta, things could change). Here you can configure the HUB. You can also add the Selenium Hub as a service and configure to run automatically at server start. its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it. You can do that on the Amazon EC2 console when you have created your instance. You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.

    Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process. Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3). Generate a txt file and prepare the Selenium command to link to the HUB as a NODE. And convert it to *.bat in order to execute it. If you want to run the bat at start you can create a service with the task scheduler or use NSSM (https://nssm.cc/). Don't forget to add the rules to the security groups for this machine too!

    You can link as many servers as you want to your node.

    If you want to use docker, good luck! ;) Haha. No, with docker I recommend you to start as easy as posible trying to create a Dockerfile in local that runs the Jenkins server and the Selenium Server NOT in grid mode. When you have it working in local, push it to a repository. When You have all of this running, create an EC2 instance and install docker. Pull your selenium docker image and run it linking the local server ports to the docker machine ports.

    You have so many work to do here... But it's so interesting. I recommend you go step by step creating in every iteration a better infrastructure. Don't try to add all that technologies at the same time.

    Thera are lots of webs talking about that concepts. Good luck!