@@ -100,13 +100,13 @@ group :production do |
||
| 100 | 100 |
gem 'rack' |
| 101 | 101 |
end |
| 102 | 102 |
|
| 103 |
-# This hack needs some explanation. When on Heroku in production, use the pg, unicorn, and rails12factor gems. |
|
| 103 |
+# This hack needs some explanation. When on Heroku, use the pg, unicorn, and rails12factor gems. |
|
| 104 | 104 |
# When not on Heroku, we still want our Gemfile.lock to include these gems, so we scope them to |
| 105 | 105 |
# an unsupported platform. |
| 106 |
-if ENV['ON_HEROKU'] || ENV['HEROKU_POSTGRESQL_ROSE_URL'] |
|
| 107 |
- gem 'pg', group: :production |
|
| 108 |
- gem 'unicorn', group: :production |
|
| 109 |
- gem 'rails_12factor', group: :production |
|
| 106 |
+if ENV['ON_HEROKU'] || ENV['HEROKU_POSTGRESQL_ROSE_URL'] || File.read(File.join(File.dirname(__FILE__), 'Procfile')) =~ /intended for Heroku/ |
|
| 107 |
+ gem 'pg' |
|
| 108 |
+ gem 'unicorn' |
|
| 109 |
+ gem 'rails_12factor' |
|
| 110 | 110 |
else |
| 111 | 111 |
gem 'pg', platform: :ruby_18 |
| 112 | 112 |
gem 'unicorn', platform: :ruby_18 |
@@ -6,8 +6,8 @@ jobs: bundle exec rails runner bin/threaded.rb |
||
| 6 | 6 |
# web: bundle exec unicorn -c config/unicorn/production.rb |
| 7 | 7 |
# jobs: bundle exec rails runner bin/threaded.rb |
| 8 | 8 |
|
| 9 |
-# Old version with seperate processes for each component (use this if you have issues with the threaded version) |
|
| 9 |
+# Old version with separate processes (use this if you have issues with the threaded version) |
|
| 10 | 10 |
# web: bundle exec rails server |
| 11 | 11 |
# schedule: bundle exec rails runner bin/schedule.rb |
| 12 | 12 |
# twitter: bundle exec rails runner bin/twitter_stream.rb |
| 13 |
-# dj: bundle exec script/delayed_job run |
|
| 13 |
+# dj: bundle exec script/delayed_job run |
@@ -45,7 +45,7 @@ def grab_heroku_config! |
||
| 45 | 45 |
end |
| 46 | 46 |
|
| 47 | 47 |
def set_value(key, value, options = {})
|
| 48 |
- unless $config[key] == value |
|
| 48 |
+ if $config[key].nil? || $config[key] == '' || ($config[key] != value && options[:force] != false) |
|
| 49 | 49 |
puts "Setting #{key} to #{value}" unless options[:silent]
|
| 50 | 50 |
puts capture("heroku config:set #{key}=#{value}")
|
| 51 | 51 |
end |
@@ -94,10 +94,10 @@ unless $config['APP_SECRET_TOKEN'] |
||
| 94 | 94 |
end |
| 95 | 95 |
|
| 96 | 96 |
set_value 'BUILDPACK_URL', "https://github.com/ddollar/heroku-buildpack-multi.git" |
| 97 |
-set_value 'PROCFILE_PATH', "deployment/heroku/Procfile.heroku" |
|
| 97 |
+set_value 'PROCFILE_PATH', "deployment/heroku/Procfile.heroku", force: false |
|
| 98 | 98 |
set_value 'ON_HEROKU', "true" |
| 99 | 99 |
set_value 'FORCE_SSL', "true" |
| 100 |
-set_value 'DOMAIN', "#{app_name}.herokuapp.com"
|
|
| 100 |
+set_value 'DOMAIN', "#{app_name}.herokuapp.com", force: false
|
|
| 101 | 101 |
|
| 102 | 102 |
unless $config['INVITATION_CODE'] |
| 103 | 103 |
puts "You need to set an invitation code for your Huginn instance. If you plan to share this instance, you will" |
@@ -1 +1,4 @@ |
||
| 1 |
+# This Procfile is intended for Heroku, and is detected by the Gemfile. DO NOT REMOVE THIS LINE! |
|
| 2 |
+ |
|
| 3 |
+# deployment/heroku/unicorn.rb is a special Unicorn config file that also spawns workers. |
|
| 1 | 4 |
web: bundle exec unicorn -p $PORT -c ./deployment/heroku/unicorn.rb |
@@ -5,7 +5,8 @@ timeout 15 |
||
| 5 | 5 |
preload_app true |
| 6 | 6 |
|
| 7 | 7 |
# Note that this will only work correctly when running Heroku with ONE web worker. |
| 8 |
-# If you want to run more than one, use the standard Huginn Procfile instead with separate web and job entries. |
|
| 8 |
+# If you want to run more than one, use the standard Huginn Procfile instead, with separate web and job entries. |
|
| 9 |
+# You'll need to set the Heroku config variable PROCFILE_PATH to 'Procfile'. |
|
| 9 | 10 |
Thread.new do |
| 10 | 11 |
worker_pid = nil |
| 11 | 12 |
while true |
@@ -14,7 +15,7 @@ Thread.new do |
||
| 14 | 15 |
puts "New threaded worker PID: #{worker_pid}"
|
| 15 | 16 |
end |
| 16 | 17 |
|
| 17 |
- sleep 30 |
|
| 18 |
+ sleep 45 |
|
| 18 | 19 |
|
| 19 | 20 |
if ENV['DOMAIN'] |
| 20 | 21 |
force_ssl = ENV['FORCE_SSL'].present? && ENV['FORCE_SSL'] == 'true' |