Permalink
Browse files

updated to couchdb book and update to vagrant file

  • Loading branch information...
1 parent 6715382 commit 3af9df9004e278961aab8bf411ae587ab7b8a2b8 @JakubOboza committed Oct 6, 2011
View
@@ -37,20 +37,25 @@ Vagrant::Config.run do |config|
chef.add_recipe "git"
chef.add_recipe "boost"
chef.add_recipe "apache2"
- chef.add_recipe "bluepill"
+ #chef.add_recipe "bluepill"
chef.add_recipe "openssl"
#chef.add_recipe "mongodb"
- #chef.add_recipe "rvm"
- #chef.add_recipe "rvm::default"
- #chef.add_recipe "rvm::install"
- #chef.add_recipe "couchdb"
+ chef.add_recipe "rvm::install"
+ chef.add_recipe "couchdb::source"
chef.add_recipe "our_gems"
+ chef.add_recipe "redis"
+ chef.log_level = :debug
chef.json.merge!({
:rvm => {
:ruby => { :implementation => "ruby", :version => "1.9.2" }
},
+ :couch_db => {
+ :src_version => "1.1.0",
+ :src_mirror => "http://mirror.rmg.io/apache//couchdb/1.1.0/apache-couchdb-1.1.0.tar.gz",
+ :src_checksum => "7cb6a12f3becaae4eeb8ee75b15fbe6395fa7a98"
+ },
})
end
@@ -0,0 +1,55 @@
+{
+ "name": "couchdb",
+ "description": "Installs CouchDB package and starts service",
+ "long_description": "Installs the CouchDB package if it is available from an package repository on\nthe node. If the package repository is not available, CouchDB needs to be \ninstalled via some other method, either a backported package, or compiled \ndirectly from source. CouchDB is available on Red Hat-based systems through\nthe EPEL Yum Repository.\n",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ "ubuntu": [
+ ">= 8.10"
+ ],
+ "debian": [
+ ">= 5.0"
+ ],
+ "openbsd": [
+
+ ],
+ "freebsd": [
+
+ ],
+ "rhel": [
+
+ ],
+ "centos": [
+
+ ],
+ "fedora": [
+
+ ]
+ },
+ "dependencies": {
+ "erlang": [
+
+ ]
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "couchdb": "Installs and configures CouchDB package",
+ "couchdb::source": "Installs and configures CouchDB from source"
+ },
+ "version": "0.14.0"
+}
@@ -47,7 +47,7 @@
end
if node['platform_version'].to_f >= 10.04
- compile_flags = "--with-js-lib=/usr/lib/xulrunner-devel-1.9.2.8/lib --with-js-include=/usr/lib/xulrunner-devel-1.9.2.8/include"
+ compile_flags = "--with-js-lib=/usr/lib/xulrunner-devel-1.9.2.23/lib --with-js-include=/usr/lib/xulrunner-devel-1.9.2.23/include"
end
end
View
@@ -0,0 +1,36 @@
+Description
+===========
+Manages installation of erlang packages. For Debian/Ubuntu this means the distro version of 'erlang'. For RHEL/CentOS this means following the recommendation of RabbitMQ.com and adds an updated version of erlang and access to the EPEL Yum repository.
+
+http://www.rabbitmq.com/server.html
+
+Requirements
+============
+Platform
+--------
+Tested with Ubuntu 10.04 and CentOS 5.6.
+
+Recipes
+=======
+default
+-------
+Manages installation of erlang packages.
+
+License and Author
+==================
+
+Author: Matt Ray (<matt@opscode.com>)
+
+Copyright 2011, Opscode, 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.
View
@@ -2,10 +2,11 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs erlang, optionally install GUI tools."
-version "0.8.2"
+version "0.9.0"
+depends "yum", ">= 0.5.0"
recipe "erlang", "Installs erlang"
-%w{ ubuntu debian }.each do |os|
+%w{ ubuntu debian redhat centos scientific }.each do |os|
supports os
end
@@ -1,8 +1,10 @@
# Cookbook Name:: erlang
# Recipe:: default
# Author:: Joe Williams <joe@joetify.com>
+# Author:: Matt Ray <matt@opscode.com>
#
# Copyright 2008-2009, Joe Williams
+# Copyright 2011, Opscode Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,6 +24,14 @@
erlpkg = node[:erlang][:gui_tools] ? "erlang" : "erlang-nox"
package erlpkg
package "erlang-dev"
+when "redhat", "centos", "scientific"
+ include_recipe "yum::epel"
+ yum_repository "erlang" do
+ name "EPELErlangrepo"
+ url "http://repos.fedorapeople.org/repos/peter/erlang/epel-5Server/#{node['kernel']['machine']}"
+ action :add
+ end
+ package "erlang"
else
package "erlang"
end
@@ -0,0 +1,10 @@
+default[:redis][:dir] = "/etc/redis"
+default[:redis][:data_dir] = "/var/lib/redis"
+default[:redis][:log_dir] = "/var/log/redis"
+# one of: debug, verbose, notice, warning
+default[:redis][:loglevel] = "notice"
+default[:redis][:user] = "redis"
+default[:redis][:port] = 6379
+default[:redis][:bind] = "127.0.0.1"
+default[:redis][:dbfilename] = "dump.rdb"
+default[:redis][:src_link] = "https://github.com/antirez/redis/tarball/2.4"
@@ -0,0 +1,70 @@
+package "build-essential" do
+ action :install
+end
+
+user node[:redis][:user] do
+ action :create
+ system true
+ shell "/bin/false"
+end
+
+directory node[:redis][:dir] do
+ owner "root"
+ mode "0755"
+ action :create
+end
+
+directory node[:redis][:data_dir] do
+ owner "redis"
+ mode "0755"
+ action :create
+end
+
+directory node[:redis][:log_dir] do
+ mode 0755
+ owner node[:redis][:user]
+ action :create
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/redis.tar.gz" do
+ source node[:redis][:src_link]
+ action :create_if_missing
+end
+
+bash "compile_redis_source" do
+ cwd Chef::Config[:file_cache_path]
+ code <<-EOH
+ tar zxf redis.tar.gz
+ cd antirez-redis-*
+ make && make install
+ EOH
+ creates "/usr/local/bin/redis-server"
+end
+
+service "redis" do
+ provider Chef::Provider::Service::Upstart
+ subscribes :restart, resources(:bash => "compile_redis_source")
+ supports :restart => true, :start => true, :stop => true
+end
+
+template "redis.conf" do
+ path "#{node[:redis][:dir]}/redis.conf"
+ source "redis.conf.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ notifies :restart, resources(:service => "redis")
+end
+
+template "redis.upstart.conf" do
+ path "/etc/init/redis.conf"
+ source "redis.upstart.conf.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ notifies :restart, resources(:service => "redis")
+end
+
+service "redis" do
+ action [:enable, :start]
+end
@@ -0,0 +1,13 @@
+port <%= node[:redis][:port] %>
+bind <%= node[:redis][:bind] %>
+loglevel <%= node[:redis][:loglevel] %>
+dir <%= node[:redis][:data_dir] %>
+
+daemonize no
+logfile stdout
+databases 16
+save 900 1
+save 300 10
+save 60 10000
+rdbcompression yes
+dbfilename <%= node[:redis][:dbfilename] %>
@@ -0,0 +1,13 @@
+#!upstart
+description "Redis Server"
+
+env USER=<%= node[:redis][:user] %>
+
+start on startup
+stop on shutdown
+
+respawn
+
+exec sudo -u $USER sh -c "/usr/local/bin/redis-server \
+ /etc/redis/redis.conf 2>&1 >> \
+ <%= node[:redis][:log_dir] %>/redis.log"
@@ -1,2 +1,2 @@
#!/bin/sh
-exec /usr/local/bin/rvm gem $*
+exec /usr/local/rvm/bin/rvm gem $*
@@ -9,7 +9,7 @@
package "curl"
package "git-core"
include_recipe "build-essential"
-
+
%w(libreadline5-dev zlib1g-dev libssl-dev libxml2-dev libxslt1-dev).each do |pkg|
package pkg
end
@@ -18,10 +18,10 @@
# This is mostly to save inode space
execute "rvm-cleanup" do
user "root"
- command "/usr/local/bin/rvm cleanup sources"
+ command "/usr/local/rvm/bin/rvm cleanup sources"
action :nothing
end
-
+
bash "installing system-wide RVM stable" do
user "root"
code "bash < <( curl -L https://rvm.beginrescueend.com/install/rvm )"
@@ -12,13 +12,13 @@
bash "installing #{ruby_version}" do
user "root"
- code "/usr/local/bin/rvm install #{ruby_version}"
+ code "/usr/local/rvm/bin/rvm install #{ruby_version}"
not_if "rvm list | grep #{ruby_version}"
end
bash "make #{ruby_version} the default ruby" do
user "root"
- code "/usr/local/bin/rvm --default #{ruby_version}"
+ code "/usr/local/rvm/bin/rvm --default #{ruby_version}"
not_if "rvm list | grep '=> #{ruby_version}'"
only_if { node[:rvm][:ruby][:default] }
# notifies :restart, "service[chef-client]"

0 comments on commit 3af9df9

Please sign in to comment.