Created
March 19, 2010 18:03
-
-
Save michaelcarruthers/337978 to your computer and use it in GitHub Desktop.
This file contains 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:: crm.versapay.com | |
# Recipe:: default | |
# | |
# Copyright 2010, VersaPay Corporation | |
# | |
# 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. | |
app_dir = "/var/www/nginx/crm.versapay.com" | |
rpm_gpg = %w[ RPM-GPG-KEY-CentOS-5 RPM-GPG-KEY-EPEL RPM-GPG-KEY-FFEL RPM-GPG-KEY-PGDG RPM-GPG-KEY-spacewalk RPM-GPG-KEY-VP ].each do |key| | |
execute 'rpm_import' do | |
command "cd /etc/pki/rpm-gpg && curl -O http://spacewalk.versapay.com/pub/#{key} && rpm --import /etc/pki/rpm-gpg/#{key}" | |
end | |
end | |
gem_packages = %w[unicorn].each do |pkg| | |
gem_package pkg do | |
action :install | |
options "--no-rdoc --no-ri" | |
end | |
end | |
packages = %w[ mysql mysql-server java-1.6.0-openjdk nginx ruby rubygems ruby-devel ruby-libs git] | |
packages.each do |pkg| | |
package pkg do | |
action :install | |
end | |
end | |
# Create root user's SSH directory. | |
directory '/root/.ssh' do | |
owner 'root' | |
group 'root' | |
mode '0700' | |
action :create | |
not_if do File.exists?('/root/.ssh') end | |
end | |
# Copy SSH key for git clone. | |
remote_file '/root/.ssh/id_rsa' do | |
source 'id_rsa' | |
mode '0600' | |
end | |
directory "#{app_dir}" do | |
action :create | |
mode "0755" | |
recursive true | |
not_if do File.exists?("#{app_dir}") end | |
end | |
deploy "#{app_dir}" do | |
repo "git@versa-vp-git-01.versapay.com:crm.git" | |
branch "master" | |
user 'root' | |
enable_submodules true | |
action :deploy | |
before_migrate do | |
%w{config index log pids sitemaps system}.each do |dir| | |
directory "#{app_dir}/shared/#{dir}" do | |
mode "0755" | |
action :create | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment