Updated chef-solo deployment to work with current versions

This commit is contained in:
Dominik Sander 2014-04-21 18:42:52 +02:00
parent b661bf36da
commit a466688323
10 changed files with 100 additions and 77 deletions

View file

@ -63,3 +63,7 @@ group :development, :test do
gem 'webmock', require: false
gem 'coveralls', require: false
end
group :production do
gem 'unicorn'
end

View file

@ -142,6 +142,7 @@ GEM
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2)
kramdown (1.1.0)
libv8 (3.16.14.3)
macaddr (1.7.1)
@ -195,6 +196,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.13.0)
rake (10.2.2)
rdoc (3.12.2)
json (~> 1.4)
@ -283,6 +285,10 @@ GEM
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicorn (4.8.2)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
uuid (2.3.7)
macaddr (~> 1.0)
warden (1.2.3)
@ -345,6 +351,7 @@ DEPENDENCIES
twitter-stream!
typhoeus (~> 0.6.3)
uglifier (>= 1.0.3)
unicorn
webmock
weibo_2 (~> 0.1.4)
wunderground (~> 1.1.0)

View file

@ -0,0 +1,3 @@
cookbook_path ["cookbooks", "site-cookbooks"]
role_path "roles"
data_bag_path "data_bags"

71
deployment/Cheffile.lock Normal file
View file

@ -0,0 +1,71 @@
SITE
remote: http://community.opscode.com/api/v1
specs:
apt (2.3.8)
bluepill (2.3.1)
rsyslog (>= 0.0.0)
build-essential (2.0.0)
chef_handler (1.1.6)
dmg (2.2.0)
ohai (1.1.12)
rsyslog (1.12.2)
runit (1.5.10)
build-essential (>= 0.0.0)
yum (~> 3.0)
yum-epel (>= 0.0.0)
windows (1.30.2)
chef_handler (>= 0.0.0)
yum (3.2.0)
yum-epel (0.3.6)
yum (~> 3.0)
GIT
remote: git://github.com/mdxp/nodejs-cookbook.git
ref: master
sha: e2415cd8c4e03dccf21d7ef6ca31e1c5c81467ca
specs:
nodejs (1.3.0)
apt (>= 0.0.0)
build-essential (>= 0.0.0)
yum-epel (>= 0.0.0)
GIT
remote: git://github.com/opscode-cookbooks/git.git
ref: master
sha: 76b0f9bb08fdd9e2e201fd70b72298097accdf96
specs:
git (4.0.1)
build-essential (>= 0.0.0)
dmg (>= 0.0.0)
runit (>= 1.0)
windows (>= 0.0.0)
yum (~> 3.0)
yum-epel (>= 0.0.0)
GIT
remote: git://github.com/opscode-cookbooks/mysql.git
ref: master
sha: a2ff53f0ca6deca75aebf6da55ac381194ec7728
specs:
mysql (5.1.9)
GIT
remote: git://github.com/opscode-cookbooks/nginx.git
ref: master
sha: 05b3a613f53a0b05c96f9206c5d67aa420f337fb
specs:
nginx (2.6.3)
apt (~> 2.2)
bluepill (~> 2.3)
build-essential (~> 2.0)
ohai (~> 1.1)
runit (~> 1.2)
yum-epel (~> 0.3)
DEPENDENCIES
git (>= 0)
mysql (>= 0)
nginx (>= 0)
nodejs (>= 0)
runit (>= 0)

View file

@ -10,7 +10,7 @@
"default_attributes" : {
"mysql": {
"server_root_password": "",
"server_root_password": "password",
"server_repl_password": "",
"server_debian_password": ""
},

View file

@ -1,58 +0,0 @@
source 'https://rubygems.org'
gem 'rails'
gem 'rake'
gem 'mysql2'
gem 'devise'
gem 'kaminari'
gem 'bootstrap-kaminari-views'
gem "rufus-scheduler", :require => false
gem 'json', '>= 1.7.7'
gem 'jsonpath'
gem 'twilio-ruby'
gem 'delayed_job', :git => 'https://github.com/wok/delayed_job' # Until the YAML issues are fixed in master.
gem 'delayed_job_active_record', "~> 0.3.3" # newer was giving a strange MySQL error
gem "daemons"
# gem "delayed_job_web"
group :production do
gem 'unicorn'
end
gem 'foreman'
gem 'dotenv-rails', :groups => [:development, :test]
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'select2-rails'
gem 'jquery-rails'
end
gem 'geokit-rails3'
gem 'kramdown'
gem "typhoeus"
gem 'nokogiri'
gem 'wunderground'
gem "twitter"
gem 'twitter-stream', '>=0.1.16'
gem 'em-http-request'
platforms :ruby_18 do
gem 'system_timer'
gem 'fastercsv'
end
group :development do
gem 'pry'
end
group :development, :test do
gem 'rspec-rails'
gem 'rspec'
gem 'shoulda-matchers'
gem 'rr'
gem 'webmock', :require => false
gem 'rake'
end

View file

@ -14,7 +14,7 @@ DATABASE_RECONNECT=true
DATABASE_NAME=huginn_production
DATABASE_POOL=5
DATABASE_USERNAME=root
DATABASE_PASSWORD=
DATABASE_PASSWORD=password
#DATABASE_HOST=your-domain-here.com
#DATABASE_PORT=3306
#DATABASE_SOCKET=/tmp/mysql.sock

View file

@ -17,7 +17,8 @@ stdout_path "log/unicorn_err.log"
pid '/home/huginn/shared/tmp/pids/unicorn.pid'
before_fork do |server, worker|
ActiveRecord::Base.connection.disconnect!
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
old_pid = "#{server.config[:pid]}.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
@ -29,5 +30,6 @@ before_fork do |server, worker|
end
after_fork do |server, worker|
ActiveRecord::Base.establish_connection
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end

View file

@ -14,7 +14,7 @@ group "huginn" do
members ["huginn"]
end
%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8").each do |pkg|
%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev").each do |pkg|
package("#{pkg}")
end
@ -56,7 +56,7 @@ deploy "/home/huginn" do
end
directory("/home/huginn/shared/tmp/pids")
directory("/home/huginn/shared/tmp/sockets")
%w(Procfile unicorn.rb Gemfile nginx.conf).each do |file|
%w(Procfile unicorn.rb nginx.conf).each do |file|
cookbook_file "/home/huginn/shared/config/#{file}" do
owner "huginn"
action :create_if_missing
@ -77,16 +77,16 @@ deploy "/home/huginn" do
code <<-EOH
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
ln -nfs /home/huginn/shared/config/Gemfile ./Gemfile
ln -nfs /home/huginn/shared/config/Procfile ./Procfile
ln -nfs /home/huginn/shared/config/.env ./.env
ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb
sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
sudo bundle install
sed -i s/REPLACE_ME_NOW\!/$(sudo rake secret)/ .env
sudo rake db:create
sudo rake db:migrate
sudo rake db:seed
sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
sudo bundle install --without=development --without=test
sed -i s/REPLACE_ME_NOW\!/$(sudo bundle exec rake secret)/ .env
sed -i s/config\.force_ssl\ \=\ true/config\.force_ssl\ \=\ false/ config/environments/production.rb
sudo bundle exec rake db:create
sudo bundle exec rake db:migrate
sudo bundle exec rake db:seed
sudo foreman export upstart /etc/init -a huginn -u huginn -l log
sudo start huginn
EOH

View file

@ -1,6 +0,0 @@
file_cache_path "/tmp/chef-solo"
data_bag_path "/tmp/chef-solo/data_bags"
encrypted_data_bag_secret "/tmp/chef-solo/data_bag_key"
cookbook_path [ "/tmp/chef-solo/site-cookbooks",
"/tmp/chef-solo/cookbooks" ]
role_path "/tmp/chef-solo/roles"