I am trying to migrate my old Heroku Ruby on Rails application from Bamboo to Cedar stack. I am using Ruby 1.8.7, Rails 2.3.11 and Postgres database.
I do everything as described on https://devcenter.heroku.com/articles/cedar-migration but by application start I get the message in heroku log:
"ERROR: No application configured, nothing to run"
My Procfile:
web: bundle exec puma -C config/puma.rb
config/puma.rb:
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
Gemfile:
source 'http://rubygems.org'
ruby '1.8.7'
gem 'rake', '~> 0.8.3'
gem 'rails', '2.3.11'
gem 'puma'
gem 'pg', '0.14.1'
gem 'rdoc'
Rakefile:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'
Local bundle install works fine. I invoke command like this on the server:
$ heroku buildpack:set https://github.com/heroku/heroku-buildpack-ruby#legacy-ruby-1.8.7
After pushing commit to Heroku and performing successful database migration I am still getting logs:
2015-03-11T19:09:53.619567+00:00 heroku[web.1]: State changed from crashed to starting
2015-03-11T19:09:53.614080+00:00 heroku[web.1]: Process exited with status 1
2015-03-11T19:09:57.902538+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2015-03-11T19:10:00.320289+00:00 app[web.1]: [3] * Version 2.11.1 (ruby 1.8.7-p376), codename: Intrepid Squirrel
2015-03-11T19:10:00.320353+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2015-03-11T19:10:00.320162+00:00 app[web.1]: [3] Puma starting in cluster mode...
2015-03-11T19:10:00.320497+00:00 app[web.1]: [3] * Preloading application
2015-03-11T19:10:00.320396+00:00 app[web.1]: [3] * Environment: production
2015-03-11T19:10:00.320452+00:00 app[web.1]: [3] * Process workers: 2
2015-03-11T19:10:00.320593+00:00 app[web.1]: [3] ERROR: No application configured, nothing to run
2015-03-11T19:10:01.138174+00:00 heroku[web.1]: Process exited with status 1
2015-03-11T19:10:01.145537+00:00 heroku[web.1]: State changed from starting to crashed
Edit 1:
Малъ, thank you for your answer. I performed all of the steps you recommend up to point 8. Then I pushed changes to Heroku. Logs are now like that:
2015-03-14T19:16:17.146877+00:00 heroku[web.1]: Starting process with command `bundle exec rackup -s puma -p ${PORT:-3000} -E ${RACK_ENV:-development}`
2015-03-14T19:16:18.986661+00:00 app[web.1]: NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.986682+00:00 app[web.1]: Gem.source_index called from ./config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
2015-03-14T19:16:18.987408+00:00 app[web.1]: NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.987505+00:00 app[web.1]: NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.987522+00:00 app[web.1]: Gem::SourceIndex#load_gems_in called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
2015-03-14T19:16:18.988403+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.989216+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.989842+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.988482+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:16:18.989863+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:16:18.987432+00:00 app[web.1]: Gem::SourceIndex#refresh! called from ./config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:34.
2015-03-14T19:16:18.989238+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:16:18.990514+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.994219+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:16:18.994225+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:16:18.994227+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:16:18.994229+00:00 app[web.1]: ./config/environment.rb:43: warning: already initialized constant MONTHNAMES
2015-03-14T19:16:19.112792+00:00 app[web.1]: ./config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks': can't activate rack (~> 1.1.0), already activated rack-1.4.5. Make sure all dependencies are added to Gemfile. (RuntimeError)
2015-03-14T19:16:19.112801+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
2015-03-14T19:16:19.112798+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
2015-03-14T19:16:19.112808+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2015-03-14T19:16:19.112799+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
2015-03-14T19:16:19.112806+00:00 app[web.1]: from /app/config.ru:2:in `require'
2015-03-14T19:16:19.112802+00:00 app[web.1]: from ./config/environment.rb:9
2015-03-14T19:16:19.112811+00:00 app[web.1]: from /app/config.ru:0:in `new'
2015-03-14T19:16:19.112810+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2015-03-14T19:16:19.112812+00:00 app[web.1]: from /app/config.ru:0
2015-03-14T19:16:19.112807+00:00 app[web.1]: from /app/config.ru:2
2015-03-14T19:16:19.870706+00:00 heroku[web.1]: Process exited with status 1
2015-03-14T19:16:19.882290+00:00 heroku[web.1]: State changed from starting to crashed
Then I try to updating rack version in Gemfile to 1.1.0, invoked
$ bundle update rack
and uploaded sources once again. Logs:
2015-03-14T19:08:30.722782+00:00 heroku[web.1]: State changed from crashed to starting
2015-03-14T19:08:35.270101+00:00 heroku[web.1]: Starting process with command `bundle exec rackup -s puma -p ${PORT:-3000} -E ${RACK_ENV:-development}`
2015-03-14T19:08:39.383233+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/handler.rb:21:in `get'
2015-03-14T19:08:39.383209+00:00 app[web.1]: /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/handler.rb:21:in `const_get': wrong constant name puma (NameError)
2015-03-14T19:08:39.383245+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/bin/rackup:23
2015-03-14T19:08:39.383236+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/server.rb:159:in `server'
2015-03-14T19:08:39.383239+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/server.rb:83:in `start'
2015-03-14T19:08:39.383242+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/bin/rackup:4
2015-03-14T19:08:39.383238+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.1.6/lib/rack/server.rb:155:in `start'
2015-03-14T19:08:39.383243+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/bin/rackup:23:in `load'
2015-03-14T19:08:40.314387+00:00 heroku[web.1]: State changed from starting to crashed
2015-03-14T19:08:40.299712+00:00 heroku[web.1]: Process exited with status 1
Now I don't know completely how I could deal with that.
Edit 2:
I noticed that the sed command failed and didn't changed vendor/rails/actionpack/lib/action_controller.rb so I've added lacking line to it:
gem 'rack', '~> 1.4.0'
Current logs:
2015-03-14T19:53:59.803670+00:00 heroku[web.1]: State changed from crashed to starting
2015-03-14T19:54:03.524424+00:00 heroku[web.1]: Starting process with command `bundle exec rackup -s puma -p ${PORT:-3000} -E ${RACK_ENV:-development}`
2015-03-14T19:54:05.617313+00:00 app[web.1]: Gem.source_index called from ./config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
2015-03-14T19:54:05.618457+00:00 app[web.1]: NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.621176+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.617253+00:00 app[web.1]: NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.623472+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:54:05.618569+00:00 app[web.1]: NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.620427+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.620459+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:54:05.622667+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:54:05.618490+00:00 app[web.1]: Gem::SourceIndex#refresh! called from ./config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:34.
2015-03-14T19:54:05.621896+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.624954+00:00 app[web.1]: ./config/environment.rb:43: warning: already initialized constant MONTHNAMES
2015-03-14T19:54:05.618605+00:00 app[web.1]: Gem::SourceIndex#load_gems_in called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
2015-03-14T19:54:05.751623+00:00 app[web.1]: ./config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks': can't activate rack (~> 1.1.0), already activated rack-1.4.5. Make sure all dependencies are added to Gemfile. (RuntimeError)
2015-03-14T19:54:05.751649+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
2015-03-14T19:54:05.621928+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:54:05.622636+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:54:05.751727+00:00 app[web.1]: from ./config/environment.rb:9
2015-03-14T19:54:05.751802+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2015-03-14T19:54:05.751707+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
2015-03-14T19:54:05.751687+00:00 app[web.1]: from ./config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
2015-03-14T19:54:05.751841+00:00 app[web.1]: from /app/config.ru:0:in `new'
2015-03-14T19:54:05.751765+00:00 app[web.1]: from /app/config.ru:2
2015-03-14T19:54:05.751746+00:00 app[web.1]: from /app/config.ru:2:in `require'
2015-03-14T19:54:05.751822+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2015-03-14T19:54:05.751859+00:00 app[web.1]: from /app/config.ru:0
2015-03-14T19:54:05.621284+00:00 app[web.1]: Gem::SourceIndex#add_spec called from /app/vendor/ruby-1.8.7/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
2015-03-14T19:54:05.623441+00:00 app[web.1]: NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
2015-03-14T19:54:06.627025+00:00 heroku[web.1]: State changed from starting to crashed
2015-03-14T19:54:06.613881+00:00 heroku[web.1]: Process exited with status 1
Edit 3:
I forgot to delete the line with rack 1.1.0 version in vendor/rails/actionpack/lib/action_controller.rb. Now application is up and works like a charm. Малъ, you are my salvator! Big thanks.
I've done some steps to run my Rails 2.3
app on heroku cedar-10
stack. Unfortunately it will be also removed soon, in such way the heroku support answered. So:
Upgrade or downgrade rubygems
to 1.4.2
, it is required to run rake
freeze:
$ gem update --system 1.4.2
Add rake
into Gemfile. and bundle setup.
According the manual, you have to at first freeze Rails
gems into /vendor folder:
$ rake rails:freeze:gems
Modify file: vendor/rails/actionpack/lib/action_controller.rb to support rack 1.4.0
version:
$ sed "s/gem 'rack', '~> 1.1.0'/gem 'rack', '~> 1.4.0'/" -i vendor/rails/actionpack/lib/action_controller.rb
Add rack 1.4.0
, and puma 2.3.2
gems to Gemfile, and remove rails
gem from it, then bundle setup again:
gem 'rack', '~> 1.4.0'
gem 'puma', '~> 2.3.2'
NOTE: the config/puma.rb is also not needed anymore.
Change Procfile to run puma
via rackup
:
$ cat Procfile
web: bundle exec rackup -s puma -p ${PORT:-3000} -E ${RACK_ENV:-development}
Add config.ru to run Rails
app from rackup
:
$ cat config.ru
# RAILS_ROOT/config.ru
require "config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
Add the changed and newly added files into git, and push changes to heroku.
Since the heroku uses PostgreSQL
in production by default, create MySQL
db instance, of course if you plan to use it, accoriding the manual:
$ heroku addons:add cleardb:ignite
-----> Adding cleardb to sharp-mountain-4005... done, v18 (free)
$ heroku config | grep CLEARDB_DATABASE_URL
CLEARDB_DATABASE_URL => mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true
$ heroku config:set DATABASE_URL='mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true'