Using Tomcat with Bamboo for continuous deployment

このページの内容

You can use Bamboo to deploy and manage your Java web application with Tomcat 6 or 7, without having to directly interact with Maven, Ant or write special scripts.

Bamboo provides tasks that use the HTTP-based scripting interface to the Tomcat Manager application that ships with Tomcat. You can use the Bamboo tasks to perform the following Tomcat operations:

  • Deploy an application to a Tomcat instance
  • Start an application in a Tomcat instance
  • Stop an application in a Tomcat instance
  • Reload an application to a Tomcat instance
  • Undeploy an application from a Tomcat instance

Each of these tasks run as part of a Bamboo job.

On this page :

関連情報記載ページ:

Setting up Tomcat

You will need to prepare the Tomcat server before Bamboo can manage and deploy applications to it.

  1. Download the Tomcat 7 distribution and unzip it on your file system.

  2. Add a new Tomcat user for Bamboo to use the Tomcat Application Manager by adding the following line in conf/tomcat-users.xml between the <tomcat-users> tags:

    <user username="bamboo" password="bamboo" roles="manager-script,manager-gui"/>
  3. Start Tomcat by running bin/startup.sh on Linux or Mac, or bin/startup.bat on Windows.
  4. Test this setup by browsing to http://localhost:8080/manager and using the username and password you configured in the step above. You should see the “Tomcat Web Application Manager” page, and a list of the running applications on your instance.
For more information about the Tomcat Application Manager and its authentication and authorization configuration see the Tomcat documentation.

Deploying an application from Bamboo

You use Tomcat deployment tasks in the context of a job in a build plan in Bamboo. This plan should generate a deployable artifact, such as a WAR file. To deploy the artifact, you add a Tomcat deploy task to the plan, as follows:

  1. Navigate to the task configuration for the job (this will be the default job if you are creating a new plan).
  2. Click Add Task and then Deploy Tomcat Application.
  3. Configure the Tomcat task settings, as described below.

  4. 保存をクリックします。

  5. To deploy the application, simply run the plan.

You can check that the deployment has been successful by:

  1. Navigating to the logs for the job. Towards the end you should see something like:

    > Deploying application with war file ‘target/tomcat-test-0.1.war’ to context ‘/myapp’ to server [http://localhost:8080/manager/](http://localhost:8080/manager/)
    > Application was successfully deployed.

    This indicates that Bamboo completed the task successfully.

  2. Now, browse to the expected address for your application. You should see the welcome page.

Configuring the Tomcat tasks

The Tomcat Deploy, Start, Stop, Undeploy and Reload tasks each make use of some or all of the following configuration settings:

Task Description
To help you to identify the task.

Disable this task
Check, or clear, to selectively run this task.

Tomcat Manager URL
The URL for the Tomcat Manager e.g. http://localhost:8080/manager/

Target Tomcat server is version 6.x
Choose this if deploying to a Tomcat 6.x server.

Tomcat Manager Username and Password
These should match the credentials set in conf/tomcat-users.xml when you configured Tomcat, as described above.

Application Context
Specifies where the application should sit on the Tomcat server once deployed.

WAR File
The path to the WAR file, relative to the Bamboo working directory, for example “target/tomcat-test-0.1.war”

Deployment Tag
The value used to tag the deployment within the Tomcat Manager. You can use Bamboo variables to build the tag value.

For example, using the value ${bamboo.buildResultKey} will tag the deployment with the build number of the build that was used to deploy the application.

Last modified on Jul 20, 2017

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

Not finding the help you need?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.