Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andykuszyk/ae1e2e5200ff18091ca266e8ea8beef7 to your computer and use it in GitHub Desktop.
Save andykuszyk/ae1e2e5200ff18091ca266e8ea8beef7 to your computer and use it in GitHub Desktop.
Installing multiple Bamboo remote agents on a single machine (as a Windows service)

Installing multiple Bamboo remote agents on a single machine (as a Windows service)

I've recently been setting up multiple remote agents for Bamboo on the same machine to run as Windows service instances. Although there's information out there as to how this is achieved, I thought I'd document all the steps here for future reference.

Pre-requisites

Assumptions are that you have:

  • Installed Bamboo on a server somewhere;
  • Have another machine that you want to install remote agents on;
  • This other machine can access the server over http;
  • The other machine has java installed on it;

Configuring Bamboo (on the server)

Under Bamboo Administation (cog in the top right), you should be able to choose Agents.

On this screen, there should be a button to Install remote agent in the top right. Click it.

This screen gives you a link to download a jar package and a command to run to run the remote agent instance.

Configuring the remote server

If you're installing multiple remote agents, you'll probably want them to all have separate and easily locatable home directories. Create some home directories somewhere, lets say in C:\Bamboo. Go to the Install remote agent link in a browser in your remote machine and download the java package.

Now, you're ready to run the remote agent instance using the command provided, which should be something like this:

java -jar atlassian-bamboo-agent-installer-X.X.X.jar http://server-address:8085/agentServer/

However, this will only run the remote agent in a command prompt and will use a pre-configured home directory. We want to install the agent as a service and use a custom directory.

Use a custom home directory

This option specifies the custom home directory:

java -Dbamboo.home=C:\Bamboo\agent-01-home -jar atlassian-bamboo-agent-installer-X.X.X.jar http://server-address:8085/agentServer/

Install as a service

This suffix installs the agent as a service:

java -Dbamboo.home=C:\Bamboo\agent-01-home -jar atlassian-bamboo-agent-installer-X.X.X.jar http://server-address:8085/agentServer/ installntservice

Installing multiple services

So far so good, if you run this command you will get a remote agent installed as a service pointing to your custom home directory. However, running it a second time will result in an error, because the same service name is chosen each time. We need to re-name each service instance once it has been installed.

First, under C:\Bamboo\agent-01-home\bin run UninstallBambooAgent-NT.bat.

This uninstalls the service with its default name.

Then, edit C:\Bamboo\agent-01-home\conf\wrapper.conf. At the end of this file, you'll find references to the name of the service. Modify these to a unique name.

Finally, re-install the service using C:\Bamboo\agent-01-home\bin\InstallBambooAgent-NT.bat.

If you take a look at your local services, you should now have a service installed with the name you specified. You can now carry on installing additional agents as services as required.

@gowseshaik
Copy link

/usr/jdk/instances/jdk1.8.0/bin/java -Dbamboo.home=/export/home/bradmin/bamboo-pp-agent-home /usr/jdk/instances/jdk1.8.0/bin/java -jar atlassian-bamboo-agent-installer-6.8.0.jar http://bambooServerIP:8085/agentServer/

Error: Could not find or load main class .usr.jdk.instances.jdk1.8.0.bin.java

java -Dbamboo.home=/export/home/bradmin/bamboo-pp-agent-home java -jar atlassian-bamboo-agent-installer-6.8.0.jar http://bambooServerIP:8085/agentServer/

Error: Could not find or load main class java

what could be the reason, running on solaris.

@jonvel
Copy link

jonvel commented Mar 24, 2023

You're double-starting Java is the problem - java -Dkey=value java -jar myjar.jar will fail always, unless your myjar.jar has a class named java in it (which is unlikely). Just get rid of the second java and you might get further:
java -Dbamboo.home=/export/home/bradmin/bamboo-pp-agent-home -jar atlassian-bamboo-agent-installer-6.8.0.jar http://bambooServerIP:8085/agentServer/

I'm interested to see what this turns up, as I'm thinking of running multiple remote agents on the same host, too.

@ollypapa99
Copy link

This documentation helps my rookie understanding compared to other information i have been reading. I am new to bamboo and just started learning about it. But i am wondering if anyone here can be a personal guidance for me while i am learning it. and i don't mind rewarding for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment