Skip to content
Kevin Ross edited this page Sep 29, 2015 · 16 revisions

Overview

Remote agents work with the bamboozled-ruby-plugin. This plugin adds both the ruby and xvfb-run capability types. While auto-detection of these capabilities is the default on the remote agent, you may choose to setup shared capabilities manually as well.

Installation

This guide assumes the bamboo agent home directory to be /apps/bamboo-agent and the master server url to be http://bamboo.acme.com/agentServer/

Get the jar from the URL on the install remote agent page

mkdir -p /apps/bamboo-agent/bin
cd /apps/bamboo-agent/bin
wget http://bamboo.acme.com/agentServer/agentInstaller/atlassian-bamboo-agent-installer-5.9.3.jar

Run the installer with arguments

java -Dbamboo.home=/apps/bamboo-agent -jar /apps/bamboo-agent/bin/atlassian-bamboo-agent-installer-5.9.3.jar http://bamboo.acme.com/agentServer/ 
# allow to start
# CTRL-C 

Setup as a systemd service

vi /etc/systemd/system/bamboo-agent.service

Contents (be sure to adjust paths and user/group):

[Unit]
Description=Atlassian Bamboo Agent
After=syslog.target network.target
   
[Service]
Type=forking
User=apps
Group=apps
ExecStart=/apps/bamboo-agent/bin/bamboo-agent.sh start
ExecStop=/apps/bamboo-agent/bin/bamboo-agent.sh stop
   
[Install]
WantedBy=multi-user.target

Then reload and start it (as root or using sudo)

systemctl daemon-reload
systemctl start bamboo-agent

Setup as an init.d service

sudo ln -s /apps/bamboo-agent/bin/bamboo-agent.sh /etc/init.d/bamboo-agent
sudo update-rc.d bamboo-agent defaults

Authenticate the agent

Once the agent is online, you will have to approve access to it on the Agents page. If the agent has DHCP, you may want to edit the IP address and approve the subnet i.e. change 10.1.10.22 to 10.1.10.*.

Agent registration

Upon approval, the agent should be visible with a link in the Online Remote Agents section. If it is not, make sure that you are allowing the broker url to connect. This may require opening a port. For the uncomplicated firewall, the command to open the default port is sudo ufw allow 54663/tcp

FAQ and Gotchas

Environment variable bug

As of 5.9.3, the remote agent's bamboo-agent.sh has a bug in the shell script (which was fixed by the original vendor over 2 years ago). This will usually manifest with a complaint about a missing environment variable such as HOME in rspec:

WARNING: Unable to find ~/.rspec because the HOME environment variable is not set.

This has been reported as BAM-16205. The workaround is to edit the bamboo-agent.sh and change su -m $RUN_AS_USER to su - $RUN_AS_USER.

Auto-detection of agent server capabilities

I've found that if I add a new RVM gemset, capabilities will only show up if I restart the bamboo agent. It may have a re-detection time, but it is quick and easy to restart with sudo service bamboo-agent restart. New capabilities will show up immediately after the restart.

Agent doesn't show up in the Online Remote Agents

If the Online Remote Agents tab has only log statements like A remote agent is loading on xyz (127.0.0.1), your broker url may be connected. If you are using ufw, open the port with sudo ufw allow 54663/tcp. See open ports with sudo ufw status