简体   繁体   English

在亚马逊 ec2 服务器中与 jenkins 一起使用 behat

[英]Use behat with jenkins in amazon ec2 server

How can I setup and configure behat,ahoy,docker with jenkins in amazon ec2 server?如何在亚马逊 ec2 服务器中使用 jenkins 设置和配置 behat、ahoy、docker?

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.每次我在 ec2 服务器中的 jenkins 和酱实验室的帮助下,在我的 Git A/c 中推送一些东西时,我都想运行我的 behat 功能。

There are lots of ways to do this.有很多方法可以做到这一点。 What do you know about Amazon EC2?您对 Am​​azon EC2 了解多少? And Selenium?还有硒? And Docker?还有 Docker? There are lot's of technologies here... Do you want to configure a Selenium grid?这里有很多技术......你想配置一个Selenium网格吗? I'll try to answer some of this.我会尝试回答其中的一些问题。 But you are asking so many things... xD但是你问的太多了... 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.首先,您需要创建一个带有没有 UI 的 EC2 ubuntu 14.04 AMI 的 Selenium 集线器,并将其作为 jenkins 从站链接到您的 Jenkins 主站。 Or as directly a master.或者直接成为大师。 What you want.你想要什么。 Only command line.只有命令行。 Download Selenium Server standalone.下载 Selenium Server 独立版。 (be careful on downloading the version. If you Download the Selenium3Beta, things could change). (下载版本时要小心。如果你下载 Selenium3Beta,事情可能会改变)。 Here you can configure the HUB.您可以在此处配置 HUB。 You can also add the Selenium Hub as a service and configure to run automatically at server start.您还可以将 Selenium Hub 添加为服务并配置为在服务器启动时自动运行。 its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it.打开 Selenium 默认端口(或您配置的端口)很重要,以便节点可以连接到它。 You can do that on the Amazon EC2 console when you have created your instance.创建实例后,您可以在 Amazon EC2 控制台上执行此操作。 You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.您只需要在您想要的 IP 的端口中添加一个带有 TCP 入站规则的安全组。

Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process.然后,您可以创建一个 Windows server 2012 实例服务器(例如,我就是这样做的),并执行相同的过程。 Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3).下载相同版本的 Selenium 和 chromedriver(Selenium3 之前的 Selenium 版本无需下载任何 firefoxdriver)。 Generate a txt file and prepare the Selenium command to link to the HUB as a NODE.生成一个txt文件并准备Selenium命令作为NODE链接到HUB。 And convert it to *.bat in order to execute it.并将其转换为 *.bat 以执行它。 If you want to run the bat at start you can create a service with the task scheduler or use NSSM ( https://nssm.cc/ ).如果您想在开始时运行 bat,您可以使用任务调度程序创建一个服务或使用 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!如果你想使用 docker,祝你好运! ;) 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.不,使用 docker,我建议您尽可能轻松地开始尝试在本地创建一个 Dockerfile,该文件运行 Jenkins 服务器和非网格模式的 Selenium 服务器。 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.当您运行所有这些后,创建一个 EC2 实例并安装 docker。 Pull your selenium docker image and run it linking the local server ports to the docker machine ports.拉取您的 selenium docker 映像并运行它,将本地服务器端口链接到 docker 机器端口。

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. Thera 有很多网络都在谈论这些概念。 Good luck!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM