質問編集履歴
2
mailer.rbの中身追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -124,5 +124,37 @@
|
|
124
124
|
|
125
125
|
省略
|
126
126
|
```
|
127
|
+
|
128
|
+
mailer.rb
|
129
|
+
```
|
130
|
+
if defined?(ActionMailer)
|
131
|
+
class Devise::Mailer < Devise.parent_mailer.constantize
|
132
|
+
include Devise::Mailers::Helpers
|
133
|
+
|
134
|
+
def confirmation_instructions(record, token, opts = {})
|
135
|
+
@token = token
|
136
|
+
devise_mail(record, :confirmation_instructions, opts)
|
137
|
+
end
|
138
|
+
|
139
|
+
def reset_password_instructions(record, token, opts = {})
|
140
|
+
@token = token
|
141
|
+
devise_mail(record, :reset_password_instructions, opts)
|
142
|
+
end
|
143
|
+
|
144
|
+
def unlock_instructions(record, token, opts = {})
|
145
|
+
@token = token
|
146
|
+
devise_mail(record, :unlock_instructions, opts)
|
147
|
+
end
|
148
|
+
|
149
|
+
def email_changed(record, opts = {})
|
150
|
+
devise_mail(record, :email_changed, opts)
|
151
|
+
end
|
152
|
+
|
153
|
+
def password_change(record, opts = {})
|
154
|
+
devise_mail(record, :password_change, opts)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
```
|
127
|
-
Devise::
|
159
|
+
Devise::Mailerが定義されないため止まっていると書いてありますが、定義するにはどうすればいいんでしょうか・・・。
|
128
160
|
お力添えいただける方がいましたらよろしくお願い致します!
|
1
unicorn.brの追加。タイトルの変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
【Rails】unicornの起動ができない。
|
body
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
unicorn
|
3
|
+
unicornの起動をしたい。
|
4
|
+
|
4
5
|
####環境
|
5
6
|
MacOS Catalina 10.15.7
|
6
7
|
ruby on rails 6.0.3.4
|
@@ -17,7 +18,65 @@
|
|
17
18
|
master failed to start, check stderr log for details
|
18
19
|
|
19
20
|
```
|
21
|
+
###ファイル等
|
22
|
+
```ruby:unicorn.rb
|
23
|
+
#サーバ上でのアプリケーションコードが設置されているディレクトリを変数に入れておく
|
24
|
+
app_path = File.expand_path('../../', __FILE__)
|
20
25
|
|
26
|
+
#アプリケーションサーバの性能を決定する
|
27
|
+
worker_processes 1
|
28
|
+
|
29
|
+
#アプリケーションの設置されているディレクトリを指定
|
30
|
+
working_directory app_path
|
31
|
+
|
32
|
+
#Unicornの起動に必要なファイルの設置場所を指定
|
33
|
+
pid "#{app_path}/tmp/pids/unicorn.pid"
|
34
|
+
|
35
|
+
#ポート番号を指定
|
36
|
+
listen 3000
|
37
|
+
|
38
|
+
#エラーのログを記録するファイルを指定
|
39
|
+
stderr_path "#{app_path}/log/unicorn.stderr.log"
|
40
|
+
|
41
|
+
#通常のログを記録するファイルを指定
|
42
|
+
stdout_path "#{app_path}/log/unicorn.stdout.log"
|
43
|
+
|
44
|
+
#Railsアプリケーションの応答を待つ上限時間を設定
|
45
|
+
timeout 60
|
46
|
+
|
47
|
+
#以下は応用的な設定なので説明は割愛
|
48
|
+
|
49
|
+
preload_app true
|
50
|
+
GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true
|
51
|
+
|
52
|
+
check_client_connection false
|
53
|
+
|
54
|
+
run_once = true
|
55
|
+
|
56
|
+
before_fork do |server, worker|
|
57
|
+
defined?(ActiveRecord::Base) &&
|
58
|
+
ActiveRecord::Base.connection.disconnect!
|
59
|
+
|
60
|
+
if run_once
|
61
|
+
run_once = false # prevent from firing again
|
62
|
+
end
|
63
|
+
|
64
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
65
|
+
if File.exist?(old_pid) && server.pid != old_pid
|
66
|
+
begin
|
67
|
+
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
|
68
|
+
Process.kill(sig, File.read(old_pid).to_i)
|
69
|
+
rescue Errno::ENOENT, Errno::ESRCH => e
|
70
|
+
logger.error e
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
after_fork do |_server, _worker|
|
76
|
+
defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
21
80
|
### 試したこと
|
22
81
|
エラーメッセージを表示しようとコマンド入力
|
23
82
|
```
|