Created
April 5, 2012 06:08
-
-
Save miah/2308376 to your computer and use it in GitHub Desktop.
haproxy
This file contains hidden or 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
| # | |
| # Cookbook Name:: haproxy | |
| # Recipe:: source | |
| # | |
| # Copyright 2012, CX Inc. | |
| # | |
| # 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. | |
| # | |
| include_recipe "git" | |
| include_recipe "build-essential" | |
| package "libpcre3-dev" | |
| user node['haproxy']['user'] | |
| group node['haproxy']['group'] | |
| execute "halog_make_install" do | |
| cwd "#{node['haproxy']['src_dir']}/contrib/halog" | |
| command "cp halog /usr/local/bin" | |
| user "root" | |
| only_if do File.exists?("#{node['haproxy']['src_dir']}/contrib/halog/halog") end | |
| action :nothing | |
| end | |
| execute "halog_make" do | |
| cwd "#{node['haproxy']['src_dir']}/contrib/halog" | |
| case node['kernel']['machine'] | |
| when "x86_64" | |
| command "make halog64" | |
| when "i686" | |
| command "make halog" | |
| end | |
| user node['haproxy']['user'] | |
| only_if do File.exists?("#{node['haproxy']['src_dir']}/contrib/halog/Makefile") end | |
| notifies :run, "execute[halog_make_install]", :immediately | |
| action :nothing | |
| end | |
| execute "haproxy_make_install" do | |
| cwd node['haproxy']['src_dir'] | |
| command "make install" | |
| user "root" | |
| only_if do File.exists?("#{node['haproxy']['src_dir']}/Makefile") end | |
| notifies :run, "execute[halog_make]", :immediately | |
| action :nothing | |
| end | |
| execute "haproxy_make" do | |
| cwd node['haproxy']['src_dir'] | |
| command "make TARGET=linux26 USE_LINUX_SPLICE=1 USE_VSYSCALL=1 USE_PCRE=1" | |
| user node['haproxy']['user'] | |
| only_if do File.exists?("#{node['haproxy']['src_dir']}/Makefile") end | |
| notifies :run, "execute[haproxy_make_install]", :immediately | |
| action :nothing | |
| end | |
| execute "haproxy_tar_extract" do | |
| command "tar zxf #{Chef::Config[:file_cache_path]}/haproxy.src.tar.gz -C #{node['haproxy']['src_dir']} --strip-components 1" | |
| user node['haproxy']['user'] | |
| only_if do File.exists?("#{Chef::Config[:file_cache_path]}/haproxy.src.tar.gz") end | |
| notifies :run, "execute[haproxy_make]", :immediately | |
| action :nothing | |
| end | |
| directory "haproxy_src_dir" do | |
| path node['haproxy']['src_dir'] | |
| owner node['haproxy']['user'] | |
| group node['haproxy']['group'] | |
| notifies :run, "execute[haproxy_tar_extract]", :immediately | |
| action :nothing | |
| end | |
| remote_file "haproxy_src_tar" do | |
| path "#{Chef::Config[:file_cache_path]}/haproxy.src.tar.gz" | |
| case node['haproxy']['branch'] | |
| when "stable" then | |
| source node['haproxy']['stable']['url'] | |
| checksum node['haproxy']['stable']['checksum'] | |
| when "devel" then | |
| source node['haproxy']['devel']['url'] | |
| checksum node['haproxy']['devel']['checksum'] | |
| end | |
| owner "root" | |
| group "root" | |
| mode 0644 | |
| notifies :create, "directory[haproxy_src_dir]", :immediately | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment