Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: intercity/chef-repo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: berkes/chef-repo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 97-custom-config-nginx
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 11 commits
  • 23 files changed
  • 4 contributors

Commits on Nov 13, 2014

  1. Copy the full SHA
    fee6a17 View commit details

Commits on Nov 21, 2014

  1. Copy the full SHA
    d416d9c View commit details
  2. Copy the full SHA
    4da8b69 View commit details

Commits on Dec 23, 2014

  1. Moved all the licensing to MIT

    Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
    jvanbaarsen authored and berkes committed Dec 23, 2014
    Copy the full SHA
    05e6907 View commit details
  2. Copy the full SHA
    eadc686 View commit details
  3. Copy the full SHA
    be74db7 View commit details
  4. Copy the full SHA
    b0bfcfc View commit details
  5. Add "name" attributes to metadata.

    This fixes #150.
    berkes committed Dec 23, 2014
    Copy the full SHA
    8834d59 View commit details
  6. Copy the full SHA
    e3831b4 View commit details

Commits on Dec 24, 2014

  1. Copy the full SHA
    a2f5d31 View commit details
  2. Copy the full SHA
    85ac32d View commit details
3 changes: 3 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Style/LineLength:
Description: 'Limit lines to 130 characters.'
Max: 130
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ This project makes use of the [Sementic Versioning](http://semver.org/)

### Misc
- Sudo recipe configuration changed to match Ubuntu's default sudo behaviour more closely.
- Licensing has been moved to MIT

## 2.2.0 - 2014-10-28

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "https://rubygems.org"

gem "rake"
gem "chef", "~> 11.16.2"
gem "knife-solo", "~> 0.4.1"
gem "librarian-chef", "~> 0.0.4"
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -113,6 +113,7 @@ GEM
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.2)
rake (10.3.2)
resource_kit (0.0.5)
activesupport (>= 3.0)
addressable (~> 2.3.6)
@@ -170,6 +171,7 @@ DEPENDENCIES
kitchen-vagrant
knife-solo (~> 0.4.1)
librarian-chef (~> 0.0.4)
rake
rspec
serverspec
test-kitchen
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2014 Firmhouse.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion config/rake.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@

# License for new Cookbooks
# Can be :apachev2 or :none
NEW_COOKBOOK_LICENSE = :apachev2
NEW_COOKBOOK_LICENSE = :none

###
# Useful Extras (which you probably don't need to change)
3 changes: 2 additions & 1 deletion nodes/sample_host.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"ssh-rsa AAA456...uvw== bar"
]
}
}
},
"ssh_deploy_keys": [
"<enter the contents of an id_rsa.pub here>"
],
@@ -37,6 +37,7 @@
"rails_env": "<stage, eg: production>",
"packages": ["nodejs"],
"domain_names": ["<domain name>", "<domain name>", "<...>"],
"redirect_domain_names": ["<domain name>", "<domain name>", "<...>"],
"ruby_version": "2.1.0",
"ssl_info": {
"key": "<ssl key>",
2 changes: 1 addition & 1 deletion vendor/cookbooks/backups/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name "backups"
maintainer "Firmhouse"
maintainer_email "hello@firmhouse.com"
license "Apache 2.0"
license "MIT"
description "Installs/Configures backups"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
29 changes: 17 additions & 12 deletions vendor/cookbooks/backups/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#
# Cookbook Name:: backups
# Recipe:: default
#
# Copyright 2014, Firmhouse
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

backup_node = node[:backups]

3 changes: 2 additions & 1 deletion vendor/cookbooks/packages/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name "packages"
maintainer "Michiel Sikkes"
maintainer_email "michiel@firmhouse.com"
license "Apache 2.0"
license "MIT"
description "Installs/Configures packages"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
31 changes: 18 additions & 13 deletions vendor/cookbooks/packages/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -4,23 +4,28 @@
#
# Copyright 2012, Michiel Sikkes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
if node[:packages]

node[:packages].each do |package|
package package
end

end
end
14 changes: 2 additions & 12 deletions vendor/cookbooks/rails/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
# CHANGELOG for rails

This file is used to list changes made in each version of rails.

## 0.1.0:

* Initial release of rails

- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.

The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
See https://github.com/intercity/chef-repo/blob/master/CHANGELOG.md for full
changelog
20 changes: 20 additions & 0 deletions vendor/cookbooks/rails/libraries/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Rails
module Helpers
##
# Create a default set of custom config
# Assure we always send certain hash keys to the template
def nginx_custom_configuration(app_info)
empty_conf = {
"before" => "",
"server_main" => "",
"server_app" => "",
"server_ssl" => "",
"server_ssl_app" => "",
"upstream" => "",
"after" => "",
}

empty_conf.merge(app_info["nginx_custom"] || {})
end
end
end
5 changes: 3 additions & 2 deletions vendor/cookbooks/rails/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name "rails"
maintainer "Michiel Sikkes"
maintainer_email "michiel@firmhouse.com"
license "Apache 2.0"
license "MIT"
description "Installs/Configures rails"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
depends "sudo", "> 1.2.0"
depends "database"
depends "nginx"
depends "bluepill"
depends "logrotate"
depends "logrotate"
41 changes: 27 additions & 14 deletions vendor/cookbooks/rails/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -4,18 +4,23 @@
#
# Copyright 2012, Michiel Sikkes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

include_recipe "sudo"
include_recipe "nginx"
@@ -26,6 +31,9 @@

if node[:active_applications]

# Include library helpers
::Chef::Resource.send(:include, Rails::Helpers)

node[:active_applications].each do |app, app_info|
rails_env = app_info['rails_env'] || "production"
deploy_user = app_info['deploy_user'] || "deploy"
@@ -105,8 +113,13 @@

template "/etc/nginx/sites-available/#{app}.conf" do
source "app_nginx.conf.erb"
variables :name => app, :domain_names => app_info['domain_names'], :enable_ssl => File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt")
notifies :reload, resources(:service => "nginx")
variables(
name: app,
domain_names: app_info["domain_names"],
redirect_domain_names: app_info["redirect_domain_names"],
enable_ssl: File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt"),
custom_configuration: nginx_custom_configuration(app_info))
notifies :reload, resources(service: "nginx")
end

template "#{applications_root}/#{app}/shared/config/unicorn.rb" do
39 changes: 26 additions & 13 deletions vendor/cookbooks/rails/recipes/passenger.rb
Original file line number Diff line number Diff line change
@@ -4,18 +4,23 @@
#
# Copyright 2012, Michiel Sikkes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

package "apt-transport-https"

@@ -43,6 +48,9 @@

if node[:active_applications]

# Include library helpers
::Chef::Resource.send(:include, Rails::Helpers)

node[:active_applications].each do |app, app_info|
rails_env = app_info['rails_env'] || "production"
deploy_user = app_info['deploy_user'] || "deploy"
@@ -121,7 +129,12 @@

template "/etc/nginx/sites-available/#{app}.conf" do
source "app_passenger_nginx.conf.erb"
variables :name => app, :rails_env => rails_env, :domain_names => app_info['domain_names'], :enable_ssl => File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt")
variables(
name: app,
rails_env: rails_env,
domain_names: app_info["domain_names"],
enable_ssl: File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt"),
custom_configuration: nginx_custom_configuration(app_info))
notifies :reload, resources(:service => "nginx")
end

22 changes: 20 additions & 2 deletions vendor/cookbooks/rails/templates/default/app_nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<%= @custom_configuration["before"] %>

<% if @redirect_domain_names && @redirect_domain_names.any? %>
server {
listen <%= node['nginx']['port'] || '80' %>;
<% if @enable_ssl %>
listen 443 ssl;
<% end %>
server_name <%= @redirect_domain_names.join(' ') %>;
return 301 $scheme://<%= @domain_names.first %>$request_uri;
}
<% end %>

server {
listen <%= node['nginx']['port'] || '80' %>;
server_name <%= @domain_names.join(' ') %>;
@@ -11,8 +24,9 @@ server {
proxy_redirect off;

proxy_pass http://<%= @name %>;
<%= @custom_configuration["server_app"] %>
}

<%= @custom_configuration["server_main"] %>
}

<% if @enable_ssl %>
@@ -38,12 +52,16 @@ server {
proxy_redirect off;

proxy_pass http://<%= @name %>;
<%= @custom_configuration["ssl_app"] %>
}

<%= @custom_configuration["ssl_main"] %>
}

<% end %>

upstream <%= @name %> {
server unix:<%= node['rails']['applications_root'] %>/<%= @name %>/shared/tmp/sockets/unicorn.sock;
<%= @custom_configuration["upstream"] %>
}

<%= @custom_configuration["after"] %>
Loading