Created
July 14, 2010 15:58
-
-
Save julian7/475613 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm_gemset_create_on_use_flag=1 | |
rvm use 1.9.2@APPNAME > /dev/null | |
alias god='god -p APPNAME' | |
# put the following line to your ~/.rvmrc if you want to have alias setting here: | |
# unalias god 2>/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #{Rails.root}/lib/generators/<appname>/configurations_generator.rb | |
class Appname::ConfigurationsGenerator < Rails::Generators::NamedBase | |
source_root File.expand_path('../templates', __FILE__) | |
def unicorn_god | |
template 'unicorn.god', 'config/unicorn.god' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put it to #{Rails.root}/config/deploy.rb | |
deploy.template = :rails3tags | |
deploy.repository = "[email protected]/access/path.git" | |
# if you use built-in caches for javascripts and stylesheets, set cache_dirs | |
deploy.cache_dirs = %w(public/javascripts/main.js public/stylesheets/main.css) | |
case ENV['environment'] | |
when 'production' | |
deploy.application = "APPNAME" | |
deploy.user = "USERNAME" | |
deploy.hosts = ["PROD.SERVER.NAME"] | |
deploy.path = "/home/#{deploy.user}/apps" | |
deploy.server = :godlike | |
deploy.god_group = "APPNAME" | |
deploy.tag = "rls-VERSION" | |
before_restarting_server do | |
run "rails g APPNAME:configurations #{ENV['environment']} -f" | |
run "which -s newrelic_cmd && newrelic_cmd deployments" | |
end | |
when 'staging' | |
deploy.application = "APPNAME-staging" | |
deploy.user = "USERNAME" | |
deploy.hosts = ["STG.SERVER.NAME"] | |
deploy.path = "/home/#{deploy.user}/apps" | |
deploy.server = :godlike | |
deploy.god_group = "APPNAME" | |
deploy.tag = "stg-VERSION" | |
before_restarting_server do | |
run "rails g APPNAME:configurations #{ENV['environment']} -f" | |
run "which -s newrelic_cmd && newrelic_cmd deployments" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put it to #{Rails.root}/lib/inploy/godlike.rb | |
module Inploy | |
module Servers | |
module Godlike | |
attr_accessor :god_group | |
def god_cmd | |
"god -p #{god_group}" | |
end | |
def start_server | |
run "#{god_cmd} status > /dev/null || #{god_cmd}" | |
end | |
def restart_server | |
start_server | |
Dir.glob('config/*.god').each do |conf| | |
run "#{god_cmd} load #{conf}" | |
end | |
run "#{god_cmd} restart #{god_group}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment