-
Notifications
You must be signed in to change notification settings - Fork 291
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
Thom Mahoney
authored and
Ines Sombra
committed
Jun 13, 2012
1 parent
badf11e
commit ca31d8f
Showing
4 changed files
with
69 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,20 @@ | ||
ey-cloud-recipes/rds | ||
------------------------------------------------------------------------------ | ||
|
||
A chef recipe for enabling remote Active Record databases like Amazon's RDS | ||
|
||
Dependencies | ||
-------------------------- | ||
|
||
Requires a running database instance with firewall access configured for | ||
your Engine Yard environment. | ||
|
||
Contact our support team if you need additional information about your environment. | ||
|
||
Enabling this recipe | ||
--------------------------- | ||
|
||
* Edit main/recipes/default.rb and comment out the line shown below. | ||
``require_recipe "rds"`` | ||
* Alter the rds/attributes/rds.rb file to include your connection | ||
information. |
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 @@ | ||
# place database credentials in this file | ||
# app_name :adapter => '', :database => '', :username => '', :password => '', :host => '' | ||
# for example: | ||
# todo :adapter => 'mysql', :database => 'todoproduction', :username => 'engineyard', :password => 'mypassword', :host => 'todo.dhvg1ytl1sd8.us-east-1.rds.amazonaws.com' |
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,38 @@ | ||
# | ||
# Cookbook Name:: rds | ||
# Recipe:: default | ||
# | ||
# Configure application servers to use an Amazon RDS database (or any external ActiveRecord-compatible database) | ||
# Note: This recipe does not make any changes to Engine Yard-provisioned databases | ||
|
||
if ['solo', 'app_master', 'app', 'util'].include?(node[:instance_role]) | ||
# for each application | ||
node.engineyard.apps.each do |app| | ||
# retrieve attributes | ||
attributes = node[app.name] | ||
|
||
# skip if there are no attributes for this app | ||
next if attributes.nil? | ||
|
||
ey_cloud_report "RDS" do | ||
message "RDS - Replacing database.yml for #{app.name}" | ||
end | ||
|
||
# create new database.yml with attributes | ||
template "/data/#{app.name}/shared/config/database.yml" do | ||
owner node[:owner_name] | ||
group node[:owner_name] | ||
backup false | ||
mode 0644 | ||
source 'database.yml.erb' | ||
variables({ | ||
:environment => node[:environment][:framework_env], | ||
:adapter => attributes[:adapter], | ||
:database => attributes[:database], | ||
:username => attributes[:username], | ||
:password => attributes[:password], | ||
:host => attributes[:host] | ||
}) | ||
end | ||
end | ||
end |
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,7 @@ | ||
<%= @environment %>: | ||
adapter: <%= @adapter %> | ||
database: '<%= @database %>' | ||
username: '<%= @username %>' | ||
password: '<%= @password %>' | ||
host: '<%= @host %>' | ||
reconnect: true |