TheKeyholdingCompany / capitomcat

Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Capitomcat-ELB

Capitomcat-ELB is a library for deploying Tomcat applications, served behind AWS Elastic Loadbalancers. Capitomcat-ELB will perform a rolling restart on your application, de-registering the instances in sequence to avoid downtime.

Originally forked from: https://github.com/jenkinsci/capitomcat-plugin

##See Also

Capitomcat Jenkins Plugin

##Requirement ###Gem Dependency

  • Ruby >= 1.9
  • Capistrano >= 3.0.1

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][1] page on Capistrano website. [1]: http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/ ####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}
server fetch('deploy@dev01'),
  ...
  instance_id: 'ec2-instance-id',
  ...
end

Required configuration for Capitomcat

set :use_sudo, true

# Loadbalancer config
set :aws_access_key_id, 'XXXYYY'
set :aws_region, 'eu-west-1'
set :aws_secret_access_key, 'xxxyyyzzz'
set :elb_instance_registration_wait_seconds, 300 #optional
set :load_balancer_name, 'elb-name'

# 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'
set :tomcat_cmd_wait_start, 10 # Second
set :tomcat_cmd_wait_stop, 5 # Second
set :use_background_tomcat_cmd, false # Use normal execute command as default

# 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.

About

Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.

License:Apache License 2.0


Languages

Language:Ruby 96.6%Language:HTML 3.4%