質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1910閲覧

herokuでApplicationエラーが出た場合の対処について

graphic-ocean

総合スコア12

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2017/12/13 04:40

編集2017/12/13 05:26

herokuにて、アプリケーションに変更を加え、プッシュしたところ、以下のようなエラーがでました。

変更してプッシュした内容は、
・画像のアップロード先をAWS S3にするために、gemのfogをインストール
・image_uploaderの編集
・config/initializersの直下にcarrierwave.rbを作成

※追記
git statusで見てみると、carrierwave.rbに問題があるようなのですが。
どのように対処すればよろしいでしょうか。

$ git status

On branch master Your branch is ahead of 'childtalent/master' by 1 commit. (use "git push" to publish your local commits) Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: app/uploaders/image_uploader.rb Untracked files: (use "git add <file>..." to include in what will be committed) config/initializers/carrierwave.rb

gemfile

ruby

1source 'https://rubygems.org' 2 3 4# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5gem 'rails', '4.2.6' 6# Use mysql as the database for Active Record 7gem 'mysql2', '0.3.18' 8# Use SCSS for stylesheets 9gem 'sass-rails', '~> 4.0.2' 10# Use Uglifier as compressor for JavaScript assets 11gem 'uglifier', '>= 1.3.0' 12# Use CoffeeScript for .coffee assets and views 13gem 'coffee-rails', '~> 4.1.0' 14# See https://github.com/rails/execjs#readme for more supported runtimes 15# gem 'therubyracer', platforms: :ruby 16 17# Use jquery as the JavaScript library 18gem 'jquery-rails' 19# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 20gem 'turbolinks' 21# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 22gem 'jbuilder', '~> 2.0' 23# bundle exec rake doc:rails generates the API under doc/api. 24gem 'sdoc', '~> 0.4.0', group: :doc 25 26# Use ActiveModel has_secure_password 27# gem 'bcrypt', '~> 3.1.7' 28 29# Use Unicorn as the app server 30# gem 'unicorn' 31 32# Use Capistrano for deployment 33# gem 'capistrano-rails', group: :development 34 35group :development, :test do 36 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 37 gem 'byebug' 38end 39 40group :development do 41 # Access an IRB console on exception pages or by using <%= console %> in views 42 gem 'web-console', '~> 2.0' 43 44 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 45 gem 'spring' 46end 47 48gem 'pry-rails' 49gem 'compass-rails', '~> 2.0' 50gem 'sprockets', '2.11.0' 51gem 'devise' 52gem 'paperclip' 53gem 'kaminari' 54gem 'therubyracer' 55gem 'twitter-bootstrap-rails' 56gem 'bootstrap-material-design', '0.1.4' 57gem 'carrierwave' 58 59gem 'mini_magick' 60 61 62group :production do 63 gem 'rails_12factor' 64end 65 66gem 'fog'

image_uploader.rb

ruby

1# encoding: utf-8 2 3class ImageUploader < CarrierWave::Uploader::Base 4 5 # Include RMagick or MiniMagick support: 6 # include CarrierWave::RMagick 7 # include CarrierWave::MiniMagick 8 9 # Choose what kind of storage to use for this uploader: 10 storage :fog 11 12 # Override the directory where uploaded files will be stored. 13 # This is a sensible default for uploaders that are meant to be mounted: 14 def store_dir 15 "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 16 end 17 18 # Provide a default URL as a default if there hasn't been a file uploaded: 19 # def default_url(*args) 20 # # For Rails 3.1+ asset pipeline compatibility: 21 # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) 22 # 23 # "/images/fallback/" + [version_name, "default.png"].compact.join('_') 24 # end 25 26 # Process files as they are uploaded: 27 # process scale: [200, 300] 28 process :resize_to_fill => [260, 520] 29 # 30 # def scale(width, height) 31 # # do something 32 # end 33 34 # Create different versions of your uploaded files: 35 version :thumb do 36 process resize_to_limit: [260, 260] 37 end 38 39 # Add a white list of extensions which are allowed to be uploaded. 40 # For images you might use something like this: 41 # def extension_whitelist 42 # %w(jpg jpeg gif png) 43 # end 44 45 # Override the filename of the uploaded files: 46 # Avoid using model.id or version_name here, see uploader/store.rb for details. 47 # def filename 48 # "something.jpg" if original_filename 49 # end 50 51 # 画像の横回転を防ぐ 52 # process :fix_rotate 53 # def fix_rotate 54 # manipulate! do |img| 55 # img = img.auto_orient 56 # img = yield(img) if block_given? 57 # img 58 # end 59 # end 60 61end

carrierwave.rb

ruby

1require 'carrierwave/storage/abstract' 2require 'carrierwave/storage/file' 3require 'carrierwave/storage/fog' 4 5CarrierWave.configure do |config| 6 config.storage = :fog 7 config.fog_credentials = { 8 provider: 'AWS', 9 aws_access_key_id: ENV['ACCESS_KEY_ID'], 10 aws_secret_access_key: ENV['SECRET_ACCESS_KEY'], 11 region: 'us-east-1' 12 } 13 14 case Rails.env 15 when 'development' 16 config.fog_directory = 'バケット名を入れてます' 17 config.asset_host = 'https://s3.amazonaws.com/バケット名を入れてます' 18 when 'production' 19 config.fog_directory = 'バケット名を入れてます' 20 config.asset_host = 'https://s3.amazonaws.com/バケット名を入れてます' 21 end 22end

ターミナルでの入力
$ git add -u
$ git commit -m "update tweets_controller"
$ git push heorku

イメージ説明

herokuにてログを確認したところ、以下のような情報が記載されていました。

2017-12-13T04:26:51.641909+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-13T04:26:58.349220+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=thawing-wildwood-67353.herokuapp.com request_id=7aa35eaf-3483-4b4e-a312-eb49073d55b5 fwd="221.113.38.150" dyno= connect= service= status=503 bytes= protocol=https

これはどういったエラーになりますでしょうか。
ご教示いただけますと幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

$ git add config/initializers/carrierwave.rb
$ git commit -m "add carrierwave.rb]
$ git push heroku master

これで無事アプリケーションエラーを解決することができました。

これまで自分はgit add -uで変更を加えたファイルしかプッシュできていなかったため、それまでプッシュしていなかったcarrierwave.rbがエラーの原因になっていました。

私の知識不足が招いたエラーということでした。
お騒がせいたしました。

投稿2017/12/13 05:41

graphic-ocean

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問