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

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

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

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

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

Amazon S3

Amazon S3 (Simple Storage Service)とはアマゾン・ウェブ・サービスが提供するオンラインストレージサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

1回答

1422閲覧

unicornが起動できない

majikadezou

総合スコア34

unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

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

Amazon S3

Amazon S3 (Simple Storage Service)とはアマゾン・ウェブ・サービスが提供するオンラインストレージサービスです。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2019/12/31 09:05

rails で作成したアプリをheroku からaws へ移行しようと試みているのですが、unicornの起動がうまくいかずエラーが出ます。

unicorn.log INFO -- : Refreshing Gem list /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/bullet-6.0.2/lib/bullet.rb:41: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/delegation.rb:171: warning: The called method `delegate' is defined here /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tzinfo-1.2.5/lib/tzinfo/ruby_core_support.rb:142: warning: Using the last argument as keyword parameters is deprecated /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tzinfo-1.2.5/lib/tzinfo/ruby_core_support.rb:142: warning: Using the last argument as keyword parameters is deprecated /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/stack.rb:37: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/ssl.rb:59: warning: The called method `initialize' is defined here /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.1/lib/active_record/store.rb:106: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activerecord-6.0.1/lib/active_record/store.rb:109: warning: The called method `store_accessor' is defined here bundler: failed to load command: unicorn_rails (/home/user/.rbenv/versions/2.7.0/bin/unicorn_rails) Aws::Sigv4::Errors::MissingCredentialsError: Cannot load `Rails.config.active_storage.service`: missing credentials, provide credentials with one of the following options: - :access_key_id and :secret_access_key - :credentials - :credentials_provider

maybe ** should be added to the call というエラーはコマンドを打つときに追加すれば良いのでしょうか。
Aws::Sigv4::Errors::MissingCredentialsError: の部分はawsS3に関するエラーかと思うのですが、herokuでデプロイしている段階では機能していたのですが。。。

unicornの設定ファイル # set lets $worker = 2 $timeout = 30 $app_dir = "/var/www/rails/hoge_app" $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir $std_log = File.expand_path 'log/unicorn.log', $app_dir # set config worker_processes $worker working_directory $app_dir stderr_path $std_log stdout_path $std_log timeout $timeout listen $listen pid $pid # loading booster preload_app true # before starting processes before_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! old_pid = "#{server.config[:pid]}.oldbin" if old_pid != server.pid begin Process.kill "QUIT", File.read(old_pid).to_i rescue Errno::ENOENT, Errno::ESRCH end end end # after finishing processes after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
nginxの設定ファイル # log directory error_log /var/www/rails/hoge_app/log/nginx.error.log; access_log /var/www/rails/hoge_app/log/nginx.access.log; # max body size client_max_body_size 2G; upstream app_server { # for UNIX domain socket setups server unix:/var/www/rails/hoge_app/tmp/sockets/.unicorn.sock fail_timeout=0; } server { listen 80; server_name ~~~.~~~.~~~.~~~;#アプリのElastic IP # nginx so increasing this is generally safe... keepalive_timeout 5; # path for static files root /var/www/rails/hoge_app/public; # page cache loading try_files $uri/index.html $uri.html $uri @app; location @app { # HTTP headers proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app_server; } # Rails error pages error_page 500 502 503 504 /500.html; location = /500.html { root /var/www/rails/hoge_app/public; } }

原因が分かる方いらっしゃいませんか?

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

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

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

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

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

guest

回答1

0

ベストアンサー

Aws::Sigv4::Errors::MissingCredentialsError

で検索すると実に様々な理由でcredentialが想定通りに渡っていないケースが出てきます。
その中の該当するケースがないか見てみてください。

考えてすぐ思いつくのは、サーバ上で別のCredentialを指定していないか、ということですね…。

投稿2019/12/31 11:49

yu_1985

総合スコア7447

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.47%

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

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

質問する

関連した質問