'Launch bamboo agent at startup on Linux
In my situation I have an Ubuntu Server 16.04 and I want to launch a Bamboo remote agent at the startup of the machine.
I have already tried putting on /etc/systemd/system/bamboo.service this lines of code
[Unit]
Description=Bamboo Remote Agent Launcher
[Service]
User=bamboo
Group=bamboo
ExecStart=/bin/bash /home/bamboo/bamboo-agent-home/bin/bamboo-agent.sh start
[Install]
WantedBy=multi-user.target
but it seems not work, because my Bamboo do not see my agent and the systemctl status return this info
● bamboo.service - Bamboo Remote Agent Launcher
Loaded: loaded (/etc/systemd/system/bamboo.service; enabled; vendor preset: enabled)
Active: inactive (dead) since mer 2018-05-09 16:28:07 CEST; 6s ago
Process: 2872 ExecStart=/bin/bash /home/bamboo/bamboo-agent-home/bin/bamboo-agent.sh start (code=exited, status=0/SUCCESS)
Solution 1:[1]
Change the code with:
[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
Solution 2:[2]
Have you installed the agent? Atlassian's Documentation sucks in this one.
You should install the agent as bamboo user with the word "install" at the end.
java -jar atlassian-bamboo-agent-installer-6.7.2.jar https://my.bamboo-server.com/agentServer/ install
Replace with the address of your Server of course
Also if you run journalctl -xe you'll probably see something like
This means you have to go to your bamboo-server under your agents page and confirm the agent.
Solution 3:[3]
We have a shell script to start the remote agent that is called in a cron job that runs on reboot
launchRemoteAgent.sh java -jar /home/bamboo/bamboo-agent-home/atlassian-bamboo-agent-installer-6.6.3.jar http://:8085/agentServer/ > /home/bamboo/bamboo.log 2>&1 &
crontab @reboot /home/bamboo/bin/launchRemoteAgent.sh > /dev/null
Solution 4:[4]
Once you've run the agent for the first time it will create control scripts to install and manage the service.
So after running:
java -jar atlassian-bamboo-agent-installer-6.10.4.jar ...
Stop the agent and run:
sudo ./bamboo-agent-home/bin/bamboo-agent.sh install
Then you can control it with:
sudo service bamboo-agent [start|stop|restart|status]
Or you can call the agent script directly. Run the below to see all possible commands:
sudo ./bamboo-agent-home/bin/bamboo-agent.sh
The following command is useful to diagnose startup issues:
sudo ./bamboo-agent-home/bin/bamboo-agent.sh console
Solution 5:[5]
In recent version of bamboo it doesn't need to create service config files manually. But unfortunately it doesn't well documented on bamboo documents.
After you have installed bamboo agent and approve the agent on bamboo admin panel (see @DimiDak answer on https://stackoverflow.com/a/55137681/6463720):
- Install bamboo agent service
YOUR/PATH/TO/bamboo-agent-home/bin/bamboo-agent.sh install
- Enable the service
systemctl enable bamboo-agent
- Start it
systemctl start bamboo-agent
Solution 6:[6]
The complete guide for bamboo 8.1.3 is the following, Bamboo DC/server must be running and accessible by the agent, we are also using remote agent token instead of authorization(RHEL 8 - jdk already installed):
$ sudo useradd --create-home -c "Bamboo Agent role account" bamboo-agent
# define a password for bamboo-agent user if you want
$ sudo su - bamboo-agent
# get the jar installer from server
$ wget http://<your-bamboo-server/DC>:<your-port>/agentServer/agentInstaller/atlassian-bamboo-agent-installer-8.1.3.jar
# logout and become root again
$ exit
# install the software in the bamboo-home dir
$ sudo java -Dbamboo.home=/home/bamboo-agent -jar /home/bamboo-agent/atlassian-bamboo-agent-installer-8.1.3.jar http://<your-bamboo-server/DC>:<your-port>/agentServer/ -t <your-token> install
# install the daemon for systemd
$ sudo /home/bamboo-agent/bin/bamboo-agent.sh install
# the installer will create files as root, so change the owner and the group
$ sudo chown -R bamboo-agent: /home/bamboo-agent/
# Change the user from the daemon
$ sudo sed -i '/^Type=.*/a User=bamboo-agent\nGroup=bamboo-agent' /etc/systemd/system/bamboo-agent.service
$ sudo systemctl daemon-reload
$ sudo systemctl start bamboo-agent
Now you should be able to see the agent registered in the server. If not, login as the user(in our case bamboo-agent) and check the logs in the home dir.
/JGG
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Davide Imola |
| Solution 2 | |
| Solution 3 | Jason Templeman |
| Solution 4 | Hamish McNeish |
| Solution 5 | Ziaa |
| Solution 6 | JGG |


