This documentation relates to an earlier version of Bamboo.
View

Unknown macro: {spacejump}

or visit the current documentation home.

Amazon Elastic Block Store (EBS) provides persistent storage volumes that can be attached to EC2 instances. Elastic Bamboo can use the EBS to store snapshots of relatively static build information, such as checkouts of source code and Maven repository data. You can choose a snapshot to create EBS volumes from and associate it with an elastic image configuration. These volumes can then be attached to your elastic instances when they are started from their elastic image.

Why should I use Amazon EBS with Elastic Bamboo?

Elastic agents are effectively stateless. This means that any externally-retrieved resources such as Maven artifacts, cached application servers, etc, will be downloaded again each time an elastic agent is started. The elastic agent will also perform a full checkout the first time a plan is built on the agent. If your builds have external dependencies and/or you are not performing clean builds each time, you may find that Amazon EBS will significantly improve your build times.

Additionally, EBS can be used as an easy mechanism for customising elastic agents, rather than changing the configuration of the elastic images (see Creating a Custom Elastic Image) that the agents are started from. For example, you could upload files and scripts to your EBS volume that would install PostgreSQL databases on elastic agents when are started from the related elastic instance.

On this page:

最初の EBS スナップショットを作成する

To create your first EBS snapshot,

  1. Download Amazon Web Services (AWS) account identifiers to your Bamboo server — You will need to store the AWS private key file and certificate file on your Bamboo server to use Elastic Bamboo with EBS. If you haven't downloaded an AWS private key file or certificate file to your Bamboo server yet, please see Generating your AWS Private Key File and Certificate File for instructions.
  2. Update your Bamboo configuration settings with the location of the AWS account identifier files you have downloaded. This will ensure that these files are uploaded to any new elastic instances started. See the Elastic Instance Settings section on the Configuring Elastic Bamboo for instructions (you will need to update the 'Upload AWS account identifiers to new elastic instances (mandatory if EBS Snapshot ID specified)' checkbox and 'Account Private Key File' and 'Account Certificate File' fields described in this document).
  3. Start a single elastic instance via Bamboo. See Starting an Elastic Instance for instructions.
  4. Access your elastic instance via SSH (see Accessing an Elastic Instance for instructions).
  5. Follow the steps below to create an EBS volume and attach it to the elastic instance (step a & b), upload content to the EBS volume (step c & d), and generate the snapshot (step e & f):
    (info) All the scripts described below are bundled with Bamboo.
    1. createInitialVolume.sh <ボリュームのサイズ> を実行します。このスクリプトでは、EBS ボリューム (<ボリュームのサイズ> はそのボリュームの大きさ) を作成し、ボリュームをアタッチして、エラスティック インスタンスにマウントします。たとえば、createInitialVolume.sh 100 の場合は、100GB EBS ボリュームを作成し、それをエラスティック インスタンスに添付してマウントします。
    2. Run 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.
    3. (optional) Populate your EBS volume — Your EBS volume can now be populated with any files and scripts that you wish to make available to the elastic instances that use the EBS volume. For example, you may want to upload maven repository data, source code, scripts and files to install databases on your elastic agents, etc. You must upload your files to the /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.
      (info) The EBS volume is attached to the elastic instance, so accessing your elastic instance via SSH will give you full access to the EBS volume (see Important EBS Directories and Files below).
    4. アップロードされたすべてのコンテンツの所有者が bamboo:bamboo であることを確認します。コマンド chown -R bamboo:bamboo <ファイル名> を実行すると、ファイルの所有者を設定できます。
    5. killall java コマンドを実行します。このコマンドでは、エージェント プロセスなど、インスタンス上のすべてのプロセスを強制終了するため、ボリュームをアンマウントしてスナップショットを作成できます。
    6. Run 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.
  6. Shut down your elastic instance. See Shutting down an Elastic Instance for instructions.

Congratulations! You have created your first EBS snapshot!

Configuring an Elastic Image to use an EBS snapshot

EBS スナップショットの設定が終了したら、最後のステップは、スナップショットの詳細をエラスティック イメージ設定に追加することです。これにより、そのイメージから起動されるすべてのインスタンスに EBS ボリュームがアタッチされます。さまざまなスナップショットを別々のエラスティック イメージ設定に関連付けることができます。

To configure Elastic Bamboo to use an EBS snapshot,

  1. Determine the Snapshot ID of the EBS snapshot you have just created. The Snapshot ID should be recorded in the logs of the elastic instance you created it on. You can also view your EBS snapshots in the AWS Console by clicking the 'Snapshots' menu item.
    Screenshot: AWS Console (click to view full-size image)
  2. Navigate to the Bamboo administration menu, i.e. click the 'Administration' link in the top navigation bar of the Bamboo application.
  3. Click the 'Image Configurations' link in the left navigation column under the 'Elastic Bamboo' sub-header. The 'Manage Elastic Image Configurations' page will display.
  4. Click the 'Edit' link in the 'Operations' column of the elastic image configuration that you would like to add your EBS snapshot to. The 'Edit Elastic Image Configuration - <imagename>' screen will display (see screenshot below).
    Screenshot: Adding EBS Snapshot details to an Elastic Image Configuration (click to view full-size image)
  5. Check the 'Automatically attach an Amazon Elastic Block Store (EBS) volume to new elastic instances' checkbox. The 'EBS Snapshot ID' field will display.
  6. Enter the Snapshot ID of your EBS snapshot in the 'EBS Snapshot ID' field.
  7. Click the 'Save' button. A new EBS volume will be created from the specified snapshot and attached to any new elastic instances started from that image.

EBS スナップショットを更新する

現在 Elastic Bamboo で EBS を使用していて、スナップショットの更新が必要になった場合は、次の手順に従ってください。この手順は、新しい EBS スナップショットを作成する手順に似ています。

To update your EBS snapshot,

  1. Start a single elastic instance via Bamboo. See Starting an Elastic Instance for instructions.
  2. (optional) Run a build on the elastic agent of the instance to populate the attached EBS volume. We recommend that you read Populating your EBS volume for guidelines on how to populate your EBS volume effectively.
  3. Access your elastic instance via SSH (see Accessing an Elastic Instance for instructions) and do the following:
    (info) All the scripts described below are bundled with Bamboo.
    1. (optional) Upload any additional content to the attached EBS volume via Secure Copy (SCP). You must upload your files to the /mnt/bamboo-ebs folder or its subfolders, if you want them to be included in the snapshot.
    2. killall java を実行します。このコマンドでは、すべてのエージェント プロセスを強制終了し、マウントされたボリュームを使用していない状態にします。
    3. jps -vl を実行します。このコマンドでは、インスタンスで実行されているすべての Java プロセスのリストを表示します。実行中の Java プロセスは存在しないはずです。
    4. Run generateSnapshot.sh — This script unmounts and detaches the volume, before creating a snapshot based on the volume.
    5. Check the elastic instance logs for the Snapshot ID of the snapshot you just created. See Accessing an Elastic Instance for instructions on how to access the logs for your elastic instance.
    6. Update the new Snapshot ID in your Elastic Bamboo configuration, as described in Configuring an Elastic Image to use an EBS snapshot above.

Important EBS Directories and Files

慣例により、Bamboo では EBS デバイスは /dev/sdh でアタッチされます。これは /mnt/bamboo-ebs にマウントされます。標準構造のコンテンツは次のとおりです。

  • 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 - このスクリプトは、(ルートとして実行されるのではなく) Bamboo ユーザーで実行されるプロファイルに追加されます。これは環境変数を設定するのに便利です。
  • bamboo-agent/bamboo-agent.cfg.xml - この設定ファイルでは、ビルド作業ディレクトリを EBS ボリューム上のビルド作業ディレクトリを指すように変更します。
  • bamboo-agent/build-dir - これはビルド作業ディレクトリです。
  • maven/build.properties - このプロパティ ファイルは、エラスティック インスタンスの起動時に /home/bamboo にコピーされます。Maven 1 の既定のリポジトリは /mnt/bamboo-ebs/maven/.maven を指します。
  • maven/settings.xml - この設定ファイルは、エラスティック インスタンスの起動時に /home/bamboo/.m2 にコピーされます。Maven 2 の既定のリポジトリは /mnt/bamboo-ebs/maven/.m2/repository を指します。
  • tmp-extras - このディレクトリのコンテンツは、エラスティック インスタンスの起動時に /tmp にコピーされます。