- From: Tim Uckun <
>
- To:
- Subject: [chef] Re: Best practice to maintain chef-repo for a single node that hosts multiple rails app.
- Date: Mon, 16 Jan 2012 09:25:06 +1300
You can try the applications cookbook and see if that works for you. I
wasn't quite right for me so I whipped up something quick and dirty
myself for my rails apps. You can modify it for your own needs.
Everything is driven by the databag.
search(:apps, 'tags:app_group') do |app|
app_path = "/home/app_group/#{app['name']}/#{app['environment']}"
app['path'] = app_path
%w(bundle cached-copy config log pids system).each do |dir|
directory "#{app_path}/shared/#{dir}" do
owner app['user']
group app['group']
mode "0755"
action :create
recursive true
end
end
template "#{app_path}/shared/config/database.yml" do
source "database.yml.erb"
owner app['user']
group app['group']
mode "0755"
variables(:databases => app['databases'].to_hash)
end
deploy app_path do
repo app['repository']
revision app['revision']
user app['user']
enable_submodules true
migrate false
migration_command "bundle exec rake db:migrate"
environment app['environment']
shallow_clone true
symlink_before_migrate "config/database.yml" => "config/database.yml"
purge_before_symlink %w{log tmp/pids public/system config/database.yml}
create_dirs_before_symlink %w{tmp public config}
action :deploy # or :rollback
restart_command "touch tmp/restart.txt"
scm_provider Chef::Provider::Git # is the default, for svn:
Chef::Provider::Subversion
end
web_app app['id'] do
docroot "#{app_path}/current/public"
template "apache_virtualhost.erb"
server_name app['apache']['server_name']
server_aliases app['apache']['server_aliases'] || []
log_dir node[:apache][:log_dir]
rails_env app['environment']
end
end
On Sat, Jan 14, 2012 at 2:01 AM, millisami r
<
>
wrote:
>
Hi, I went through the Quick Start guide for radiant rails app deployment at
>
and I did installed it correctly.
>
>
The files
>
at data_bags/apps/radiant.json, roles/radiant.rb and cookbooks/radiantall
>
uses radiant as a base app name.
>
>
Now I am trying to create another radiant app (say: another_radiant). Here I
>
am confused how to go ahead if I have to host another 3rd radiant app. This
>
seems perfectly to go the Data Driven App Deploys way.
>
>
Looking inside the above rails stack, its name is radiant as cookbook,
>
databags and roles as well.
>
>
So, for the new radiant stack app named another_radiant, do I have to copy
>
those allradiant components into another_radiant for all cookbook, databag
>
and roles too?
>
>
Or is there any better way so that it will be flexible to maintain across
>
many servers?
>
>
>
@millisami
>
~Sachin Sagar Rai
>
Ruby on Rails Developer
>
http://tfm.com.np
>
http://nepalonrails.tumblr.com
>
Archive powered by MHonArc 2.6.16.