【问题标题】:Bamboo: More than one agent per EC2 elastic instance?Bamboo:每个 EC2 弹性实例不止一个代理?
【发布时间】:2017-03-22 18:43:47
【问题描述】:

每个 EC2 弹性实例是否可以运行多个 Bamboo 代理?

我们在构建系统中使用 Docker,该过程似乎主要受网络 IO 限制。如果我们可以在一台机器上运行多个代理,那就太好了。

通过在一台机器上运行多个代理而不是启动多台机器,我们也无需担心在机器之间将 Docker 映像作为工件传送。

2014 年 10 月 30 日更新:

我尝试复制当前的启动脚本并添加一个新家:

$ cat /opt/bamboo-elastic-agent/bin/bamboo-elastic-agent2
#!/bin/sh

bambooAgentBin=$(cd -P -- $(dirname $0) && pwd)
. $bambooAgentBin/bambooShellFunctions.sh

echo Starting Elastic Bamboo Agent...
java -Dbamboo.home=/home/bamboo/bamboo-agent-home-2/ -Dimagefiles.version=3.3-SNAPSHOT -jar $bambooAgentBin/*installer*.jar 2>&1 | tee -a $(getHomeDir)/bamboo-elastic-agent.out

似乎弹性版本设置了某种隧道并崩溃,因为隧道已经在运行:

# su -c /opt/bamboo-elastic-agent/bin/bamboo-elastic-agent2 - bamboo  &
[1] 14143
Starting Elastic Bamboo Agent...
2014-10-30 08:39:31,804 INFO [main] [S3Sync] Syncing from: bamboo-agent-release-us-e1/5.6-OD-01-0070/cce16404c14f06456c6adc44181746abf8dd1206/ to /opt/bamboo-elastic-agent
2014-10-30 08:39:31,979 INFO [main] [S3Utils] Syncing s3://bamboo-agent-release-us-e1/5.6-OD-01-0070/cce16404c14f06456c6adc44181746abf8dd1206/ to /opt/bamboo-elastic-agent
2014-10-30 08:39:31,979 INFO [main] [S3Utils] Fetching the list of remote objects...
2014-10-30 08:39:33,006 INFO [main] [S3Utils] Found 579 files in s3://bamboo-agent-release-us-e1/5.6-OD-01-0070/cce16404c14f06456c6adc44181746abf8dd1206/
2014-10-30 08:39:33,059 INFO [main] [S3Utils] Found 463 files in /opt/bamboo-elastic-agent
2014-10-30 08:39:33,060 INFO [main] [S3Utils] Generating the list of files to fetch from S3...
2014-10-30 08:39:33,076 INFO [main] [S3Utils] Generating the list of files to remove...
2014-10-30 08:39:33,078 INFO [main] [S3Utils] Removing 0 files from /opt/bamboo-elastic-agent
2014-10-30 08:39:33,079 INFO [main] [S3Utils] Fetching 155 files to /opt/bamboo-elastic-agent
2014-10-30 08:39:39,969 INFO [main] [S3Utils] Fetched 113 MB from S3
2014-10-30 08:39:39,973 INFO [main] [ElasticAgentInstaller] Starting [java, -server, -Xms32m, -Xmx256m, -XX:MaxPermSize=128m, -XX:+HeapDumpOnOutOfMemoryError, -Dimagefiles.version=3.3, -Dbamboo.agent.installDir=/opt/bamboo-elastic-agent, -cp, /opt/bamboo-elastic-agent/boot/annotations-13.0.jar:/opt/bamboo-elastic-agent/boot/gson-2.2.2-atlassian-1.jar:/opt/bamboo-elastic-agent/boot/atlassian-bamboo-api-agent-bootstrap-5.6-OD-01-0070.jar:/opt/bamboo-elastic-agent/boot/commons-io-2.4.jar:/opt/bamboo-elastic-agent/boot/jackson-core-2.1.1.jar:/opt/bamboo-elastic-agent/boot/atlassian-bamboo-agent-elastic-shared-5.6-OD-01-0070.jar:/opt/bamboo-elastic-agent/boot/atlassian-tunnel-0.21.jar:/opt/bamboo-elastic-agent/boot/stax-api-1.0-2.jar:/opt/bamboo-elastic-agent/boot/guava-bridge-11.0.2-atlassian-01.jar:/opt/bamboo-elastic-agent/boot/atlassian-bamboo-agent-elastic-5.6-OD-01-0070.jar:/opt/bamboo-elastic-agent/boot/commons-codec-1.8.jar:/opt/bamboo-elastic-agent/boot/atlassian-util-concurrent-2.4.1.jar:/opt/bamboo-elastic-agent/boot/joda-time-2.3.jar:/opt/bamboo-elastic-agent/boot/log4j-1.2.15.jar:/opt/bamboo-elastic-agent/boot/guava-11.0.2-atlassian-01.jar:/opt/bamboo-elastic-agent/boot/atlassian-bamboo-agent-bootstrap-5.6-OD-01-0070.jar:/opt/bamboo-elastic-agent/boot/commons-lang-2.6.jar:/opt/bamboo-elastic-agent/boot/atlassian-aws-1.0.71.jar:/opt/bamboo-elastic-agent/boot/jackson-databind-2.1.1.jar:/opt/bamboo-elastic-agent/boot/fugue-1.1.jar:/opt/bamboo-elastic-agent/boot/aws-java-sdk-1.7.1.jar:/opt/bamboo-elastic-agent/boot/httpclient-4.2.5.jar:/opt/bamboo-elastic-agent/boot/commons-logging-1.0.4.jar:/opt/bamboo-elastic-agent/boot/jackson-annotations-2.1.1.jar:/opt/bamboo-elastic-agent/boot/bcprov-jdk15on-1.48.jar:/opt/bamboo-elastic-agent/boot/atlassian-bamboo-core-agent-bootstrap-5.6-OD-01-0070.jar:/opt/bamboo-elastic-agent/boot/bcpkix-jdk15on-1.48.jar:/opt/bamboo-elastic-agent/boot/atlassian-annotations-0.4.jar:/opt/bamboo-elastic-agent/boot/jsr305-1.3.9.jar:/opt/bamboo-elastic-agent/boot/httpcore-4.2.5.jar:, com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap]
2014-10-30 08:39:40,119 INFO [main] [ElasticAgentBootstrap] Starting Agent Bootstrap using Java 1.6.0_45 from Sun Microsystems Inc.
2014-10-30 08:39:40,410 INFO [main] [ElasticAgentBootstrap] Using tunnelling. Setting virtual host name to https://xxxxxxx.atlassian.net/builds/agentServer/
2014-10-30 08:39:40,410 INFO [main] [ElasticAgentBootstrap] Using tunnelling for HTTP(S). Registering 'httpt' and 'httpst' protocols.
2014-10-30 08:39:40,416 INFO [main] [ElasticAgentBootstrap] HTTP(S) tunnel: enabled
2014-10-30 08:39:40,416 INFO [main] [ElasticAgentBootstrap] JMS tunnel: enabled
2014-10-30 08:39:40,424 INFO [main] [ElasticAgentBootstrap] Starting tunnel server, waiting for 2 connections.
2014-10-30 08:39:40,425 FATAL [tunnellogger-thread] [TunnelServer] [com.atlassian.tunnel.tunnel.server.TunnelServer] Fatal error in TunnelServer.
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
    at java.net.ServerSocket.bind(ServerSocket.java:328)
    at java.net.ServerSocket.<init>(ServerSocket.java:194)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at javax.net.ssl.SSLServerSocket.<init>(SSLServerSocket.java:84)
    at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.<init>(SSLServerSocketImpl.java:81)
    at com.sun.net.ssl.internal.ssl.SSLServerSocketFactoryImpl.createServerSocket(SSLServerSocketFactoryImpl.java:58)
    at com.atlassian.tunnel.tunnel.server.TunnelServer.run(TunnelServer.java:54)
    at java.lang.Thread.run(Thread.java:662)

有解决方法的想法吗?

【问题讨论】:

  • 嘿@konrad 你能解决这个问题并开始第二个代理吗?

标签: amazon-ec2 docker bamboo


【解决方案1】:

我们(Atlassian 构建工程)创建了一组插件,用于在集群 (ECS) 中运行多个基于 Docker 的代理,这些代理上线、构建单个作业然后退出。它应该能够执行您概述的操作。我们最近开源了该解决方案。

更多详情请见https://bitbucket.org/atlassian/per-build-container

【讨论】:

    【解决方案2】:

    Amazon 实例在提供每美元的 I/O 容量(我假设您的意思是网络 I/O)方面一直很糟糕,因为它们往往针对 CPU 和内存密集型工作负载进行了更多优化。您可能会发现同一节点上的其他进程可能无济于事。

    如果您在节点上安装 docker 映像并在安装映像后获取 snapshot to create an AMI,则可以使用该 AMI 启动任意数量的 ec2 实例。他们将预装图像。

    您还可以使用 CloudFormation 和/或 Cloud Init 在每个 Ec2 实例上重新编译或下载您的镜像,而无需担心手动移动 docker 镜像。

    但是,如果您确实想在一个节点上运行多个竹代理,您应该也可以,只要您为每个代理实例设置不同的 bamboo.home 参数即可。

    java -Dbamboo.home=/agent1Home -jar atlassian-bamboo-agent-installer-X.X-SNAPSHOT.jar \
           http://bamboo-host-server:8085/agentServer/
    java -Dbamboo.home=/agent2Home -jar atlassian-bamboo-agent-installer-X.X-SNAPSHOT.jar \
           http://bamboo-host-server:8085/agentServer/
    

    【讨论】:

    • 感谢您的回复。在我们的例子中,我们有 Bamboo 之外的工件(Docker 容器)不能很好地运输(大)。我们使用具有本地 SSD 存储的 M3 大型实例,因此 I/O 不是问题。我根据您非常有用的bamboo.home提示尝试更新了问题,但我遇到了它尝试设置的隧道的问题。
    猜你喜欢
    • 2016-05-16
    • 2019-07-11
    • 2015-11-21
    • 1970-01-01
    • 2014-05-10
    • 2014-03-03
    • 1970-01-01
    • 2018-02-03
    • 2014-09-14
    相关资源
    最近更新 更多