Problem With Elastic Agents

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

This widget could not be displayed.

Did you put elastic agent data on your image?

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

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

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.

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?

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

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?

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?

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.......

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?

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

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?

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

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

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

-rwxr-xr-x 1 root root 1903 Feb 15 13:55 /etc/rc.local

What does

ls -l /etc/rc.local

show?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 9 hours ago in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

26 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you