From 76eb8808289e0d7727079bbc5fe65c676b809830 Mon Sep 17 00:00:00 2001 From: Dominik Sander Date: Thu, 24 Apr 2014 16:47:35 +0200 Subject: [PATCH] Updated to work with the current rails41 branch --- Gemfile | 4 ---- Gemfile.lock | 7 ------- .../huginn_production/files/default/Procfile | 8 ++++---- .../huginn_production/files/default/env.example | 1 + .../huginn_production/files/default/nginx.conf | 11 +++++------ .../huginn_production/recipes/default.rb | 12 +++++++----- 6 files changed, 17 insertions(+), 26 deletions(-) diff --git a/Gemfile b/Gemfile index 3424104d..3fbbdf2e 100644 --- a/Gemfile +++ b/Gemfile @@ -63,7 +63,3 @@ group :development, :test do gem 'webmock', require: false gem 'coveralls', require: false end - -group :production do - gem 'unicorn' -end diff --git a/Gemfile.lock b/Gemfile.lock index 5c1d439a..cf932d43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,7 +142,6 @@ 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) @@ -196,7 +195,6 @@ 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) @@ -285,10 +283,6 @@ 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) @@ -351,7 +345,6 @@ DEPENDENCIES twitter-stream! typhoeus (~> 0.6.3) uglifier (>= 1.0.3) - unicorn webmock weibo_2 (~> 0.1.4) wunderground (~> 1.1.0) diff --git a/deployment/site-cookbooks/huginn_production/files/default/Procfile b/deployment/site-cookbooks/huginn_production/files/default/Procfile index 078c42bc..295bbe44 100644 --- a/deployment/site-cookbooks/huginn_production/files/default/Procfile +++ b/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 diff --git a/deployment/site-cookbooks/huginn_production/files/default/env.example b/deployment/site-cookbooks/huginn_production/files/default/env.example index e17cc2aa..8a4c80b2 100644 --- a/deployment/site-cookbooks/huginn_production/files/default/env.example +++ b/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. RAILS_ENV=production +FORCE_SSL=false # 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. diff --git a/deployment/site-cookbooks/huginn_production/files/default/nginx.conf b/deployment/site-cookbooks/huginn_production/files/default/nginx.conf index 99a3d791..6729ccc0 100644 --- a/deployment/site-cookbooks/huginn_production/files/default/nginx.conf +++ b/deployment/site-cookbooks/huginn_production/files/default/nginx.conf @@ -1,15 +1,18 @@ #worker_process 2; user huginn huginn; -events { +events { worker_connections 1024; accept_mutex on; } http { + types_hash_max_size 2048; + include mime.types; + upstream huginn_server { server unix:/home/huginn/shared/tmp/sockets/unicorn.sock; -} + } server { listen 80; @@ -23,13 +26,9 @@ http { } location @app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_pass http://huginn_server; } } diff --git a/deployment/site-cookbooks/huginn_production/recipes/default.rb b/deployment/site-cookbooks/huginn_production/recipes/default.rb index bab5b774..2287e284 100644 --- a/deployment/site-cookbooks/huginn_production/recipes/default.rb +++ b/deployment/site-cookbooks/huginn_production/recipes/default.rb @@ -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" "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}") end @@ -36,6 +36,7 @@ end deploy "/home/huginn" do repo "https://github.com/cantino/huginn.git" + branch "master" user "huginn" group "huginn" 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/unicorn.rb ./config/unicorn.rb sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/ + echo 'gem "unicorn", :group => :production' >> Gemfile 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 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 start huginn EOH