Capitomcat

Capistrano Recipe for Tomcat Deploy

Capitomcat

Gem Version

Capitomcat is library for creating Capistrano Tomcat recipe. Capitomcat includes basic tasks for Tomcat deployment. You can create easily your own Capistrano 3 recipe for Tomcat with Capitomcat.

Changes

Changes

See Also

Capitomcat Jenkins Plugin

Requirement

Gem Dependency

Authentication & Authorisation setting for Remote Servers

By the recommendation of Capistrano 3, Capitomcat use SSH Key and NOPASSWD instead of asking password.

for more details, please refer to Authentication & Authorisation page on Capistrano website.

User account setting

root@remote $ adduser <your_deploy_user_name>
root@remote $ passwd -l <your_deploy_user_name>

or

root@remote $ adduser --home /home/deploy --disabled-password deploy

SSH Key setting

Add your SSH key into authorized_keys file of deploy user on your remote server.

NOPASSWD Setting for SUDO

Folowing NOPASSWD setting is required. please add following setting into your /etc/sudoers file.

%your_deploy_user_name ALL=NOPASSWD:/etc/init.d/tomcat7 <Your tomcat command>
%your_deploy_user_name ALL=NOPASSWD: /bin/chown 
%your_deploy_user_name ALL=(<your_tomcat_user> : <your_tomcat_user_group>) NOPASSWD: ALL

Installation

To use Capitomcat in your Capistrano script, you need install as RubyGem

Install Ruby

Please refer to Download Ruby page on the Ruby official website.

Install RubyGems

Please refer to Download RubyGems page on the RubyGems official website.

Install Capistrano

Capitomcat v1.0.0 supports Capistrano 3. (Capitomcat v0.0.x supports Capistrano 2)

$ gem install capistrano -v 3.0.1

Install Capitomcat

$ gem install capitomcat

Configuration

Role Configuration

role :app, %w{deploy@dev01 deploy@dev02}

Required configuration for Capitomcat

set :use_sudo, true

# Remote Tomcat server setting section
set :tomcat_user, 'tomcat7'
set :tomcat_user_group, 'tomcat7'
set :tomcat_port, '8080'
set :tomcat_cmd, '/etc/init.d/tomcat7'
set :use_tomcat_user_cmd, false
set :tomcat_war_file, '/var/app/war/test-web.war'
set :tomcat_context_path, '/test-web'
set :tomcat_context_file, '/var/lib/tomcat7/conf/Catalina/localhost/test-web.xml'
set :tomcat_work_dir, '/var/lib/tomcat7/work/Catalina/localhost/test-web'

# Deploy setting section
set :local_war_file, '/tmp/test-web.war'
set :context_template_file, File.expand_path('../templates/context.xml.erb', __FILE__).to_s
set :use_context_update, false
set :use_parallel, false
set :use_context_update, false

Task

You can get task name of Capitomcat by run cap -T

cap capitomcat:deploy              # Capitomcat Recipe for Tomcat web application deployment

Documentation is still working on...

♥For more details, please refer to example recipes.♥

License

Copyright 2014 Sunggun Yu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

comments powered by Disqus