Browse Source

Updated to work with the current rails41 branch

Dominik Sander 11 years ago
parent
commit
76eb880828

+ 0 - 4
Gemfile

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

+ 0 - 7
Gemfile.lock

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

+ 4 - 4
deployment/site-cookbooks/huginn_production/files/default/Procfile

@@ -1,4 +1,4 @@
-web: sudo bundle exec unicorn_rails -c config/unicorn.rb
-schedule: sudo bundle exec rails runner bin/schedule.rb
-twitter: sudo bundle exec rails runner bin/twitter_stream.rb
-dj: sudo bundle exec script/delayed_job run
+web: sudo bundle exec unicorn_rails -c config/unicorn.rb -E production
+schedule: sudo RAILS_ENV=production bundle exec rails runner bin/schedule.rb
+twitter: sudo RAILS_ENV=production bundle exec rails runner bin/twitter_stream.rb
+dj: sudo RAILS_ENV=production bundle exec script/delayed_job run

+ 1 - 0
deployment/site-cookbooks/huginn_production/files/default/env.example

@@ -23,6 +23,7 @@ DATABASE_PASSWORD=password
 
 
 # Configure Rails environment.  This should only be needed in production and may cause errors in development.
 # Configure Rails environment.  This should only be needed in production and may cause errors in development.
 RAILS_ENV=production
 RAILS_ENV=production
+FORCE_SSL=false
 
 
 # Outgoing email settings.  To use Gmail or Google Apps, put your Google Apps domain or gmail.com
 # Outgoing email settings.  To use Gmail or Google Apps, put your Google Apps domain or gmail.com
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.

+ 5 - 6
deployment/site-cookbooks/huginn_production/files/default/nginx.conf

@@ -1,15 +1,18 @@
 #worker_process 2;
 #worker_process 2;
 user huginn huginn;
 user huginn huginn;
 
 
-events { 
+events {
   worker_connections 1024;
   worker_connections 1024;
   accept_mutex on;
   accept_mutex on;
 }
 }
 
 
 http {
 http {
+  types_hash_max_size 2048;
+  include    mime.types;
+
   upstream huginn_server {
   upstream huginn_server {
     server unix:/home/huginn/shared/tmp/sockets/unicorn.sock;
     server unix:/home/huginn/shared/tmp/sockets/unicorn.sock;
-}
+  }
 
 
   server {
   server {
     listen 80;
     listen 80;
@@ -23,13 +26,9 @@ http {
     }
     }
     location @app {
     location @app {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Forwarded-Proto $scheme;
-
       proxy_set_header Host $http_host;
       proxy_set_header Host $http_host;
-
       proxy_redirect off;
       proxy_redirect off;
-
       proxy_pass http://huginn_server;
       proxy_pass http://huginn_server;
     }
     }
 }
 }

+ 7 - 5
deployment/site-cookbooks/huginn_production/recipes/default.rb

@@ -14,7 +14,7 @@ group "huginn" do
   members ["huginn"]
   members ["huginn"]
 end
 end
 
 
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev", "libssl-dev").each do |pkg|
+%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg|
   package("#{pkg}")
   package("#{pkg}")
 end
 end
 
 
@@ -36,6 +36,7 @@ end
 
 
 deploy "/home/huginn" do
 deploy "/home/huginn" do
   repo "https://github.com/cantino/huginn.git"
   repo "https://github.com/cantino/huginn.git"
+  branch "master"
   user "huginn"
   user "huginn"
   group "huginn"
   group "huginn"
   environment "RAILS_ENV" => "production"
   environment "RAILS_ENV" => "production"
@@ -81,12 +82,13 @@ deploy "/home/huginn" do
       ln -nfs /home/huginn/shared/config/.env ./.env
       ln -nfs /home/huginn/shared/config/.env ./.env
       ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb
       ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb
       sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
       sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
+      echo 'gem "unicorn", :group => :production' >> Gemfile
       sudo bundle install --without=development --without=test
       sudo bundle install --without=development --without=test
       sed -i s/REPLACE_ME_NOW\!/$(sudo bundle exec rake secret)/ .env
       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 RAILS_ENV=production bundle exec rake db:create
+      sudo RAILS_ENV=production bundle exec rake db:migrate
+      sudo RAILS_ENV=production bundle exec rake db:seed
+      sudo RAILS_ENV=production bundle exec rake assets:precompile
       sudo foreman export upstart /etc/init -a huginn -u huginn -l log
       sudo foreman export upstart /etc/init -a huginn -u huginn -l log
       sudo start huginn
       sudo start huginn
       EOH
       EOH