This is the documentation for Bamboo 5.7. View this page for the

Unknown macro: {spacejump}

of Bamboo, or visit the latest Bamboo documentation.

An elastic image is an Amazon Machine Image (AMI) that is stored in one of Amazon data centres for use with the Elastic Bamboo feature. An elastic image is used to create elastic instances, which in turn create elastic agents. Conceptually, an elastic image is equivalent to an operating system running on a computer's boot hard drive and elastic instances would be the software that runs on this operation system.

Amazon Web Services (AWS) に登録されたエラスティック イメージのそれぞれに、AMI ID と呼ばれる独自の識別子があります。

You can associate multiple elastic images with a Bamboo server. One default shared image is maintained by Atlassian in AWS, and is available to all Elastic Bamboo users.

At a high level, the process for creating a custom elastic image consists of taking one of the existing Amazon Machine Images (AMIs) available on Amazon EC2, starting an instance of the AMI, customising the instance and then creating an image from the customised instance. This image can then be used as an elastic image in your Bamboo installation.

カスタム イメージを作成する代わりに次のことを検討してください (Linux/UNIX のみ)。

  • Bamboo 管理 / イメージ設定に用意されているインスタンス設定スクリプトを使用できます。このスクリプトは、エージェントが起動する前にルート ユーザーとして実行されるものです。
  • Consider customising an existing Bamboo image by using Amazon's Elastic Block Store (EBS), as described in Configuring elastic instances to use the EBS.

Above options are much simpler than creating a new custom image. If you are having problems, please don't hesitate to contact us for further help.

始める前に

  • これは簡単な手順ではなく、おそらく必要ないでしょう。
  • Please note, Atlassian does not support custom elastic images. Consider customising the elastic agents started from your stock images instead.
  • A number of the EC2 commands in the steps below can be completed using the AWS console rather than command line tools (e.g. registering an image). You should use the method you're feel most comfortable with.

On this page:

1. 要件

まず、次の設定が完了していることを確認してください。

  • Amazon Web Services (AWS) account with EC2 — if you are already using Elastic Bamboo, you should already have an AWS account with EC2 set up. If not, please read Getting started with Elastic Bamboo.
  • Amazon EC2 API Tools — you must install the EC2 API tools on your local machine, otherwise you will not be able to start and access your AMI instance. Note: you need Java Runtime Environment to run these tools. You can install the EC2 API tools by executing the following commands:

    wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
    unzip ec2-api-tools.zip
  • 環境変数 — カスタム エラスティック イメージを作成する前に、ローカル マシンで次の環境変数を設定する必要があります。
    • EC2_HOME — インストール済みの EC2 API ツールのパスに設定します
    • EC2_CERT — EC2 アカウントに割り当てられた証明書のパスに設定します。
    • EC2_PRIVATE_KEY — AWS アカウントに割り当てられた非公開キーのパスに設定します。
  • 登録済みキー ペア — AMI インスタンスで EC2 API ツールを使用するには、非公開キー ファイルと証明書ファイルで構成される登録済み EC2 キー ペアが必要です。以前に EC2 キー ペアを生成して登録したことがある場合は (EC2 API ツールを使用するためなど)、それを再利用できます。新しいキー ペアを生成する必要がある場合は、次のコマンドを使用して生成できます。

    ec2-add-keypair <key_pair_name>

    非公開キーの内容はコンソールのコマンド ライン出力に表示されます。この内容を先頭に次の行を追加してファイルに保存します。

    "--BEGIN RSA PRIVATE KEY--"

    末尾には次の行を追加します。

    "--END RSA PRIVATE KEY--"

    この非公開キー ファイルは、AMI インスタンスへのアクセスに使用されます。次のコマンドを実行して、非公開キー ファイルに対する適切な権限を設定します。

    chmod 600 <private_key_file>

2.既存の AMI を選択する

We strongly recommend that you select an existing Linux/UNIX AMI to customise, rather than starting with a blank AMI. When choosing an AMI, decide whether you want to launch 32-bit or 64-bit instances from your custom elastic image and select an existing AMI matching your choice.

We recommend the following existing Linux/UNIX AMIs for customisation (in order of preference):

ソース説明 AMI リスト
アトラシアンOne of the stock images provided by Atlassian. It is an Amazon image, for either Linux or Windows, updated and prepared for Bamboo, i.e. you will not have to install any Bamboo prerequisites.Bamboo インスタンスの管理 / イメージ設定で利用可能
AmazonAmazon から提供されている Centos ベースのイメージ。Bamboo の前提条件はインストールされていません。通常は、アトラシアンの AMI を使用することをお勧めします。Amazon のサイト
Canonical (Ubuntu)Canonical (Ubuntu Linux プロジェクトの背後にある会社) から提供されている公式の Ubuntu イメージです。Bamboo の前提条件はインストールされていません。Canonical のサイト

Atlassian's AMIs (and hence, their IDs) may change with each release of Bamboo, including both major and minor releases. To quickly access Atlassian's AMI IDs for your currently-running version of Bamboo, open that Bamboo site in a web browser and access its 'Image Configurations' page (see Managing your Elastic Image Configurations for more information). The AMI IDs of Atlassian's AMIs are labelled with "(stock image)".

  1. URL https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/bamboo/atlassian-bamboo/ を Web ブラウザーで開きます。
  2. On the resulting directory page, click the link that represents the version of Bamboo you are currently running. For example, if you are running Bamboo 3.4.4, click on the 3.4.4 link. Another directory page opens, listing a .pom and some additional checksum files.
    (warning) Do not click on a version number link that contains 'mX', 'rcX' or 'betaX' (where 'X' is a number), since these relate to publicly available developmental releases of Bamboo.
  3. atlassian-bamboo-x.x.x.pom ファイル (x.x.x は Bamboo のバージョン) を開きます。イメージのバージョン / ベースラインは elastic-image.version タグに保存されています。たとえば、バージョン 3.4.4 の場合、ベースラインは 1.7 でした。
  4. Open the following URL: https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/bamboo/atlassian-bamboo-elastic-image/ in a web browser.
  5. elastic-image.version タグで確認したイメージ ベースライン バージョンをクリックします。
  6. 表示されたディレクトリ ページでは、ami 拡張子の付いたファイルにすべてのストック イメージ AMI ID が含まれています。

3.インスタンスを起動する

After you have selected an existing AMI to customise, the next step is to start an instance of the AMI.

3.1 アトラシアンの既定の AMI のインスタンスを起動する

If you chose to customise Atlassian's default AMI, you will have to start the instance from the admin section of Bamboo. See Starting an elastic instance.

アトラシアンの既定の AMI は、コマンド ラインの ec2 ツールでは起動できません。これは、起動時に、アトラシアンの AMI の Bamboo エージェントによって、それが Bamboo Server から起動されたかどうかが確認され、そうでない場合はすぐにシャットダウンされるためです。

Once started, see Accessing an elastic instance for details on how to access the running instance.

3.2 コマンド ラインからインスタンスを起動する

次のように、ec2-run-instances コマンドを使用してインスタンスを起動します。

ec2-run-instances <image_name> -k <key_pair_name>

where <image_name> is the name of the AMI selected in the previous step and <key_pair_name> is the name of the registered key pair generated in '1. Requirements'. The public certificate of this key will be injected into your instance.

たとえば、キー ペア my-keypair を使用してイメージ ami-e55bbd8c のインスタンスを起動する場合は、次のコマンドを実行します。

ec2-run-instances ami-e55bbd8c -k my-keypair

このコマンドのコマンド ライン出力は次のとおりです。

INSTANCE        i-25b86743   ami-e55bbd8c     running   my-keypair

i-25b86743 is the name of the new instance in the above example. You should note down the name of your new instance, as you will need that to access your instance in the next step.

使用されていないインスタンスをシャットダウンすることを忘れないでください。

Please note that once you start an instance, you will be billed by Amazon for instance uptime. If you decide to abandon the setup of a custom elastic image after this step, please ensure that you shut down your instance via the AWS console.

3.3 Bamboo からインスタンスを起動する

You can also start a fresh, uncustomised image from Bamboo and begin customisation. The drawback of this approach is that you have only 40 minutes before Bamboo shuts down your instance. The advantage is that you can customise the agent in a single step (as opposed to having to customise/create image/start from Bamboo/save image again).

4.インスタンスにアクセスする

If you started the instance from Bamboo, see Accessing an elastic instance for details on how to access the running instance.

インスタンスが実行されていれば、インスタンスにアクセスできるようにインスタンスのアドレスを取得する必要があります。そのためには、次のコマンドを使用します。

ec2-describe-instances <instance_name>

たとえば、インスタンス i-25b86743 のアドレスを調べるには、次のように入力します。

ec2-describe-instances i-25b86743

このコマンドのコマンド ライン出力は次のようになります。

RESERVATION	r-790f7210	121852097033	default
INSTANCE	i-25b86743	ami-e55bbd8c 	ec2-174-129-94-241.compute-1.amazonaws.com
domU-12-31-39-04-38-87.compute-1.internal	running	elasticbamboo	0		m1.small
2009-06-24T12:36:20+0000	us-east-1c	aki-a71cf9ce	ari-a51cf9cc
monitoring-disabled

上記の例のインスタンスのアドレスは ec2-174-129-94-241.compute-1.amazonaws.com です。

You can then use this address to access the instance via SSH. See Accessing an elastic instance for instructions. If you are using the example command text from that document, you will need to adjust it as follows:

  • replace /opt/bamboo/home/xml-data/configuration/elasticbamboo.pk in the example command text with the private key file you generated in '1. Requirements'.
  • サンプル コマンド テキスト内の ec2-68-111-185-197.compute-1.amazonaws.com を対象のインスタンスのアドレスに置き換えます。

5. Customising your instance

Now that you have a running instance, customisation steps heavily depend on the operating system you're using. We've prepared separate pages with Linux-specific instructions and Windows-specific instructions

6. Creating an image of your customised instance

新しいイメージを作成するプロセスは、イメージがインスタンス ストアと EBS ルート イメージのどちらに基づいているかによって異なります。イメージのタイプは、AWS コンソールまたは ec2-describe-images を使用して確認できます。

EBS ルート インスタンスからイメージを作成する

See here for instructions: Amazon Tutorial

インスタンス ストア (S3) インスタンスからイメージを作成する

The final step is to create an image from your customised instance. To do this, you will require the following information:

  1. Amazon 非公開キー ファイルと証明書をインスタンスに転送します。
    キー ファイルをインスタンスに転送するには、ローカル マシンで次のコマンドを実行します。

    scp -i <private_key_file> $EC2_PRIVATE_KEY root@<instance_address>:/mnt
    scp -i <private_key_file> $EC2_CERT root@<instance_address>:/mnt
    

    where <private_key_file> is the private key file from your local machine created in step 'Registered Key Pair' of 1. Requirements and the <instance_address> is the address of your instance from '4. Accessing your Instance'.

  2. EC2_HOME および JAVA_HOME 環境変数を設定します。
    これらの環境変数を設定するには、インスタンスで次のコマンドを実行します。

    export EC2_HOME=<location of your EC2 tools installation>
    export EC2_PRIVATE_KEY=/mnt/<ec2_private_key_file>
    export EC2_CERT=/mnt/<ec2_certificate_file>
    export JAVA_HOME=<path to JRE used to start the agent>
    
  3. You can create an image of your customised instance by using the ec2-bundle-vol command, as follows:

    ec2-bundle-vol -c $EC2_CERT -k $EC2_PRIVATE_KEY -u <amazon_account_number> -p <elastic_image_name> --batch --debug
    

    ここで、<elastic_image_name> は、カスタム イメージに割り当てる名前です (「CustomImage1」など)。

  4. イメージが作成されたら、次のコマンドを実行して Amazon S3 にアップロードする必要があります。

    ec2-upload-bundle -b <s3_bucket_name> -m /tmp/<elastic_image_name>.manifest.xml -a <access_key_id> -s <secret_access_key> --retry --debug
    

    ここで、<s3_bucket_name>、<access_key_id>、<secret_access_key> は、前述の Amazon S3 バケット名、アクセス キー ID、シークレット アクセス キーです。<elastic_image_name> は、カスタム イメージに割り当てる名前です (「CustomImage1」)。

    次に、ec2-register コマンドを使用して、Amazon EC2 にイメージを登録する必要があります。

    ec2-register <s3_bucket_name>/<elastic_image_name>.manifest.xml
    

    ここで、<s3_bucket_name> は、前述の Amazon S3 バケット名です。<elastic_image_name> は、カスタム イメージに割り当てる名前です (「CustomImage1」)。このコマンドの出力には、カスタム イメージの AMI ID が表示されます。

7. 次のステップ

カスタム エラスティック イメージの作成が終了したら、それを使用できるようにするために、さらに 2 つのステップを完了する必要があります。

First, you will need to associate your custom elastic image with your Bamboo installation by creating an Elastic Image Configuration. Please note the AMI ID of your new custom image and read Managing your Elastic Image Configurations for further instructions.

Secondly, you will need to configure the capabilities of the elastic agents that will run on instances started from your image. This is done by adding the appropriate builder, JDK, Perforce and custom capabilities to your elastic image configuration, so that it reflects what your custom elastic image actually can do. For example, if you have created a custom elastic image with JDK 1.6 and Maven 2 installed, you will need to add capabilities for JDK 1.6 and Maven 2 to the elastic image configuration. Read Configuring Elastic Agent Capabilities for further instructions.

 

8. お困りですか?

さらに支援が必要な場合は、次のようなリソースを活用できます。

  • AWS Support Center — if you are having problems with any of your Amazon services, not specifically related to Bamboo, you can obtain basic support from the AWS Support Center. Note, you will need to sign up for Premium Support to get access to web/phone support.
  • AWS Resource Center — the AWS Resource Center has links to online documentation, code samples and tools for AWS services.
  • Bamboo Developer Forums — please feel free to discuss any useful tips or issues regarding this process in the Bamboo Developer Forums.