質問編集履歴
1
試したことに『EC2を再起動』追記。関連ファイル追記。環境追記。
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,13 +22,11 @@
|
|
22
22
|
SyntaxError: /var/www/rails/coffee_app/config/unicorn.conf.rb:29: syntax error, unexpected keyword_end, expecting end-of-input
|
23
23
|
```
|
24
24
|
エラー文としては`unicorn.conf.rb`で`end`が多いという指摘をもらっているのですが、
|
25
|
-
`end`の数は
|
25
|
+
`end`の数は合っている認識です。
|
26
26
|
|
27
|
-
#unicorn.conf.rb
|
27
|
+
####unicorn.conf.rb
|
28
28
|
|
29
29
|
```
|
30
|
-
#以下を記述:合計1箇所変更点があります
|
31
|
-
# set lets
|
32
30
|
$worker = 2
|
33
31
|
$timeout = 30
|
34
32
|
$app_dir = "/var/www/rails/coffee_app”
|
@@ -62,7 +60,7 @@
|
|
62
60
|
```
|
63
61
|
|
64
62
|
#試したこと
|
65
|
-
###
|
63
|
+
###endを1つ無くす
|
66
64
|
別のエラーが発生しました。
|
67
65
|
|
68
66
|
```
|
@@ -75,4 +73,46 @@
|
|
75
73
|
:
|
76
74
|
/home/ryouya/.rbenv/versions/2.5.1/bin/unicorn_rails:23:in `<top (required)>'
|
77
75
|
master failed to start, check stderr log for details
|
78
|
-
```
|
76
|
+
```
|
77
|
+
###EC2を再起動
|
78
|
+
問題解決にはなりませんでした。
|
79
|
+
|
80
|
+
#関連ファイル
|
81
|
+
####unicorn.conf.rb
|
82
|
+
|
83
|
+
```
|
84
|
+
$worker = 2
|
85
|
+
$timeout = 30
|
86
|
+
$app_dir = "/var/www/rails/coffee_app”
|
87
|
+
$listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
|
88
|
+
$pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
|
89
|
+
$std_log = File.expand_path 'log/unicorn.log', $app_dir
|
90
|
+
# set config
|
91
|
+
worker_processes $worker
|
92
|
+
working_directory $app_dir
|
93
|
+
stderr_path $std_log
|
94
|
+
stdout_path $std_log
|
95
|
+
timeout $timeout
|
96
|
+
listen $listen
|
97
|
+
pid $pid
|
98
|
+
# loading booster
|
99
|
+
preload_app true
|
100
|
+
# before starting processes
|
101
|
+
before_fork do |server, worker|
|
102
|
+
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
|
103
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
104
|
+
if old_pid != server.pid
|
105
|
+
begin
|
106
|
+
Process.kill "QUIT", File.read(old_pid).to_i
|
107
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
after_fork do |server, worker|
|
112
|
+
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
#環境
|
117
|
+
ruby 2.5.1
|
118
|
+
rails 5.1.6
|