Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | ||
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | ||
|
||
load 'config/deploy' # remove this line to skip loading any of the default tasks |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# The name of your application. Used for deployment directory and filenames. | ||
set :application, "tweetsavr" | ||
|
||
# Primary domain name of your application. | ||
set :domain, "tweetsavr.com" | ||
|
||
## List of servers | ||
server "tweetsavr.com", :app, :web, :db, :primary => true | ||
|
||
# Target directory for the application on the web and app servers. | ||
set(:deploy_to) { File.join("", "home", user, "apps", application) } | ||
set :user, "rails" | ||
|
||
# Repo details | ||
set :repository, "git://github.com/caius/tweetsavr.git" | ||
set :scm, :git | ||
set :deploy_via, :remote_cache | ||
set :git_enable_submodules, 1 | ||
set :branch, "master" | ||
ssh_options[:forward_agent] = true | ||
|
||
# Forces a Pty so that svn+ssh repository access will work. You | ||
# don't need this if you are using a different SCM system. Note that | ||
# ptys stop shell startup scripts from running. | ||
default_run_options[:pty] = true | ||
|
||
set :use_sudo, false | ||
|
||
set :local_shared_files, [] | ||
set :local_shared_dirs, %w(cache) | ||
|
||
set :global_shared_files, [] | ||
set :global_shared_dirs, [] | ||
set :global_shared_path, "~" | ||
|
||
after "deploy:setup", | ||
"deploy:shared:global:setup", | ||
"deploy:shared:local:setup" | ||
|
||
after "deploy:finalize_update", | ||
"deploy:shared:global:symlink", | ||
"deploy:shared:local:symlink" | ||
|
||
after "deploy:symlink", | ||
"deploy:bundle:install" | ||
|
||
namespace :deploy do | ||
task :start do ; end | ||
task :stop do ; end | ||
task :restart, :roles => :app, :except => { :no_release => true } do | ||
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | ||
end | ||
|
||
namespace :bundle do | ||
task :install do | ||
run %{cd #{current_path} && bundle install --path #{shared_path}/bundle --deployment --without development test && ln -sf #{shared_path}/bundle #{current_path}/vendor/} | ||
end | ||
end | ||
end |
107 changes: 107 additions & 0 deletions
107
vendor/plugins/brightbox-deployment/recipes/shared_assets.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Brightbox - Easy Ruby Web Application Deployment | ||
# Copyright (C) 2008, Neil Wilson, Brightbox Systems | ||
# | ||
# This file is part of the Brightbox deployment system | ||
# | ||
# Brightbox gem is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU Affero General Public License as published | ||
# by the Free Software Foundation, either version 3 of the License, | ||
# or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General | ||
# Public License along with this program. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
# | ||
# Manage the shared areas | ||
|
||
namespace :deploy do | ||
namespace :shared do | ||
|
||
def fetch_shared_dirs(shared_files, shared_dirs, shared_path) | ||
dirs = shared_files.to_a.collect do |file| | ||
File.join(shared_path, File.dirname(file)) | ||
end | ||
dirs += shared_dirs.to_a.collect do |dir| | ||
File.join(shared_path, dir) | ||
end | ||
end | ||
|
||
def setup_shared_dirs(shared_files, shared_dirs, shared_path) | ||
dirs = fetch_shared_dirs(shared_files, shared_dirs, shared_path) | ||
dir_list = dirs.join(' ') | ||
run "#{try_sudo} mkdir -p #{dir_list} && #{try_sudo} chmod g+w #{dir_list}" unless dirs.empty? | ||
end | ||
|
||
def create_shared_links(shared_files, shared_dirs, shared_path) | ||
resources = shared_dirs.to_a+shared_files.to_a | ||
run %Q{ | ||
cd #{latest_release} && | ||
rm -rf #{resources.join(' ')} | ||
} | ||
links = resources.collect do |resource| | ||
"ln -sf #{File.join(shared_path,resource)} #{File.join(latest_release, resource)}" | ||
end.join(" && ") | ||
run links unless links.empty? | ||
end | ||
|
||
namespace :local do | ||
|
||
desc %Q( | ||
[internal] Creates shared directories. This is called by the setup | ||
routine to create the directory structure within the shared area | ||
referenced by :shared_path. It references two arrays. | ||
:local_shared_files - the list of files that should be shared | ||
between releases. | ||
:local_shared_dirs - the list of directories that should be | ||
shared between releases. | ||
) | ||
task :setup, :except => {:no_release => true} do | ||
setup_shared_dirs(local_shared_files, local_shared_dirs, shared_path) | ||
end | ||
|
||
desc %Q{ | ||
[internal] Sets up the symlinks between the latest release and all | ||
the shared items described in :local_shared_dirs and | ||
:local_shared_files | ||
} | ||
task :symlink, :except => {:no_release => true} do | ||
create_shared_links(local_shared_files, local_shared_dirs, shared_path) | ||
end | ||
end | ||
|
||
namespace :global do | ||
|
||
desc %Q( | ||
[internal] Creates shared directories in the global area referenced | ||
by :global_shared_path. This is called by the setup routine to | ||
create the directory structure within the shared area. It references | ||
two arrays. | ||
:global_shared_files - the list of files that should be shared | ||
between all releases on all servers. | ||
:global_shared_dirs - the list of directories that should be | ||
shared between all releases on all servers. | ||
) | ||
task :setup, :except => {:no_release => true} do | ||
setup_shared_dirs(global_shared_files, global_shared_dirs, global_shared_path) | ||
end | ||
|
||
desc %Q{ | ||
[internal] Sets up the symlinks between the latest release and all | ||
the shared items described in :global_shared_dirs and | ||
:global_shared_files | ||
} | ||
task :symlink, :except => {:no_release => true} do | ||
create_shared_links(global_shared_files, global_shared_dirs, global_shared_path) | ||
end | ||
|
||
|
||
end | ||
end | ||
end |