Heroku/Rails error, logs not very helpful - ruby-on-rails

I have recently developed my first Ruby on Rails app and have tried to deploy it to Heroku, however when I try to load the app URL, it just returns with this page:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
Here are my logs:
2015-01-27T14:11:44.782093+00:00 heroku[api]: Release v12 created by tom#tomoakley.me
2015-01-27T14:11:45.419564+00:00 heroku[web.1]: State changed from up to starting
2015-01-27T14:11:48.394740+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 21006 -e production`
2015-01-27T14:11:49.304740+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-01-27T14:11:50.179113+00:00 app[web.1]: [2015-01-27 14:11:50] FATAL SignalException: SIGTERM
2015-01-27T14:11:50.179123+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2015-01-27T14:11:50.179120+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2015-01-27T14:11:50.179121+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2015-01-27T14:11:50.179126+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/handler/webrick.rb:35:in `run'
2015-01-27T14:11:50.179124+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2015-01-27T14:11:50.179133+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-01-27T14:11:50.179152+00:00 app[web.1]: bin/rails:8:in `require'
2015-01-27T14:11:50.179150+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-01-27T14:11:50.179130+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-01-27T14:11:50.179128+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start'
2015-01-27T14:11:50.179161+00:00 app[web.1]: [2015-01-27 14:11:50] INFO WEBrick::HTTPServer#start done.
2015-01-27T14:11:50.179127+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:286:in `start'
2015-01-27T14:11:50.179160+00:00 app[web.1]: [2015-01-27 14:11:50] INFO going to shutdown ...
2015-01-27T14:11:50.179131+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-01-27T14:11:50.179151+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-01-27T14:11:50.179153+00:00 app[web.1]: bin/rails:8:in `<main>'
2015-01-27T14:11:50.265926+00:00 app[web.1]: => Booting WEBrick
2015-01-27T14:11:50.265932+00:00 app[web.1]: => Rails 4.2.0 application starting in production on http://0.0.0.0:39482
2015-01-27T14:11:50.265936+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-01-27T14:11:50.265934+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-01-27T14:11:50.265937+00:00 app[web.1]: Exiting
2015-01-27T14:11:51.162075+00:00 heroku[web.1]: Process exited with status 143
2015-01-27T14:11:52.030623+00:00 app[web.1]: [2015-01-27 14:11:52] INFO ruby 2.0.0 (2014-11-13) [x86_64-linux]
2015-01-27T14:11:52.030600+00:00 app[web.1]: [2015-01-27 14:11:52] INFO WEBrick 1.3.1
2015-01-27T14:11:52.030938+00:00 app[web.1]: [2015-01-27 14:11:52] INFO WEBrick::HTTPServer#start: pid=3 port=21006
2015-01-27T14:11:52.681188+00:00 heroku[web.1]: State changed from starting to up
2015-01-27T14:12:57.646409+00:00 heroku[router]: at=info method=GET path="/" host=www.biblequot.es request_id=8125c7b1-2590-4162-b98f-0b849febe74e fwd="94.175.136.230" dyno=web.1 connect=3ms service=1175ms status=500 bytes=1754
I was previously trying to work out how to keep the Secret Keys in config/secrets.yml from being on Github (the repo will be public) and tried to install GPG and use dotgpg (using the guide here) but I couldn't get it to work properly so took it out of my Gemfile, which I've copied in below:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use font-awesome!
gem 'font-awesome-sass'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
And also for good measure, here is my config/enviroment/production.rb file:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Sorry for putting so much stuff here, I just hope someone can resolve my problem quickly :) Also as a bonus, what's the best way to hide the secret keys in secrets.yml? Does it matter if the development and test keys are there? (the production key is hidden in an environment variable). Thanks!

In your logs, it looks like your application received a Sigterm, but when you see the rails error message
"We're sorry, but something went wrong." It mean the server started, and the error is inside your rails application.
So we need to see more of your logs to help you.
The easiest way for environement variable is to create a .env.sample with examples of environement variable and every developer creates it's own .env file and use dotenv-rails with gem 'dotenv-rails', groups: [:development, :test] inside your Gemfile
You can even replace your database.yml with :
DATABASE_URL=postgres://username:password#localhost:5432/database_name
But dotgpg looks great, I will try to use it.

in your project directory, run
heroku run console
it should give you more info

Related

Rails 6 image upload to digitalocean spaces

I have a blog that uploads banner and thumbnail images. I originally had it set to upload to the local directory using the carrierwave gem and I wanted to try to use digitalocean spaces since the app is deployed to the digitalocean app platform. I am able to get it working on localhost:3000 but when I deploy it to digitalocean it keeps reverting back to a previous deployment saying that a health check failed but not real errors.
I decided to deploy it to heroku since I am able to get actual errors. Here is the current error I get from heroku:
2021-03-09T22:41:10.466080+00:00 heroku[web.1]: Starting process with command `bin/rails server -p ${PORT:-5000} -e production`
2021-03-09T22:41:20.121636+00:00 app[web.1]: => Booting Puma
2021-03-09T22:41:20.121679+00:00 app[web.1]: => Rails 6.1.3 application starting in production
2021-03-09T22:41:20.121679+00:00 app[web.1]: => Run `bin/rails server --help` for more startup options
2021-03-09T22:41:31.105804+00:00 app[web.1]: [fog][WARNING] Unable to fetch credentials: Connection refused - connect(2) for 169.254.169.254:80 (Errno::ECONNREFUSED)
2021-03-09T22:41:31.108732+00:00 app[web.1]: Exiting
2021-03-09T22:41:31.110380+00:00 app[web.1]: /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:244:in `validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError)
2021-03-09T22:41:31.110386+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:268:in `handle_settings'
2021-03-09T22:41:31.110391+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/service.rb:98:in `new'
2021-03-09T22:41:31.110426+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/fog-core-2.2.3/lib/fog/core/services_mixin.rb:30:in `new'
2021-03-09T22:41:31.110427+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/carrierwave-2.2.0/lib/carrierwave/storage/fog.rb:68:in `eager_load'
2021-03-09T22:41:31.110431+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/carrierwave-2.2.0/lib/carrierwave.rb:77:in `block in <class:Railtie>'
2021-03-09T22:41:31.110435+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook'
2021-03-09T22:41:31.110467+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
2021-03-09T22:41:31.110472+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
2021-03-09T22:41:31.110473+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
2021-03-09T22:41:31.110508+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
2021-03-09T22:41:31.111096+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
2021-03-09T22:41:31.111100+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/application/finisher.rb:129:in `block in <module:Finisher>'
2021-03-09T22:41:31.111101+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:32:in `instance_exec'
2021-03-09T22:41:31.111127+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:32:in `run'
2021-03-09T22:41:31.111132+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:61:in `block in run_initializers'
2021-03-09T22:41:31.111132+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
2021-03-09T22:41:31.111164+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2021-03-09T22:41:31.111168+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
2021-03-09T22:41:31.111169+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
2021-03-09T22:41:31.111201+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
2021-03-09T22:41:31.111202+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
2021-03-09T22:41:31.111772+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
2021-03-09T22:41:31.111777+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
2021-03-09T22:41:31.111777+00:00 app[web.1]: from /app/vendor/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
2021-03-09T22:41:31.111781+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/initializable.rb:60:in `run_initializers'
2021-03-09T22:41:31.111808+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/application.rb:384:in `initialize!'
2021-03-09T22:41:31.111809+00:00 app[web.1]: from /app/config/environment.rb:5:in `<main>'
2021-03-09T22:41:31.111813+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2021-03-09T22:41:31.111839+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2021-03-09T22:41:31.111844+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2021-03-09T22:41:31.111844+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2021-03-09T22:41:31.111845+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2021-03-09T22:41:31.111845+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
2021-03-09T22:41:31.111848+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
2021-03-09T22:41:31.111851+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
2021-03-09T22:41:31.111884+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
2021-03-09T22:41:31.112296+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
2021-03-09T22:41:31.112301+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2021-03-09T22:41:31.112302+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
2021-03-09T22:41:31.112334+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
2021-03-09T22:41:31.112339+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
2021-03-09T22:41:31.112340+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
2021-03-09T22:41:31.112367+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'
2021-03-09T22:41:31.112368+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
2021-03-09T22:41:31.112372+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
2021-03-09T22:41:31.112398+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:312:in `block in start'
2021-03-09T22:41:31.112403+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:379:in `handle_profiling'
2021-03-09T22:41:31.112809+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/rack-2.2.3/lib/rack/server.rb:311:in `start'
2021-03-09T22:41:31.112813+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:39:in `start'
2021-03-09T22:41:31.112841+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:144:in `block in perform'
2021-03-09T22:41:31.112845+00:00 app[web.1]: from <internal:kernel>:90:in `tap'
2021-03-09T22:41:31.112846+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands/server/server_command.rb:135:in `perform'
2021-03-09T22:41:31.112877+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
2021-03-09T22:41:31.112881+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
2021-03-09T22:41:31.112882+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
2021-03-09T22:41:31.112912+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/command/base.rb:69:in `perform'
2021-03-09T22:41:31.114191+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/command.rb:50:in `invoke'
2021-03-09T22:41:31.114195+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/railties-6.1.3/lib/rails/commands.rb:18:in `<main>'
2021-03-09T22:41:31.114196+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
2021-03-09T22:41:31.114229+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
2021-03-09T22:41:31.114234+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2021-03-09T22:41:31.114234+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
2021-03-09T22:41:31.114261+00:00 app[web.1]: from /app/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
2021-03-09T22:41:31.114262+00:00 app[web.1]: from bin/rails:5:in `<main>'
2021-03-09T22:41:31.238223+00:00 heroku[web.1]: Process exited with status 1
2021-03-09T22:41:31.311694+00:00 heroku[web.1]: State changed from starting to crashed
After the server starts it crashes saying fog cannot get the credentials.
Here is my initializer/carrierwave.rb file:
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: Rails.application.credentials.aws(:digitalocean_spaces_key), # required unless using use_iam_profile
aws_secret_access_key: Rails.application.credentials.aws(:digitalocean_spaces_secret), # required unless using use_iam_profile
use_iam_profile: true, # optional, defaults to false
region: 'nyc3', # optional, defaults to 'us-east-1'
host: 'nyc3.digitaloceanspaces.com', # optional, defaults to nil
endpoint: 'https://nyc3.digitaloceanspaces.com' # optional, defaults to nil
}
config.fog_directory = 'judo' # required
config.fog_public = true # optional, defaults to true
#config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
# For an application which utilizes multiple servers but does not need caches persisted across requests,
# uncomment the line :file instead of the default :storage. Otherwise, it will use AWS as the temp cache store.
# config.cache_storage = :file
end
Here is another attempt at the carrierwave.rb file:
CarrierWave.configure do |config|
config.fog_credentials = {
provider: 'AWS', # required
digitalocean_spaces_key_id: Rails.application.credentials.digitalocean_spaces_key, # required unless using use_iam_profile
digitalocean_spaces_secret: Rails.application.credentials.digitalocean_spaces_secret,
digitalocean_spaces_bucket: Rails.application.credentials.digitalocean_spaces_bucket,
use_iam_profile: true, # optional, defaults to false
region: 'nyc3', # optional, defaults to 'us-east-1'
host: 'nyc3.digitaloceanspaces.com', # optional, defaults to nil
endpoint: 'https://nyc3.digitaloceanspaces.com' # optional, defaults to nil
}
config.fog_directory = 'judo' # required
config.fog_public = true # optional, defaults to true
#config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
# For an application which utilizes multiple servers but does not need caches persisted across requests,
# uncomment the line :file instead of the default :storage. Otherwise, it will use AWS as the temp cache store.
# config.cache_storage = :file
end
Here is my credentials.yml file:
production:
digitalocean_spaces_key: <%= ENV["DIGITALOCEAN_SPACES_KEY"] %>
digitalocean_spaces_secret: <%= ENV["DIGITALOCEAN_SPACES_SECRET"] %>
digitalocean_spaces_bucket: <%= ENV["DIGITALOCEAN_SPACES_BUCKET"] %>
development:
digitalocean_spaces_key: my_key
digitalocean_spaces_secret: my_secret
digitalocean_spaces_bucket: judo
I entered the spaces key, secret, and bucket as app level variables in the app on digitalocean.
Here is my uploaders/banner_uploader.rb file:
class BannerUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
#include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url(*args)
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process scale: [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process resize_to_fit: [50, 50]
# end
# Add an allowlist of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_allowlist
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
Here is my post.rb:
class Post < ApplicationRecord
belongs_to :user
has_many :comments, as: :commentable, dependent: :destroy
# Active Storage from Rails 5
#has_one_attached :thumbnail
#has_one_attached :banner
# Action Text from Rails 6
has_rich_text :body
mount_uploader :banner, BannerUploader
validates :title, length: { minimum: 5 }
validates :body, length: { minimum: 25 }
self.per_page = 10
extend FriendlyId
friendly_id :title, use: :slugged
end
And here is my Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.3'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 4.1.0'
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
# gem 'rack-mini-profiler', '~> 2.0'
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.26'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'devise'
gem 'simple_form'
gem 'faker'
gem 'will_paginate'
gem 'friendly_id'
gem "carrierwave"
gem "mime-types"
gem "fog-aws"
It seems like the server can't access to the content of the credentials.yml. This file is encrypted and Rails use the master key store in the master.key file to read it. So given that the master.key is not checked into version control, you need to provide it manually on the server. Please check this article https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336
This section :
Deploying master key
When you move your code to a server, you need to make sure that your config/credentials.yml.enc file can be decrypted. That means that somehow you’ll need to provide Rails with your master key, given that it is not checked into version control.
There are two ways of doing that:
Option 1: Place the config/master.key file in the server. You’ll normally want to symlink this file to a shared folder in the server filesystem. Again, do not version your config/master.key file.
Option 2: create a RAILS_MASTER_KEY ENV variable. Rails will detect it and use it as your master key, e.g. in heroku: heroku config:set RAILS_MASTER_KEY=.
You should be able to use any of those indistinctly.
If you are using RBENV as you ruby manager, you can store your env var doing this :
You will create .rbenv-vars in your project folder, not your rails project folder but the folder in which is your project folder, the parent folder if you want.
After that you put your env var inside the file like this:
DATABASE_PWD=*****
no quotes, no space too before ou after the "="
For more check this link on goRails : https://gorails.com/deploy/ubuntu/18.04#capistrano
Hope this can help

Heroku:The page you were looking for doesn't exist No route matches [GET] "/"

I'm new to Rails. This question has been asked a lot but unfortunately none of the solutions provided have worked for me.
On Heroku, visiting the app URL after pushing my files with git push heroku master gives me the error:
The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
Here's my log:
2014-05-17T12:31:00.796904+00:00 app[web.1]: [2014-05-17 12:31:00] INFO WEBrick::HTTPServer#start done.
2014-05-17T12:31:00.796853+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2014-05-17T12:31:00.796864+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/com
mands_tasks.rb:40:in `run_command!'
2014-05-17T12:31:00.796850+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in
start'
2014-05-17T12:31:00.796866+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:
17:in `<top (required)>'
2014-05-17T12:31:00.796840+00:00 app[web.1]: [2014-05-17 12:31:00] FATAL SignalException: SIGTERM
2014-05-17T12:31:00.796868+00:00 app[web.1]: bin/rails:4:in `require'
2014-05-17T12:31:00.796855+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.r
b:14:in `run'
2014-05-17T12:31:00.796869+00:00 app[web.1]: bin/rails:4:in `<main>'
2014-05-17T12:31:00.796856+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in
`start'
2014-05-17T12:31:00.796876+00:00 app[web.1]: [2014-05-17 12:31:00] INFO going to shutdown ...
2014-05-17T12:31:00.796858+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/ser
ver.rb:69:in `start'
2014-05-17T12:31:00.796944+00:00 app[web.1]: Exiting
2014-05-17T12:31:00.796860+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/com
mands_tasks.rb:81:in `block in server'
2014-05-17T12:31:00.138102+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-05-17T12:31:02.926026+00:00 heroku[web.1]: Process exited with status 143
Here's my Gemfile:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I've also modified my production.rb by addding:
#config/environments/production.rb
config.assets.compile = true
# Heroku also requires this to be false
config.assets.initialize_on_precompile=false
and here's my routes.rb:
Rails.application.routes.draw do
exit
most of the code in this file is commented.
Please help?
Edit
O.k. so after looking at the files you have, I do not see any pages to view which means heroku has nothing to display. First off I want to recommend the ruby on rails tutorial by Micheal Hartl. You can find it free by googling "ruby on rails tutorial hartl", this will explain Ruby on rails better than I ever could, if you work through it and feel like it helped I believe you can donate some money for using it and I would recommend that because it is an amazing resource that I, and probably many others, have used to learn ruby on rails.
O.k. first why your code is not working. You have root 'welcome#index' in routes.rb. But there is no welcome_controller.rb with an 'index' action. To create that from command line type (capitaliazation is important here)
rails generate controller Welcome index
This will create an index page (the one you have in your routes file), it creates the view and the 'welcome' controller for it automatically. You can call the page anything you want but this will work for the code you already have in routes.rb. You will understand this more when you work through the tutorial. This will also create a lot of files, again the tutorial will help you understand what all that is. I am only trying to solve the issue you posted about right here and stay on topic as best I can while getting you going in the right direction.
After that you will have to push to git again and then push to heroku. When you open heroku again it should land on that page, there will not be anything on the page other than a generic message, I think you should see something along the lines of "find me in app/views/welcome/index.rb" If you see that your routing is working.

Rails process every request twice

I've got very weird problem with Rails using Spree.
Every single request is being processed twice. It's not problem with AJAX as single CURL request is also processed twice. It's not problem with logs either, as actions really takes place twice.
Problem exists only in production environment, both on Heroku and locally.
Example log:
2014-04-06T06:45:48.969394+00:00 heroku[router]: at=info method=POST path=/spree/api/orders/R657018514/line_items host=xxx.xxx.com request_id=75ac3584-f33e-48fe-b6ce-d898120f8b57 fwd="185.12.21.77" dyno=web.1 connect=0ms service=399ms status=201 bytes=1097
2014-04-06T06:45:48.952672+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/bundler/gems/spree-78f129b6d6f5/api/app/views/spree/api/orders/show.v1.rabl (120.9ms)
2014-04-06T06:45:48.959453+00:00 app[web.1]: Completed 201 Created in 381ms (Views: 93.4ms | ActiveRecord: 188.8ms)
2014-04-06T06:45:48.959460+00:00 app[web.1]: Completed 201 Created in 381ms (Views: 93.4ms | ActiveRecord: 188.8ms)
2014-04-06T06:45:48.958355+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/bundler/gems/spree-78f129b6d6f5/api/app/views/spree/api/orders/show.v1.rabl (120.9ms)
Started GET "/" for 127.0.0.1 at 2014-04-06 08:55:29 +0200
Started GET "/" for 127.0.0.1 at 2014-04-06 08:55:29 +0200
Processing by Spree::HomeController#index as HTML
Processing by Spree::HomeController#index as HTML
Rendered spree/home/index.html.erb within spree/layouts/spree_application (0.8ms)
Rendered spree/home/index.html.erb within spree/layouts/spree_application (0.8ms)
Gemfile.rb:
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'newrelic_rpm'
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'compass', '= 0.12.2'
gem 'compass-rails', '~> 1.1.2'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'sqlite3'
gem 'pry-rails'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
gem 'jquery-rails', '~> 3.1.0'
gem 'jquery-ui-rails'
gem 'handlebars_assets'
gem 'spree', :github => "methyl/spree", :require => false
gem 'spree_auth_devise', github: 'spree/spree_auth_devise'
production.rb
Aimer::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
config.static_cache_control = "public, max-age=31536000"
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
#Giannis, you were right, logs was only duplicated, and cause of double emails was somewhere else, probably in Sendgrid config.
Probably you were using heroku for deployment before, and later you started to use any other instance for deployment.
Try commenting gem 'rails_12factor' once and do bundle install, then check once.

Errors when deploying Rails App to Heroku

Hello I am just starting to learn Ruby on Rails and am watching the Railstutoprials screen casts. However When I do my git push to heroku and try to load my rails app I get an error and my logs look like this.
2013-06-26T22:41:06.427464+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 55907 -e $RAILS_ENV`
2013-06-26T22:41:07.770202+00:00 app[web.1]:
2013-06-26T22:41:07.770515+00:00 app[web.1]: Options:
2013-06-26T22:41:07.770114+00:00 app[web.1]: rails new APP_PATH [options]
2013-06-26T22:41:07.771778+00:00 app[web.1]: -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
2013-06-26T22:41:07.771778+00:00 app[web.1]: -r, [--ruby=PATH] # Path to the Ruby binary of your choice
2013-06-26T22:41:07.771778+00:00 app[web.1]: -B, [--skip-bundle] # Don't run bundle install
2013-06-26T22:41:07.770029+00:00 app[web.1]: Usage:
2013-06-26T22:41:07.771962+00:00 app[web.1]: # Default: sqlite3
2013-06-26T22:41:07.771778+00:00 app[web.1]: -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
2013-06-26T22:41:07.771962+00:00 app[web.1]: -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
2013-06-26T22:41:07.771778+00:00 app[web.1]: # Default: /app/vendor/ruby-2.0.0/bin/ruby
2013-06-26T22:41:07.771778+00:00 app[web.1]: [--skip-gemfile] # Don't create a Gemfile
2013-06-26T22:41:07.771778+00:00 app[web.1]: -O, [--skip-active-record] # Skip Active Record files
2013-06-26T22:41:07.771778+00:00 app[web.1]: -G, [--skip-git] # Skip .gitignore file
2013-06-26T22:41:07.771962+00:00 app[web.1]: -J, [--skip-javascript] # Skip JavaScript files
2013-06-26T22:41:07.771778+00:00 app[web.1]: [--skip-keeps] # Skip source control .keep files
2013-06-26T22:41:07.771778+00:00 app[web.1]: -S, [--skip-sprockets] # Skip Sprockets files
2013-06-26T22:41:07.771962+00:00 app[web.1]: # Default: jquery
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--edge] # Setup the application with Gemfile pointing to Rails repository
2013-06-26T22:41:07.771962+00:00 app[web.1]: -T, [--skip-test-unit] # Skip Test::Unit files
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--rc=RC] # Path to file containing extra configuration options for rails command
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--dev] # Setup the application with Gemfile pointing to your Rails checkout
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--no-rc] # Skip loading of extra configuration options from .railsrc file
2013-06-26T22:41:07.771962+00:00 app[web.1]:
2013-06-26T22:41:07.772167+00:00 app[web.1]: Runtime options:
2013-06-26T22:41:07.772167+00:00 app[web.1]: -f, [--force] # Overwrite files that already exist
2013-06-26T22:41:07.772167+00:00 app[web.1]: -p, [--pretend] # Run but do not make any changes
2013-06-26T22:41:07.773137+00:00 app[web.1]: Rails options:
2013-06-26T22:41:07.772167+00:00 app[web.1]: -s, [--skip] # Skip files that already exist
2013-06-26T22:41:07.772167+00:00 app[web.1]: -q, [--quiet] # Suppress status output
2013-06-26T22:41:07.772167+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: Description:
2013-06-26T22:41:07.773217+00:00 app[web.1]: -v, [--version] # Show Rails version number and quit
2013-06-26T22:41:07.773756+00:00 app[web.1]: The 'rails new' command creates a new Rails application with a default
2013-06-26T22:41:07.773217+00:00 app[web.1]: -h, [--help] # Show this help message and quit
2013-06-26T22:41:07.773756+00:00 app[web.1]: directory structure and configuration at the path you specify.
2013-06-26T22:41:07.773756+00:00 app[web.1]: 'rails new' runs in the .railsrc configuration file in your home directory.
2013-06-26T22:41:07.773217+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: defaults values shown above in this help message.
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: You can specify extra command-line arguments to be used every time
2013-06-26T22:41:07.773756+00:00 app[web.1]: Note that the arguments specified in the .railsrc file don't affect the
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773989+00:00 app[web.1]: Example:
2013-06-26T22:41:07.773989+00:00 app[web.1]:
2013-06-26T22:41:07.773989+00:00 app[web.1]: See the README in the newly created application to get going.
2013-06-26T22:41:07.773989+00:00 app[web.1]: rails new ~/Code/Ruby/weblog
2013-06-26T22:41:07.773989+00:00 app[web.1]: This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
2013-06-26T22:41:09.160872+00:00 heroku[web.1]: Process exited with status 0
2013-06-26T22:41:09.172961+00:00 heroku[web.1]: State changed from starting to crashed
My Gemfile looks like:
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use postgresql as the database for Active Record
gem 'pg', group: :production
gem 'sqlite3', group: [:test, :development]
# Use V8 JavaScript engine
gem 'therubyracer'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'rails_12factor'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
and finally my database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
database: social_pantry
pool: 5
timeout: 5000
looks like its trying to execute rails server command on a directory that is not a rails project. Set the correct app path in your configuration.

Heroku Precompiling Assets Failed

My app is suddenly not working after an update. Not sure what's going wrong. Basically, when I push to heroku, I get these errors:
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
And a little higher up:
rake aborted!
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
Error
at new JS_Parse_Error (/tmp/execjs20121211-811-1z5vum.js:1720:22)
at js_error (/tmp/execjs20121211-811-1z5vum.js:1728:15)
at croak (/tmp/execjs20121211-811-1z5vum.js:2189:17)
at token_error (/tmp/execjs20121211-811-1z5vum.js:2196:17)
at unexpected (/tmp/execjs20121211-811-1z5vum.js:2202:17)
at /tmp/execjs20121211-811-1z5vum.js:2580:17
at maybe_unary (/tmp/execjs20121211-811-1z5vum.js:2665:27)
at expr_op (/tmp/execjs20121211-811-1z5vum.js:2685:45)
at expr_ops (/tmp/execjs20121211-811-1z5vum.js:2692:24)
at maybe_conditional (/tmp/execjs20121211-811-1z5vum.js:2696:28)
When I actually load up the site ("We're sorry, but something went wrong"), and look at the heroku logs, I get this:
Load path: /app
2012-12-11T23:18:13+00:00 app[web.1]: 8: <%= stylesheet_link_tag "application", :media => "all" %>
2012-12-11T23:18:13+00:00 app[web.1]: (in /app/app/assets/stylesheets/custom.css.scss)):
2012-12-11T23:18:13+00:00 app[web.1]: 6: <link href='http://fonts.googleapis.com/css?family=Kreon' rel='stylesheet' type='text/css'>
2012-12-11T23:18:13+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2012-12-11T23:18:13+00:00 app[web.1]: 5: <title><%= full_title(yield(:title)) %></title>
2012-12-11T23:18:13+00:00 app[web.1]: 7: <%= favicon_link_tag 'favicon.ico' %>
2012-12-11T23:18:13+00:00 app[web.1]: 10: <%= csrf_meta_tags %>
2012-12-11T23:18:13+00:00 app[web.1]: app/assets/stylesheets/custom.css.scss:1
2012-12-11T23:18:13+00:00 app[web.1]: 11: <meta name="google-site-verification" content="idIPkgRBikSL9PCS4rVkkZfRjxYbPxNbyF6tVymBWbc" />
2012-12-11T23:18:13+00:00 app[web.1]:
2012-12-11T23:18:13+00:00 app[web.1]:
(Kreon is an additional font I added a while back that's been working fine. custom.css.scss is my main css file, and the first line is where I import bootstrap in a way that hasn't changed and has worked forever).
I searched for how to deal with the "File to import not found or unreadable: bootstrap" error, and landed on this discussion and checked out the relevant heroku troubleshoot page, but changing assets.compile to true in my production.rb file led to the heroku push errors above, and the troubleshoot page didn't seem to have much relevant to my specific problem. Not really sure what's going on here, so I'm just going to put a bunch of possibly relevant code below.
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'googlecharts', :require => "gchart"
gem 'unicorn'
gem 'newrelic_rpm'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg'
end
group :development do
gem 'sqlite3'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
end
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.9.1'
gem 'growl', '1.0.3'
gem 'guard-spork', '1.2.0'
gem 'spork', '0.9.2'
gem 'factory_girl_rails', '4.1.0'
end
gem 'annotate', '2.5.0'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'roadie'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'foreman'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
production.rb
MyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies.
config.force_ssl = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
The line that's really throwing me is this one in my heroku push log:
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
The issue, is I have no idea what file to look in for this troublesome ">". Any ideas how to read that line/col/pos nomenclature to find the actual offending code snippet?
Thanks.
STart with line 1 of app/assets/stylesheets/custom.css.scss and look for an errant >.
Also look to make sure that application.scss is what you expect.
Also just rename custom.css.scss to justcustom.scss Heck, that may do it.
Try this in the terminal:
rake assets:precompile RAILS_ENV=production --trace
Better than trying to push on heroku.
I just had the same errors.
The problem was:
the config.secret_key of devise was commented
syntax_error in a javascript file ( an "of" instead of an "in" in a for loop)
The same thing happened to me as well,
"Precompiling assets failed." while pushing to heroku,
In my development environment I had an error in my css:
".........
cursor: pointer
color: #808080;"
missing the ";" after the "pointer",
the development environment didn't mind the error,
but Heroku's PreCompile task did.
Some other Problems might be caused by duplicate named file, with "css" and "css.scss" suffixes.

Resources