質問編集履歴

1

説明文の誤字を直しました

2020/11/01 07:11

投稿

kai
kai

スコア92

test CHANGED
@@ -1 +1 @@
1
- AWSデプロイ中 Unicornが起動できません
1
+ bundler: failed to load command: unicorn_railsとエラーが出てUnicornが起動できません
test CHANGED
@@ -1,173 +1,125 @@
1
- AWSでデプロイ作業中なのですが初めて下記のリンクを参考にしした[参考記事](https://hackmd.io/4_1NYUTBSaSsOC8cur7WhA?view)
1
+ 初めてAWSでデプロイをしているのですが、unicornの起動がせん
2
2
 
3
+ ログを見ても解決方法がわかりません。
4
+
5
+ 環境
6
+
7
+  Ruby 2.7.1
8
+
9
+ Rails 6.0.3
10
+
3
- ですがUnicornの起動ができずデプロイできないでいます。
11
+ Unicorn 5.7.0
12
+
13
+ お力を貸していただけると嬉しいです。
14
+
15
+ ```ここに言語を入力
16
+
17
+ $bundle exec unicorn_rails -c /var/www/rails/アプリ名l/config/unicorn.conf.rb -D -E production
4
18
 
5
19
 
6
20
 
7
- ```ここに言語を入力
8
-
9
- #nginxの設定
10
-
11
- error_log /var/www/rails/アプリ名/log/nginx.error.log;
12
-
13
- access_log /var/www/rails/アプリ名/log/nginx.access.log;
14
-
15
-
16
-
17
- upstream unicorn_server {
18
-
19
- server unix:/var/www/rails/アプリ名e/tmp/sockets/.unicorn.sock fail_timeout=0;
20
-
21
- }
22
-
23
-
24
-
25
- server {
26
-
27
- listen 80;
28
-
29
- client_max_body_size 4G;
30
-
31
- server_name 52.23.9.110;
32
-
33
-
34
-
35
- keepalive_timeout 5;
36
-
37
-
38
-
39
- # Location of our static files
40
-
41
- root /var/www/rails/アプリ名/public;
42
-
43
-
44
-
45
- location ~ ^/assets/ {
46
-
47
- root /var/www/rails/アプリ名/public;
48
-
49
- }
50
-
51
-
52
-
53
- location / {
54
-
55
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
56
-
57
- proxy_set_header Host $http_host;
58
-
59
- proxy_redirect off;
60
-
61
-
62
-
63
- if (!-f $request_filename) {
64
-
65
- proxy_pass http://unicorn_server;
66
-
67
- break;
68
-
69
- }
70
-
71
- }
72
-
73
-
74
-
75
- error_page 500 502 503 504 /500.html;
76
-
77
- location = /500.html {
78
-
79
- root /var/www/rails/アプリ名/public;
80
-
81
- }
82
-
83
- }
84
-
85
- ```
86
-
87
-
88
-
89
- ```ここに言語を入力
90
-
91
- #unicornの設定
92
-
93
- $worker = 2
94
-
95
- $timeout = 30
96
-
97
- $app_dir = "/var/www/rails/アプリ名"
98
-
99
- $listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
100
-
101
- $pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
102
-
103
- $std_log = File.expand_path 'log/unicorn.log', $app_dir
104
-
105
- # set config
106
-
107
- worker_processes $worker
108
-
109
- working_directory $app_dir
110
-
111
- stderr_path $std_log
112
-
113
- stdout_path $std_log
114
-
115
- timeout $timeout
116
-
117
- listen $listen
118
-
119
- pid $pid
120
-
121
- # loading booster
122
-
123
- preload_app true
124
-
125
- # before starting processes
126
-
127
- before_fork do |server, worker|
128
-
129
- defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
130
-
131
- old_pid = "#{server.config[:pid]}.oldbin"
132
-
133
- if old_pid != server.pid
134
-
135
- begin
136
-
137
- Process.kill "QUIT", File.read(old_pid).to_i
138
-
139
- rescue Errno::ENOENT, Errno::ESRCH
140
-
141
- end
142
-
143
- end
144
-
145
- end
146
-
147
- # after finishing processes
148
-
149
- after_fork do |server, worker|
150
-
151
- defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
21
+ I, [2020-11-01T06:59:24.017597 #13245] INFO -- : Refreshing Gem list
152
-
153
- end
154
-
155
- ```
156
-
157
- 参考記事の通りに記述しているのですがunicornの起動コマンドを打つと
158
-
159
- master failed to start, check stderr log for details
160
-
161
- となります。
162
-
163
- ```ここに言語を入力
164
-
165
- #ログ
166
22
 
167
23
  bundler: failed to load command: unicorn_rails (/home/ec2-user/.rbenv/versions/2.7.1/bin/unicorn_rails)
168
24
 
169
25
  NoMethodError: undefined method `join' for nil:NilClass
170
26
 
27
+ /var/www/rails/smile-mail/app/models/message.rb:2:in `<class:Message>'
28
+
29
+ /var/www/rails/smile-mail/app/models/message.rb:1:in `<main>'
30
+
31
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
32
+
33
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
34
+
35
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
36
+
37
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
38
+
39
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
40
+
41
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:27:in `require'
42
+
43
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:392:in `const_get'
44
+
45
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:392:in `block (2 levels) in eager_load'
46
+
47
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:742:in `block in ls'
48
+
49
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:734:in `foreach'
50
+
51
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:734:in `ls'
52
+
53
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:387:in `block in eager_load'
54
+
55
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:376:in `synchronize'
56
+
57
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:376:in `eager_load'
58
+
59
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:494:in `each'
60
+
61
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:494:in `eager_load_all'
62
+
63
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/application/finisher.rb:122:in `block in <module:Finisher>'
64
+
65
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `instance_exec'
66
+
67
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:32:in `run'
68
+
69
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:61:in `block in run_initializers'
70
+
71
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
72
+
73
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
74
+
75
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
76
+
77
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
78
+
79
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:347:in `each'
80
+
81
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:347:in `call'
82
+
83
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
84
+
85
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
86
+
87
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
88
+
89
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/initializable.rb:60:in `run_initializers'
90
+
91
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.3/lib/rails/application.rb:363:in `initialize!'
92
+
93
+ /var/www/rails/smile-mail/config/environment.rb:5:in `<top (required)>'
94
+
95
+ config.ru:4:in `require_relative'
96
+
97
+ config.ru:4:in `block in <main>'
98
+
99
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
100
+
101
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
102
+
103
+ config.ru:1:in `new'
104
+
105
+ config.ru:1:in `<main>'
106
+
107
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/lib/unicorn.rb:54:in `eval'
108
+
109
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/lib/unicorn.rb:54:in `block in builder'
110
+
111
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/bin/unicorn_rails:139:in `block in rails_builder'
112
+
113
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/lib/unicorn/http_server.rb:822:in `build_app!'
114
+
115
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/lib/unicorn/http_server.rb:141:in `start'
116
+
117
+ /home/ec2-user/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/unicorn-5.7.0/bin/unicorn_rails:209:in `<top (required)>'
118
+
119
+ /home/ec2-user/.rbenv/versions/2.7.1/bin/unicorn_rails:23:in `load'
120
+
121
+ /home/ec2-user/.rbenv/versions/2.7.1/bin/unicorn_rails:23:in `<top (required)>'
122
+
171
123
  ```
172
124
 
173
- 何卒よろしくお願いいたします
125
+ 何卒よろしくお願いいたします