Skip to content

Instantly share code, notes, and snippets.

View johnfitzpatrick's full-sized avatar

John Fitzpatrick johnfitzpatrick

  • Kong
  • Belfast, Northern Ireland
View GitHub Profile
@johnfitzpatrick
johnfitzpatrick / cookbooks_apache_recipes_default.rb
Last active August 29, 2015 14:01
Intermediate class cookbooks/apache/recipes/default.rb
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
package "httpd" do
@johnfitzpatrick
johnfitzpatrick / cookbooks_mailx_spec_unit_default_spec.rb
Created July 25, 2014 11:01
cookbooks_mailx_spec_unit_default_spec.rb
require 'spec_helper'
describe 'mailx::default' do
context 'on Debian' do
let(:chef_run) { ChefSpec::Runner.new({:platform => 'ubuntu', :version => '14.04'}).converge(described_recipe) }
it 'should install the correct packages' do
expect(chef_run).to install_package 'mailutils'
end
end
@johnfitzpatrick
johnfitzpatrick / myapache_receipes_default.rb
Created December 10, 2014 10:12
myapache_receipes_default.rb
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
package "httpd" do
node.default['haproxy']['members'] = [{
"hostname" => "localhost",
"ipaddress" => "127.0.0.1",
"port" => node["myapache"]["port"],
"ssl_port" => node["myapache"]["port"]
}]
node.default['haproxy']['admin']['address_bind'] = "0.0.0.0"
node.default['haproxy']['admin']['port'] = 8082
node.default['haproxy']['enable_stats_socket'] = true
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 8
#
# Cookbook Name:: myapache
# Recipe:: default
#
# Copyright (c) 2014 The Authors, All Rights Reserved.
#
package "httpd"
execute "mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.disabled" do
only_if do
@johnfitzpatrick
johnfitzpatrick / vhost.conf.erb
Created December 23, 2014 15:00
vhost.conf.erb
<% if @port != 80 -%>
Listen <%= @port %>
<% end -%>
<VirtualHost *:<%= @port %>>
ServerAdmin webmaster@localhost
DocumentRoot <%= @document_root %>
<Directory />
Options FollowSymLinks
#
# Cookbook Name:: apache
# Recipe:: default
#
# Copyright (c) 2014 The Authors, All Rights Reserved.
#
package "httpd"
service "httpd" do
action [ :enable, :start ]
#
# Cookbook Name:: myapache
# Recipe:: default
#
# Copyright (c) 2014 The Authors, All Rights Reserved.
#
package "httpd"
execute "mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.disabled" do
only_if do
@johnfitzpatrick
johnfitzpatrick / vhost.conf.erb
Last active August 29, 2015 14:12
vhost.conf.erb
<% if @port != 80 -%>
Listen <%= @port %>
<% end -%>
<VirtualHost *:<%= @port %>>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/web01
<Directory />
Options FollowSymLinks