Skip to content

Commit

Permalink
Splitting AWS behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
igalarzab committed Mar 21, 2013
1 parent e309f90 commit e20cf4f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
19 changes: 19 additions & 0 deletions cookbooks/tryit-django/recipes/aws.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Cookbook Name:: tryit-django
# Recipe:: Amazon AWS
#
# Cyberfonica Team
#

include_recipe 'aws'

# Get the AWS login data from the databag
aws_data = data_bag_item("aws", "main")

aws_elastic_lb "eip_load_balancer_production" do
only_if { node['roles'].include?("tryit-ec2") }
aws_access_key aws['aws_access_key_id']
aws_secret_access_key aws['aws_secret_access_key']
name "TryIT"
action :register
end
4 changes: 2 additions & 2 deletions cookbooks/tryit-django/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
#

include_recipe 'apt'
include_recipe 'aws'

application "tryit-django" do

path "/srv/tryit-django"
path ""
owner "root"
group "root"
repository "https://github.com/chernando/tryit_django"
Expand Down Expand Up @@ -44,6 +43,7 @@
end

aws_elastic_lb "eip_load_balancer_production" do
only_if { node['roles'].include?("tryit-ec2") }
aws_access_key "KEY"
aws_secret_access_key "SECRET"
name "TryIT"
Expand Down
10 changes: 10 additions & 0 deletions cookbooks/tryit-django/templates/default/settings.py.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#
# Local settings to Django
# =========================
#
# Append gunicorn to the appended apps
# Cyberfonica Team
#
# Node: <% node['fqdn'] %>
#

from settings import INSTALLED_APPS

INSTALLED_APPS += ('gunicorn',)
5 changes: 5 additions & 0 deletions data_bags/aws/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "main",
"aws_access_key_id": "ACCESS_KEY",
"aws_secret_access_key": "SECRET_KEY"
}
3 changes: 2 additions & 1 deletion roles/tryit-ec2.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name "tryit-ec2"
description "Gunicorn servers to run TryIT Blog (in AWS)"
run_list(
"recipe[tryit-django]"
"recipe[tryit-django]",
"recipe[tryit-django:aws]"
)

0 comments on commit e20cf4f

Please sign in to comment.