ruby-on-railsrubyherokualchemy-cms

Heroku not mounting Alchemy CMS for Production Environment


The Alchemy CMS is being mounted inside of my config/routes.rb:

Rails.application.routes.draw do
  get 'about' => 'home#about', :as => 'about'

  resources :users
  match "signup"       => "users#new",   :via => "get", :as => 'signup'
  match "account"      => "users#index", :via => "get", :as => 'account'
  match "account/edit" => 'users#edit',  :via => "get", :as => 'edit_account'

  resources :sessions, :only => [:new, :create, :destroy]
  match "login"  => 'sessions#new',     :via => "get",    :as => 'login'
  match "logout" => 'sessions#destroy', :via => "delete", :as => 'logout'

  resources :channels

  resources :videos
  get '/videos/:id/:title' => 'videos#show', :as => 'video_by_title'

  resources :charges

  root 'home#index'

  mount Alchemy::Engine => '/'
end

But, when I run git push heroku master, I receive this output:

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.1
-----> Installing dependencies using 1.5.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Using json (1.8.1)
       Using i18n (0.6.9)
       Using atomic (1.1.16)
       Using erubis (2.7.0)
       Using rack (1.5.2)
       Using mime-types (1.25.1)
       Using polyglot (0.3.4)
       Using rake (10.2.2)
       Using arel (5.0.0)
       Using builder (3.2.2)
       Using thor (0.19.1)
       Using hike (1.2.3)
       Using multi_json (1.9.2)
       Using addressable (2.3.6)
       Using tilt (1.4.1)
       Using browser (0.4.1)
       Using bundler (1.5.2)
       Using geocoder (1.1.9)
       Using referer-parser (0.2.1)
       Using request_store (1.0.5)
       Using coffee-script-source (1.7.0)
       Using execjs (2.0.2)
       Using chunky_png (1.3.0)
       Using fssm (0.2.10)
       Using minitest (5.3.1)
       Using magiclabs-userstamp (2.1.0)
       Using non-stupid-digest-assets (1.0.4)
       Using spinner.rb (0.3.0)
       Using tvdeyen-handles_sortable_columns (0.1.5)
       Using bcrypt (3.1.7)
       Using gravtastic (3.2.6)
       Using newrelic_rpm (3.6.7.159)
       Using cancan (1.6.10)
       Using pg (0.17.1)
       Using rails_serve_static_assets (0.0.2)
       Using rails_stdout_logging (0.0.3)
       Using rdoc (4.1.1)
       Using sass (3.2.18)
       Using thread_safe (0.3.1)
       Using rack-test (0.6.2)
       Using rest-client (1.6.7)
       Using treetop (1.4.15)
       Using dragonfly (1.0.3)
       Using select2-rails (3.5.4)
       Using ahoy_matey (0.1.1)
       Using sprockets (2.11.0)
       Using coffee-script (2.2.0)
       Using rails_12factor (0.0.2)
       Using uglifier (2.5.0)
       Using tzinfo (1.1.0)
       Using compass (0.12.4)
       Using mail (2.5.4)
       Using activesupport (4.1.0.rc2)
       Using compass-rails (1.1.7)
       Using sassy-buttons (0.2.6)
       Using sdoc (0.4.0)
       Using intercom-rails (0.2.24)
       Using actionview (4.1.0.rc2)
       Using jbuilder (2.0.5)
       Using actionpack (4.1.0.rc2)
       Using actionmailer (4.1.0.rc2)
       Using railties (4.1.0.rc2)
       Using actionpack-page_caching (1.0.2)
       Using activemodel (4.1.0.rc2)
       Using sprockets-rails (2.0.1)
       Using coffee-rails (4.0.1)
       Using jquery-rails (3.1.0)
       Using jquery-ui-rails (4.1.2)
       Using kaminari (0.15.1)
       Using active_model_serializers (0.8.1)
       Using rails-observers (0.1.2)
       Using activerecord (4.1.0.rc2)
       Using simple_form (3.0.1)
       Using turbolinks (2.2.1)
       Using sass-rails (4.0.2)
       Using rails (4.1.0.rc2)
       Using activeresource (4.0.0)
       Using acts_as_list (0.3.0)
       Using awesome_nested_set (3.0.0.rc.3)
       Using acts-as-taggable-on (3.0.2)
       Using wistia-api (0.2.3) from git://github.com/BenMorganIO/wistia-api.git (at customizations)
       Using stripe (1.10.2) from git://github.com/stripe/stripe-ruby.git (at master)
       Using alchemy_cms (3.0.0.rc5) from git://github.com/magiclabs/alchemy_cms.git (at 3.0-stable)
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (1.99s)
       Cleaning up the bundler cache.
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Alchemy is not mounted! Falling back to root path (/).
       If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.
       Alchemy is not mounted! Falling back to root path (/).
       If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.
       Asset precompilation completed (5.79s)
       Cleaning assets
       Running: rake assets:clean
       Alchemy is not mounted! Falling back to root path (/).
       If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.
       Alchemy is not mounted! Falling back to root path (/).
       If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.
-----> Discovering process types
       Procfile declares types -> (none)
       Default types for Ruby  -> console, rake, web, worker

-----> Compressing... done, 44.1MB
-----> Launching... done, v51
-----> Deploy hooks scheduled, check output in your logs

I check the logs and it was telling me that Alchemy was not mounted. It is also telling me a table is missing.

Apr 06 15:56:57 railstv app/web.1:  Alchemy is not mounted! Falling back to root path (/). 
Apr 06 15:56:57 railstv app/web.1:  If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file. 
Apr 06 15:56:57 railstv app/web.1:  Alchemy is not mounted! Falling back to root path (/). 
Apr 06 15:56:57 railstv app/web.1:  If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file. 
Apr 06 15:56:57 railstv app/web.1:  ** [NewRelic][04/06/14 22:56:57 +0000 2c375776-317d-493d-8088-45b62d5ddc98 (2)] INFO : Reporting to: https://rpm.newrelic.com/accounts/647929/applications/2769574 
Apr 06 15:56:58 railstv app/web.1:  ** [NewRelic][04/06/14 22:56:58 +0000 2c375776-317d-493d-8088-45b62d5ddc98 (2)] INFO : Doing deferred dependency-detection before Rack startup 
Apr 06 15:56:58 railstv app/web.1:  [2014-04-06 22:56:58] INFO  WEBrick 1.3.1 
Apr 06 15:56:58 railstv app/web.1:  [2014-04-06 22:56:58] INFO  ruby 2.1.1 (2014-02-24) [x86_64-linux] 
Apr 06 15:56:58 railstv app/web.1:  [2014-04-06 22:56:58] INFO  WEBrick::HTTPServer#start: pid=2 port=9568 
Apr 06 15:56:59 railstv app/web.1:  Started GET "/" for 96.49.148.181 at 2014-04-06 22:56:59 +0000 
Apr 06 15:56:59 railstv app/web.1:  Processing by HomeController#index as HTML 
Apr 06 15:56:59 railstv app/web.1:  PG::UndefinedTable: ERROR:  relation "alchemy_sites" does not exist 
Apr 06 15:56:59 railstv app/web.1:  LINE 1: SELECT  "alchemy_sites".* FROM "alchemy_sites"  WHERE "alche... 
Apr 06 15:56:59 railstv app/web.1:                                         ^ 
Apr 06 15:56:59 railstv app/web.1:  : SELECT  "alchemy_sites".* FROM "alchemy_sites"  WHERE "alchemy_sites"."host" = 'www.rails.tv'  ORDER BY "alchemy_sites"."id" ASC LIMIT 1 
Apr 06 15:56:59 railstv app/web.1:  Completed 500 Internal Server Error in 29ms 
Apr 06 15:56:59 railstv app/web.1:  ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "alchemy_sites" does not exist 
Apr 06 15:56:59 railstv app/web.1:  LINE 1: SELECT  "alchemy_sites".* FROM "alchemy_sites"  WHERE "alche... 
Apr 06 15:56:59 railstv app/web.1:                                         ^ 
Apr 06 15:56:59 railstv app/web.1:  : SELECT  "alchemy_sites".* FROM "alchemy_sites"  WHERE "alchemy_sites"."host" = 'www.rails.tv'  ORDER BY "alchemy_sites"."id" ASC LIMIT 1): 
Apr 06 15:56:59 railstv app/web.1:    vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `async_exec' 
Apr 06 15:56:59 railstv app/web.1:    vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'

I ran heroku run alchemy:db:seed thinking I needed to add the seed data, this was the output:

Running `rake alchemy:db:seed` attached to terminal... up, run.5181
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Starting the New Relic agent in "production" environment.
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : To prevent agent startup add a NEWRELIC_ENABLE=false environment variable or modify the "production" section of your newrelic.yml.
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Reading configuration from config/newrelic.yml
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Enabling the Request Sampler.
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Environment: production
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : No known dispatcher detected.
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Application: Rails TV
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing Net instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing deferred Rack instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing ActiveRecord 4 instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing Rails4 Error instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing Rails 4 Controller instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Installing Rails 4 view instrumentation
** [NewRelic][04/07/14 08:47:08 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Finished instrumentation
Alchemy is not mounted! Falling back to root path (/).
If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.

Alchemy is not mounted! Falling back to root path (/).
If you want to change Alchemy's mount point, please mount Alchemy::Engine in your config/routes.rb file.

** [NewRelic][04/07/14 08:47:09 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Reporting to: https://rpm.newrelic.com/accounts/647929/applications/2769574

Creating default Alchemy site
-----------------------------
PG::UndefinedTable: ERROR:  relation "alchemy_sites" does not exist
LINE 5:                WHERE a.attrelid = '"alchemy_sites"'::regclas...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"alchemy_sites"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "alchemy_sites" does not exist
LINE 5:                WHERE a.attrelid = '"alchemy_sites"'::regclas...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"alchemy_sites"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0.rc2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:969:in `column_definitions'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:187:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:93:in `block in prepare_default_proc'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:44:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:44:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/model_schema.rb:214:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/model_schema.rb:260:in `column_names'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:221:in `aggregate_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:244:in `execute_simple_calculation'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:216:in `perform_calculation'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:111:in `calculate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:26:in `count'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/querying.rb:13:in `count'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/alchemy/seeder.rb:20:in `create_default_site'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/alchemy/seeder.rb:12:in `seed!'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/tasks/alchemy/db.rake:10:in `block (3 levels) in <top (required)>'
PG::UndefinedTable: ERROR:  relation "alchemy_sites" does not exist
LINE 5:                WHERE a.attrelid = '"alchemy_sites"'::regclas...
                                          ^
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.0.rc2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql_adapter.rb:969:in `column_definitions'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:187:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:93:in `block in prepare_default_proc'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:44:in `yield'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/connection_adapters/schema_cache.rb:44:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/model_schema.rb:214:in `columns'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/model_schema.rb:260:in `column_names'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:221:in `aggregate_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:244:in `execute_simple_calculation'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:216:in `perform_calculation'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:111:in `calculate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/relation/calculations.rb:26:in `count'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0.rc2/lib/active_record/querying.rb:13:in `count'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/alchemy/seeder.rb:20:in `create_default_site'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/alchemy/seeder.rb:12:in `seed!'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/alchemy_cms-843bddc5f580/lib/tasks/alchemy/db.rake:10:in `block (3 levels) in <top (required)>'
Tasks: TOP => alchemy:db:seed
(See full trace by running task with --trace)
** [NewRelic][04/07/14 08:47:09 +0000 eae2fbac-4623-43e2-95a8-52d6f770591e (2)] INFO : Starting Agent shutdown

I can't seem to figure out why its not running or booting up on the production environment...


Solution

  • The Alchemy is not mounted! Falling back to root path (/). warning seems to be a bug if Alchemy is not mounted first within your config/routes.rb file, because I do have Alchemy mounted and working in my production environment on Heroku and receive the same warning. I think your problem is Alchemy not being seeded on your Heroku production environment.

    Have you run the Alchemy rake command on your Heroku server? heroku run rails generate alchemy:elements this will allow you to login to the Alchemy admin and then create a site tree for your first language which will provide you with your root page.