Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problem With Elastic Agents

George Irwin February 12, 2013

I'm using Bamboo OnDemand and I'm having trouble getting Agents to start when using Images (AMI). I've created a custom AMI which has Ubuntu, PostgreSQL, Python etc installed. When I use Bamboo to create an Elastic Instance with this AMI, the Instance is created successfully, but the Elastic Agent doesn't start (sticks on pending for more than 15 minutes).

I've also tried using the standard Ubuntu 12.10 AMI to see whether my custom AMI has broken something, but the problem is the same.

Can anyone tell me how to troubleshoot this or solve it??

Thanks

EDIT:

Thanks to all Przemek's help, I've managed to get a custom ubuntu-based AMI working with Bamboo. Mostly. I can start the Instance through Bamboo, but it won't start the Elastic Agent on that Instance. I have to SSH into the Instance and manually start the Elastic Agent with:

sudo su - bamboo
bamboo-elastic-agent

I've been trying to get that process to run via the Startup Script setting in Bamboo's Image Configuration:

#!/bin/bash
xterm -hold -e "sudo su - bamboo && bamboo-elastic-agent"
fi

But that doesn't seem to work. Is there anyway that I can get the Startup Script to start the Elastic Agent instead of me having to SSH in and do it myself?!

Once I manually start the Elastic Agent, then I am able to successfully run my Django tests through Bamboo and see the test reports.

EDIT 2:

All is now working 100%. It seems I hadn't correctly copied the contents of the bamboo-elastic-agent startup script into rc.local. However, I now have a working AMI with Ubuntu, postgrsql, python and my production environment installed and working correctly with Bamboo. Thanks to Przemek for all his help.

1 answer

1 accepted

1 vote
Answer accepted
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

Did you put elastic agent data on your image?

George Irwin February 12, 2013

Thanks Przemek, but I'm not sure what you mean...?

George Irwin February 12, 2013

OK Przemek, I'm following the instrcutions here:

https://confluence.atlassian.com/display/BAMBOO/Creating+a+custom+elastic+image+-+Linux

However, running:

cat /opt/bamboo-elastic-agent/etc/rc.local >> /etc/rc.d/rc.local

returns no such file or directory.

I have rc0.d, rc1.d ...... etc

Also, just to confirm, the private key / cert referred to as part of profile.sh is the key pair from AWS?

Thanks

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

Hmm, you can try adding

. /opt/bamboo-elastic-agent/etc/rc.local

to /etc/rc.local instead. Just make sure you add it before the "exit 0" line it typically contains.

Also, just to confirm, the private key / cert referred to as part of profile.sh is the key pair from AWS?

Yes, and you don't need them if you don't use EBSes.

George Irwin February 12, 2013

Thanks Przemek. I tried doing that, but still no luck.

I'm not using EBSes, so I've removed the cert/privat ekey lines from profile.sh.

What I'm trying to do is get an AMI which includes Ubuntu/postgresql/python etc and can run with Bamboo. Would it be easier to start with a Bamboo AMI and install all that over the top?

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

That's what we do in Bamboo testing. You can just use the instance setup script (via image configuration) and do something like:

yum install -y postgresql-server

service postgresql initdb

cat > /var/lib/pgsql/data/pg_hba.conf << EOF
local all all trust
host all all 127.0.0.1/32 trust
EOF

/etc/init.d/postgresql start

George Irwin February 12, 2013

Thanks Przemek, but I'd like to get it running on Ubuntu so the instance is absolutely identical to our production environment. Is it possible to achieve that using a Bamboo AMI as the starting point?

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

We don't have an official Ubuntu image, you have to customise your own. If you start the agent manually after the instance is launched from Bamboo, does it work?

George Irwin February 12, 2013

I can start a Bamboo image, yes. That starts fine. So the problem is definitely with my custom Ubuntu AMI.

Is there no way that Bamboo can implement an official Ubuntu image?? For me first prize is to have an Ubuntu AMI to which I can then add python venv, postgres etc and then use that as a custom AMI to launch from Bamboo and run my tests.

I've got my custom AMI going, but of course I can't get it working with Bamboo, despite following the instructions and implementing your suggestions above.

If getting Ubuntu going isn't going to be possible, then I'll have to settle for the standard Linux image, get everything I need onto that then use it as a Custom Image and launch from Bamboo.

But honestly, I can't believe I'm the only person trying to use Bamboo with Ubuntu.......

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

Vote here: https://jira.atlassian.com/browse/BAM-11249

Did you try running the agent manually? I.e. define an image config, start it in Bamboo, log in on the instance, start agent using bamboo-elastic-agent?

George Irwin February 12, 2013

Voted, thanks. I didn't try that, but I will a little later on.

George Irwin February 12, 2013

I was able to start the elastic agent by running bamboo-elastic-agent on the instance. I was also able to run my tests (which aren't properly setup yet, but it gave me the expected feedback). So how can I get Bamboo to start the agent directly?

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 12, 2013

That's distro specific. /etc/rc.local is usually supported (Ubuntu supported at least on Precise release). What's your /etc/rc.local content?

George Irwin February 12, 2013

rc.local has this:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

then I've inserted the contents of . /opt/bamboo-elastic-agent/etc/rc.local above the exit 0 at the bottom

George Irwin February 14, 2013

Have added an edit to my question Przemek - would love it if you could solve my final problem!!

George Irwin February 14, 2013
-rwxr-xr-x 1 root root 1903 Feb 15 13:55 /etc/rc.local

Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2013

What does

ls -l /etc/rc.local

show?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events