Giter Site home page Giter Site logo

san_juan's Introduction

Description

Want Capistrano to talk to God? Find San Juan

Requirements

Install


gem install jnewland-san_juan
OR
gem install jnewland-san_juan -s http://gems.github.com

Usage

In your Capistrano deploy recipe:


require 'san_juan'

role :app, 'foo.example.com'
role :web, 'bar.example.com'

san_juan.role :app, %w(mongrels memcached)
san_juan.role :web, %w(nginx)

Now, check out cap -T:


  ...
  cap god:all:quit                                   # Quit god, but not the proce...
  cap god:all:reload                                 # Reloading God Config
  cap god:all:start                                  # Start god
  cap god:all:start_interactive                      # Start god interactively
  cap god:all:status                                 # Describe the status of the ...
  cap god:all:terminate                              # Terminate god and all monit...
  cap god:app:mongrels:log                           # Log mongrels
  cap god:app:mongrels:remove                        # Remove mongrels
  cap god:app:mongrels:restart                       # Restart mongrels
  cap god:app:mongrels:start                         # Start mongrels
  cap god:app:mongrels:stop                          # Stop mongrels
  cap god:app:mongrels:unmonitor                     # Unmonitor mongrels
  cap god:app:memcached:log                          # Log memcached
  cap god:app:memcached:remove                       # Remove memcached
  cap god:app:memcached:restart                      # Restart memcached
  cap god:app:memcached:start                        # Start memcached
  cap god:app:memcached:stop                         # Stop memcached
  cap god:app:memcached:unmonitor                    # Unmonitor memcached
  cap god:app:quit                                   # Quit god, but not the proce...
  cap god:app:reload                                 # Reload the god config file
  cap god:app:start                                  # Start god
  cap god:app:start_interactive                      # Start god interactively
  cap god:app:terminate                              # Terminate god and all monit...
  cap god:web:nginx:log                              # Log nginx
  cap god:web:nginx:remove                           # Remove nginx
  cap god:web:nginx:restart                          # Restart nginx
  cap god:web:nginx:start                            # Start nginx
  cap god:web:nginx:stop                             # Stop nginx
  cap god:web:nginx:unmonitor                        # Unmonitor nginx
  cap god:web:quit                                   # Quit god, but not the proce...
  cap god:web:reload                                 # Reload the god config file
  cap god:web:start                                  # Start god
  cap god:web:start_interactive                      # Start god interactively
  cap god:web:terminate                              # Terminate god and all monit...
  ...

To make capistrano start, stop, and restart your app using God, override the
deploy:start, deploy:stop, and deploy:restart tasks:


namespace :deploy do
  desc "Use god to restart the app"
  task :restart do
    god.all.reload #ensures any changes to the god config are applied at deploy
    god.app.mongrels.restart
    # god.web.nginx.restart
    # ...
  end

  desc "Use god to start the app"
  task :start do
    god.all.start
  end

  desc "Use god to stop the app"
  task :stop do
    god.all.terminate
  end
end

Tweaks

A few of the tasks in the god:all namespace require the path to your god
configuration file. This defaults to:

"#{current_path}/config/god/#{role}.god"

This can be changed by setting the god_config_path capistrano variable:


require 'san_juan'

set :god_config_path, "/path/to/config"

role :app, 'foo.example.com'
role :web, 'bar.example.com'

san_juan.role :app, %w(mongrels memcached)
san_juan.role :web, %w(nginx)


Role Specific God Configurations

If you have separate god configurations for different roles, it is possible to segment your
god configuration files. Your god files must be named #{role}.god and be placed in the
#{current_path}/config/god directory, like so:

#{current_path}/config/god/app.god
#{current_path}/config/god/web.god
#{current_path}/config/god/db.god

san_juan will load the correct god configuration for each role.

Note: This will only work if you do not explicitly set god_config_path.

If you have some god configuration items that are universal and some that are role-specific,
try combining common items into a separate configuration file and use God.load.


# /config/god/all.god
# Some common configuration here, like email notification settings
RAILS_ROOT = File.dirname(File.dirname(File.dirname(__FILE__)))

God::Contacts::Email.message_settings = {
  :from => "[email protected]"
}
God::Contacts::Email.delivery_method = :sendmail



# /config/god/app.god
God.load(File.join(File.dirname(__FILE__), "all.god"))

# Some specific configuration for only the app servers here...

# Can use everything from all.god
some_path = #{RAILS_ROOT}/some/path/here

Author

Jesse Newland

License

WTFPL

san_juan's People

Contributors

jnewland avatar

Stargazers

Micah Wedemeyer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.