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; } }
原因が分かる方いらっしゃいませんか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。