Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app02
Browse files Browse the repository at this point in the history
dwradcliffe committed Feb 10, 2014
1 parent da1332f commit a149058
Showing 21 changed files with 352 additions and 251 deletions.
4 changes: 2 additions & 2 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ site :opscode

cookbook "application", "2.0.0"
cookbook "application_ruby", "1.0.10"
cookbook "apt", "1.9.0"
cookbook "apt", "~> 2.0"
cookbook "aws"
cookbook "bash-completion"
cookbook "build-essential"
@@ -25,7 +25,7 @@ cookbook "memcached", "1.2.0"
cookbook "monit", "1.1.0", git: "https://github.com/phlipper/chef-monit", ref: "e7fbb501346c0b6ea6af8a743648c21610c32796"
cookbook "munin"
cookbook "newrelic-sysmond", "~> 1.3.0"
cookbook "nginx", "0.4.3", git: "https://github.com/phlipper/chef-nginx", ref: "161a4eeabae2e2d18b6789a9723cf6ffb29ce79c"
cookbook "nginx", "~> 2.2"
cookbook "nodejs", git: "https://github.com/phlipper/chef-nodejs"
cookbook "ntp", "1.3.2"
cookbook "openssh", "1.1.4"
16 changes: 10 additions & 6 deletions Berksfile.lock
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
"locked_version": "1.0.10"
},
"apt": {
"locked_version": "1.9.0"
"locked_version": "2.2.1"
},
"aws": {
"locked_version": "1.0.0"
@@ -84,9 +84,7 @@
"locked_version": "1.3.3"
},
"nginx": {
"locked_version": "0.4.3",
"git": "https://github.com/phlipper/chef-nginx",
"ref": "161a4eeabae2e2d18b6789a9723cf6ffb29ce79c"
"locked_version": "2.2.0"
},
"nodejs": {
"locked_version": "1.7.0",
@@ -119,9 +117,9 @@
"ref": "9afb4e5da2e6212504a12de3bbbd410cd96100f6"
},
"redis": {
"locked_version": "0.5.2",
"locked_version": "0.5.4",
"git": "https://github.com/phlipper/chef-redis",
"ref": "926db40eefd00654aaf1b4b0e2522b413042720d"
"ref": "817f1e6368df92ad632da05f066be8113f53fe89"
},
"resolver": {
"locked_version": "1.1.4"
@@ -196,6 +194,12 @@
},
"hostsfile": {
"locked_version": "2.4.2"
},
"bluepill": {
"locked_version": "2.3.0"
},
"ohai": {
"locked_version": "1.1.12"
}
}
}
12 changes: 2 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ Vagrant.configure('2') do |config|

config.berkshelf.enabled = true

config.omnibus.chef_version = '11.4.4'
config.omnibus.chef_version = '11.8.2'

config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--memory', '768']
@@ -28,17 +28,9 @@ Vagrant.configure('2') do |config|
"name" => "rubygems",
"repository" => "https://github.com/rubygems/rubygems.org.git",
"rails_env" => "staging",
"rails_root" => "/applications/rubygems/staging",
"server_names" => ["vagrant.rubygems.org"],
"use_ssl" => true,
"force_ssl" => true,
"rails_postgresql_host" => "localhost",
"ssl_key" => "dev.rubygems.org.key",
"ssl_cert" => "dev.rubygems.org.crt",
"app_server" => {
"name" => "thin",
"concurrency" => 4
}
"ssl_cert" => "dev.rubygems.org.crt"
},
"environment_variables" => {
"RAILS_ENV" => "staging",
24 changes: 14 additions & 10 deletions chef/data_bags/users/deploy.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"id" : "deploy",
"username": "deploy",
"comment": "Application Deployment",
"password": "$1$OghAZXA4$agFSQnk5/bJVs8rA8SaSh1",
"ssh_keys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBXB0EwpWiZWrshvzFmTKs/L6FjMuJ9WnSfoeBDoCuZjgOnEeq2E8948s2q1BE2VU9VwlCVOPrpv4Nf3qzXG52k6LUHkgq1DIpKjXJenmz95HxfqHAlNIWXSX90ywPiJZr42CM+SFxtmITj81rpn9o8YxUCnxqD4Zww/2tkDI3vCzIad8EDZ6FKV4J8psV1rCVHcGCzm5T5xdNXSCcg7tc2XvDvdj7aJ+cCulCbBkMGTNoytF8nIfzI5xfVLjm3TIPfGDlF+NXC8oEiENJq5WdRuPEPaNF2ks2MJlhDE2oY33dN0YU6e2Saeo9L2fRpZUrpR9zLejEFw6O+ePC8Ont temp@rubygems.phlippers.net",
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuZUm6qBJDRKWzrZGx3hiWlVUtmyWvlQGbmI/GyMGqTzzABIb3n8RjpCEBwiBu01wu6ECfyPJ2qGW87G+DVpb1Z5orxQWRPruEg3aw5lXxiHA6dAmd6qWVZKBbQYhXheeepD7QrNwWc/MpVzjqeNitLD0TEI56AJTjL5dIFZHYh5ZHYPYoSVIvH53aub3+vGbzaD/eQamYxuBvecb5A2uHwld//KVA77mKFK68gX92ESd77fpcjwY6cEKQpoobBD4mHpXYfxn8+1OoOkuNo0awkhec9hXQJHRpcIHko+BOGac0d1ZECZIPhAwu7U9KpOCutmJ+YhY1He+++OMXydjxQ== sam.kottler@mbp"
]
}
{
"id" : "deploy",
"username": "deploy",
"comment": "Application Deployment",
"password": "$1$OghAZXA4$agFSQnk5/bJVs8rA8SaSh1",
"ssh_keys": [
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuZUm6qBJDRKWzrZGx3hiWlVUtmyWvlQGbmI/GyMGqTzzABIb3n8RjpCEBwiBu01wu6ECfyPJ2qGW87G+DVpb1Z5orxQWRPruEg3aw5lXxiHA6dAmd6qWVZKBbQYhXheeepD7QrNwWc/MpVzjqeNitLD0TEI56AJTjL5dIFZHYh5ZHYPYoSVIvH53aub3+vGbzaD/eQamYxuBvecb5A2uHwld//KVA77mKFK68gX92ESd77fpcjwY6cEKQpoobBD4mHpXYfxn8+1OoOkuNo0awkhec9hXQJHRpcIHko+BOGac0d1ZECZIPhAwu7U9KpOCutmJ+YhY1He+++OMXydjxQ== samkottler",
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTMHSrFTZyMCs67A92dLIYdFcU6EvMRadH0yk9k1lcEPwqf6NMaYS0Fjqqo7gN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pQJLnmtUTcJbcVhoUwhxibGGlw9mxG5iafQ9Knf1428Q4Et6gKYvO0FgzWnp5WybHogVLIaw== vertis"
]
}
4 changes: 2 additions & 2 deletions chef/nodes/app01.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// run list
"run_list": ["role[app]"],
"run_list": ["role[redis]"],

// rubygems Rails application attributes
"application": {
"name": "rubygems",
42 changes: 42 additions & 0 deletions chef/nodes/app02.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// run list
"run_list": ["role[app]"],

// rubygems Rails application attributes
"application": {
"name": "rubygems",
"rails_env": "production",
"rails_postgresql_host": "10.224.39.18"
},

"environment_variables": {
// Rails application settings
"RAILS_ENV": "production",
"RACK_ENV": "production",
"REDIS_URL": "redis://10.249.31.114:6379/0",
"REDISTOGO_URL": "redis://10.249.31.114:6379/0",

// OpenSSH server timeout
"TMOUT": "600"

// Ruby GC tuning
// "RUBY_HEAP_MIN_SLOTS": 1000000,
// "RUBY_HEAP_SLOTS_INCREMENT": 1000000,
// "RUBY_HEAP_SLOTS_GROWTH_FACTOR": 1,
// "RUBY_GC_MALLOC_LIMIT": 1000000000,
// "RUBY_HEAP_FREE_MIN": 500000,
// "RUBY_FREE_MIN": 500000
},

// Hostname
"set_fqdn": "app02-aws.rubygems.org",

// postgresql
"postgresql": {
"version": "9.2",
"ssl": false,
"pg_hba": [
"host rubygems_production rubygems 127.0.0.1/32 password"
]
}
}
58 changes: 26 additions & 32 deletions chef/roles/app.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
name "app"
description "Just enough sauce to run the app server."
run_list(
"role[base]",
"recipe[memcached]",
"recipe[redis::server]",
"recipe[rubygems::stat-update]",
"recipe[git]",
"recipe[nginx::server]",
"recipe[nodejs]",
"recipe[postgresql::libpq]",
"recipe[rubygems::environment_variables]",
"recipe[rubygems::monit]",
"recipe[rubygems::rails]",
"recipe[rubygems::rails_nginx]"
)

default_attributes(
"memcached" => {
"memory" => 128,
"user" => "memcache",
"port" => 11211,
"listen" => "127.0.0.1"
},
"monit" => {
"monitors" => ["redis", "nginx", "memcached"]
},
"redis" => {
"maxmemory" => "8gb",
"dir" => "/var/lib/redis_data"
}
)
name "app"
description "Just enough sauce to run the app server."
run_list(
"role[base]",
"recipe[memcached]",
"recipe[rubygems::stat-update]",
"recipe[git]",
"recipe[nodejs]",
"recipe[postgresql::libpq]",
"recipe[rubygems::environment_variables]",
"recipe[rubygems::monit]",
"recipe[rubygems::rails]",
"recipe[rubygems::rails_nginx]"
)

default_attributes(
"memcached" => {
"memory" => 128,
"user" => "memcache",
"port" => 11211,
"listen" => "127.0.0.1"
},
"monit" => {
"monitors" => ["nginx", "memcached"]
}
)
17 changes: 17 additions & 0 deletions chef/roles/redis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name "redis"

run_list(
"role[base]",
# "recipe[redis::server]"
)

default_attributes(
"monit" => {
"monitors" => ["redis"]
},
"redis" => {
"bind" => "",
"maxmemory" => "8gb",
"dir" => "/var/lib/redis_data"
}
)
4 changes: 0 additions & 4 deletions chef/site-cookbooks/rubygems/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -2,7 +2,3 @@
default["application"]["application_port"] = 3000
default["application"]["internal_port"] = 2000
default["application"]["application_servers"] = []

# nginx
default["nginx"]["version"] = "1.5.1"
default["nginx"]["iteration"] = "1"
25 changes: 10 additions & 15 deletions chef/site-cookbooks/rubygems/recipes/nginx_source.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
#
# Cookbook Name:: nginx
# Recipe:: nginx_source.rb
# Recipe:: nginx_source
#

node.set['nginx']['version'] = '1.5.8'
node.set['nginx']['iteration'] = '1'

include_recipe 'nginx::ohai_plugin'

package_name = "nginx_#{node['nginx']['version']}-#{node['nginx']['iteration']}_amd64.deb"

cookbook_file "#{Chef::Config[:file_cache_path]}/#{package_name}"

dpkg_package "#{Chef::Config[:file_cache_path]}/#{package_name}"

# Continue to use upstream cookbooks
# for basic configuration and service management

template "/etc/init.d/nginx" do
source "nginx.init.erb"
owner "root"
group "root"
mode 00755
variables(:src_binary => "/opt/nginx/sbin/nginx", :pid => node['nginx']['pid_file'])
service 'nginx' do
supports :status => true, :restart => true, :reload => true
action :enable
end

directory "/opt/nginx/conf/conf.d"
directory "/var/log/nginx"

include_recipe "nginx::service"
include_recipe "nginx::configuration"
include_recipe 'nginx::commons'
Loading

0 comments on commit a149058

Please sign in to comment.