[Bamboo Knowledge Base]
If you have relatively static resources required for building your Bamboo jobs (such as, source code checkouts and Maven repository artifacts), you can add these to an EBS volume. From this volume, you can create an EBS snapshot, which effectively records the 'state' of an EBS volume at a given point in time.
After setting up an EBS snapshot, you can then associate it with an elastic image configuration. When this elastic image is started:
Why should I use the EBS with Elastic Bamboo?
Because an elastic instance is stateless, so also is the elastic agent that runs on it. Hence, every time an elastic instance is restarted from the same image:
Therefore, you can use the EBS to store these external resources in an EBS volume and snapshot so that they do not have to be downloaded or source code checked out each time you start up an elastic instance from an image. If your jobs rely heavily on downloading such resources and/or you are not performing clean builds each time, the EBS may significantly improve your build times.
Additionally, the EBS provides an easy mechanism for customising elastic agents, rather than you having to create a custom elastic image from scratch (with your own elastic agent capabilities). For example, you could upload files and scripts to your EBS volume that would install resources such as PostgreSQL databases for your elastic agents, which will be available when the agent's elastic instance is started.
On this page:
Related page:
To create your first EBS snapshot:
createInitialVolume.sh
<volume size> — This script creates a EBS volume (where <volume size> is the size of the volume), attaches the volume and mounts it on the elastic instance. For example, createInitialVolume.sh 100
will create a 100GB EBS volume and attach and mount it on the elastic instance.rewarmEbsSnapshot.sh
— This script sets up the standard structure for Elastic Bamboo on the EBS volume. The directories and files for this standard volume structure are detailed in the Important EBS Directories and Files section below./mnt/bamboo-ebs
folder or its subfolders, if you want them to be included in the snapshot. We recommend that you read Populating your EBS volume for guidelines on how to populate your EBS volume effectively.chown -R bamboo:bamboo
<filename>killall java
command — This command kills all processes on the instance, such as agent processes, so that the volume can be unmounted to be snapshotted.generateSnapshot.sh
— This script unmounts and detaches the volume, before creating a snapshot based on the volume. The time taken to create the snapshot will vary depending on the amount of content that you have uploaded to the EBS volume. The Snapshot ID for the snapshot will be available in the logs for the elastic instance. See Accessing an Elastic Instance for instructions on how to access the logs for your elastic instance.Once you have set up an EBS snapshot, the final step is to add the snapshot details to an elastic image configuration, so that any instances started from that image will have EBS volumes attached to them. You can associate different snapshots with different elastic image configurations.
To configure Elastic Bamboo to use an EBS snapshot:
If you are currently using EBS with Elastic Bamboo and want to update your snapshot, follow the instructions below. These are similar to the instructions for creating a new EBS snapshot.
To update your EBS snapshot:
/mnt/bamboo-ebs
folder or its subfolders, if you want them to be included in the snapshot.killall java
— This command kills all agent processes, so that nothing is using the mounted volume.jps -vl
— This command displays a list of all java processes running on your instance. There should be no java processes running.generateSnapshot.sh
— This script unmounts and detaches the volume, before creating a snapshot based on the volume.By convention, Bamboo will attach an EBS device at /dev/sdh
. This will be mounted at /mnt/bamboo-ebs
. The contents of the standard structure are:
bin/customiseInstance.sh
- This script is run on startup of an elastic instance. We recommend that you do not customise this script, as it is overwritten when rewarmEbsSnapshot.sh
is run.bin/customise-extras.sh
- This script is run on startup of an elastic instance as the root (as opposed to being run as the Bamboo user). This script is safe to customise, as it will never be overwritten. You can customise this script to automate processes such as setting up your database, move files to custom locations on the instance, etc.profile-extras.sh
- This script gets appended to the profile that is run under the Bamboo user (as opposed to being run as the root). It is useful for setting up environment variables.bamboo-agent/bamboo-agent.cfg.xml
- This configuration file modifies the build working directory to point to build working directory on the EBS volume.bamboo-agent/build-dir
- This is the build working directory.maven/build.properties
- This properties file is copied to /home/bamboo
on startup of an elastic instance. It points the Maven 1 default repository to /mnt/bamboo-ebs/maven/.maven
maven/.m2/settings.xml
- This configuration files is copied to /home/bamboo/.m2
on startup of an elastic instance. It points the Maven 2 default repository to /mnt/bamboo-ebs/maven/.m2/repository
.tmp-extras
- The contents of this directory is copied to /tmp
on startup of an elastic instance.