Skip to content

Commit

Permalink
$tmp_dir is not set on heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Oct 9, 2015
1 parent 815d9e6 commit 16c871d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/puma-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

rackup "#{root}/config.ru"

bind "unix://#{ENV["tmp_dir"]}/nginx.socket"
tmp_dir = ENV.fetch("tmp_dir", "/tmp")
bind "unix://#{tmp_dir}/nginx.socket"
environment ENV['RACK_ENV'] || 'development'

threads 0, 16
5 changes: 3 additions & 2 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
worker_processes Integer(ENV.fetch('WEB_CONCURRENCY')) # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 30 seconds

listen File.expand_path("nginx.socket", ENV["tmp_dir"]), backlog: 1024
tmp_dir = ENV.fetch("tmp_dir", "/tmp")
listen File.expand_path("nginx.socket", tmp_dir), backlog: 1024

require 'fileutils'
before_fork do |server, worker|
# preload travis so we can have copy on write
require 'travis/api/app'

# signal to nginx we're ready
FileUtils.touch("#{ENV["tmp_dir"]}/app-initialized")
FileUtils.touch("#{tmp_dir}/app-initialized")
end

0 comments on commit 16c871d

Please sign in to comment.