Skip to content

Instantly share code, notes, and snippets.

@nmische
Created July 6, 2012 13:31
Show Gist options
  • Save nmische/3060161 to your computer and use it in GitHub Desktop.
Save nmische/3060161 to your computer and use it in GitHub Desktop.
Mura Chef Cookbook Recipe
#
# Cookbook Name:: mura
# Recipe:: default
#
# Copyright 2012, Nathan Mische
#
# 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.
#
# Install Nokogiri prereqs immediately so chef_gem can install mechanize
nokogiri_prereqs = ["build-essential","libxslt-dev","libxml2-dev"]
nokogiri_prereqs.each do |pkg|
p = package "#{pkg}" do
action :nothing
end
p.run_action(:install)
end
chef_gem "mechanize" do
action :install
end
# Set up SSH wrapper
directory "#{Chef::Config['file_cache_path']}/.ssh" do
owner "vagrant"
mode "0700"
action :create
end
cookbook_file "#{Chef::Config['file_cache_path']}/.ssh/id_deploy" do
source "id_deploy"
owner "vagrant"
mode 0700
end
directory "#{Chef::Config['file_cache_path']}/.ssh" do
owner "vagrant"
recursive true
end
template "#{Chef::Config['file_cache_path']}/wrap-ssh4git.sh" do
source "wrap-ssh4git.sh.erb"
owner "vagrant"
mode 0700
end
# Checkout mura to webroot
git "#{node['cf902']['webroot']}" do
repository "git://github.com/blueriver/MuraCMS.git"
revision "master"
action :sync
ssh_wrapper "#{Chef::Config['file_cache_path']}/wrap-ssh4git.sh"
end
ruby_block "run_the_mura_installer" do
block do
require 'mechanize'
agent = Mechanize.new do |a|
a.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
agent.get("https://#{node['ipaddress']}/") do |setup_page|
# Submit the setup form
confirm_page = setup_page.form_with(:id => "frm") do |f|
f["production_dbtype"] = "mssql"
f["auto_create"] = "No"
f["production_datasource"] = "xxxx"
f["production_dbusername"] = "yyyy"
f["production_dbpassword"] = "zzzz"
f["production_adminemail"] = "[email protected]"
end.click_button
end
end
action :create
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment