Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,839
Community Members
 
Community Events
168
Community Groups

How to I install bamboo agent as a daemon under Linux?

While I was able to find documentation on how to install the agent as a service for Windows, I wasn't able to find information on how to do the same for Linux. I want to be sure that if the worked/agent computer is restarted, it will restart the agent.

7 answers

1 accepted

1 vote
Answer accepted
ArmenA Rising Star Jul 03, 2013

Hi Sorin,

If the only requirement is to start the agent when the remote agent machine gets restarted, you can configure the start remote agent command in the rc.local file the same way as it's discussed here.

Also, use the remote agent installer jar file that comes with the supervisor (wrapper). It's the big Download button on Administration -> Agents -> Install remote agent page. The wrapper will start the remote agent service if for some reason the remote agent process gets terminated.

Armen

Ok, that's a workaround but I don't like having to work to implement things that are supposed to be part of the core product. Installing and agent as a service should be the default behaviour. Also, I am impressed that Bamboo cannot start agents via SSH, like Jenkins. Yes, the user interface of Bamboo is much nicer than Jenkins, but it seems that Bamboo is not robust enough and it may require more maintenance work than Jenkins, just because it is not able to deal with workers that could come-and-go.

Anyway, thanks for the good answer, even if it's not what I was looking for it it may be the best alternative for the moment.

For systemd on ubuntu

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

 

 

how import .bash_profile bamboo user?

Found this on the https://github.com/alienfast/bamboozled-ruby-plugin/wiki/Remote-Agents#overview site.

For my Amazon Linux instance, all I ended up needing to do was after the standard installation and running it from the command line I then symlinked the shell script like below.

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

and then added the bamboo-agent to chkconfig like so

sudo chkconfig -add bamboo-agent.

 

 

 

Like @Kevin Ross's post I created an upstart task, which is what Ubuntu is now using (I guess). Tested on my own Ubuntu (14.04 LTS) server.

Create an Upstart config file like `/etc/init/bamboo-agent.conf` with the following text (changing the author and /home/bamboo/bin/bamboo-agent.sh path to suit your needs.

description "A Bamboo remote agent daemon job file for Upstart"
author "Your name"
start on runlevel [2345]
stop on shutdown

pre-start script
    echo "[`date`] Bamboo remote agent starting" >> /var/log/bamboo-agent.log
    setuid bamboo
    exec /home/bamboo/bin/bamboo-agent.sh start
end script

pre-stop script
   exec /home/bamboo/bin/bamboo-agent.sh stop
   echo "[`date`] Bamboo remote agent stopping" >> /var/log/bamboo-agent.log
end script

Your script almost worked on Trusty. The setgid and setuid have to be set outside the scripts, once the scripts are running as the user you cannot redirect the output to /var/log (unless you give the user access to /var/log/bamboo-agent.log. Why not use upstart's logging facility?

 

description "A Bamboo remote agent daemon job file for Upstart"
author "Your name"
start on runlevel [2345]
stop on shutdown
setuid bamboo
setgid bamboo

pre-start script
  logger "[`date`] Bamboo remote agent starting"
  exec /opt/bamboo-agent-home/bin/bamboo-agent.sh start
end script

pre-stop script
  exec /opt/bamboo-agent-home/bin/bamboo-agent.sh stop
  logger "[`date`] Bamboo remote agent stopping"
end script



For my Amazon Linux 2 and bamboo agent 6.10.4 below worked. It installs bamboo-agent as a service and starts it.

sudo /home/bamboo/bamboo-agent-home/bin/bamboo-agent.sh installstart

 

this worked perfectly

Like Brad Riching likes this

It did for me too.  Frustrating to have gone through all the online docs only to realize that they haven't updated them to match the existing functionality of bamboo-agent.sh and that magical undocumented "installstart" argument.  I wasted about 2 hours trying to adapt their documentation for bamboo server (as officially instructed by their docs) to manually configure a systemd service, inspecting and troubleshooting systemd logs.  Kudos to you for finding it, @Mehmet Aydogdu .

that is bamboo server, not agent

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events