質問編集履歴
8
unicorn.logの内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -154,13 +154,15 @@
|
|
154
154
|
|
155
155
|
unicorn.logの内容は以下の通り。
|
156
156
|
```
|
157
|
-
I, [2020-11-
|
157
|
+
I, [2020-11-25T09:48:41.677152 #16516] INFO -- : Refreshing Gem list
|
158
|
-
I, [2020-11-
|
158
|
+
I, [2020-11-25T09:48:42.436156 #16516] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
|
159
|
-
I, [2020-11-
|
159
|
+
I, [2020-11-25T09:48:42.436349 #16516] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
|
160
|
-
I, [2020-11-
|
160
|
+
I, [2020-11-25T09:48:42.469695 #16516] INFO -- : master process ready
|
161
|
+
I, [2020-11-25T09:48:42.477058 #16520] INFO -- : worker=1 ready
|
162
|
+
I, [2020-11-25T09:48:42.478356 #16519] INFO -- : worker=0 ready
|
161
|
-
I, [2020-11-
|
163
|
+
I, [2020-11-25T09:48:42.583104 #16516] INFO -- : reaped #<Process::Status: pid 16519 exit 0> worker=0
|
162
|
-
I, [2020-11-
|
164
|
+
I, [2020-11-25T09:48:42.583221 #16516] INFO -- : reaped #<Process::Status: pid 16520 exit 0> worker=1
|
163
|
-
I, [2020-11-
|
165
|
+
I, [2020-11-25T09:48:42.583295 #16516] INFO -- : master complete
|
164
166
|
```
|
165
167
|
|
166
168
|
###試したこと#3
|
7
試したこと#2のunicon.logを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -152,6 +152,17 @@
|
|
152
152
|
11月 25 11:23:00 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
153
153
|
```
|
154
154
|
|
155
|
+
unicorn.logの内容は以下の通り。
|
156
|
+
```
|
157
|
+
I, [2020-11-25T13:44:56.917052 #21248] INFO -- : Refreshing Gem list
|
158
|
+
I, [2020-11-25T13:44:57.628510 #21248] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
|
159
|
+
I, [2020-11-25T13:44:57.628675 #21248] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
|
160
|
+
I, [2020-11-25T13:44:57.681889 #21248] INFO -- : master process ready
|
161
|
+
I, [2020-11-25T13:44:57.788457 #21248] INFO -- : reaped #<Process::Status: pid 21251 exit 0> worker=0
|
162
|
+
I, [2020-11-25T13:44:57.788555 #21248] INFO -- : reaped #<Process::Status: pid 21252 exit 0> worker=1
|
163
|
+
I, [2020-11-25T13:44:57.788628 #21248] INFO -- : master complete
|
164
|
+
```
|
165
|
+
|
155
166
|
###試したこと#3
|
156
167
|
ExecStartのパスを/bin/bashからワーキングディレクトリ(/var/www/rails/myapp)に変更して実行。
|
157
168
|
```
|
6
試したこと#3を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -164,7 +164,7 @@
|
|
164
164
|
SyslogIdentifier=unicorn
|
165
165
|
Type=simple
|
166
166
|
|
167
|
-
ExecStart=/var/www/rails/
|
167
|
+
ExecStart=/var/www/rails/myapp 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
168
168
|
|
169
169
|
[Install]
|
170
170
|
WantedBy=multi-user.target
|
5
試したこと#3を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -150,4 +150,31 @@
|
|
150
150
|
11月 25 10:04:26 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
151
151
|
11月 25 11:23:00 xxx.compute.internal systemd[1]: Started The unicorn process.
|
152
152
|
11月 25 11:23:00 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
153
|
+
```
|
154
|
+
|
155
|
+
###試したこと#3
|
156
|
+
ExecStartのパスを/bin/bashからワーキングディレクトリ(/var/www/rails/myapp)に変更して実行。
|
157
|
+
```
|
158
|
+
[Unit]
|
159
|
+
Description=The unicorn process
|
160
|
+
|
161
|
+
[Service]
|
162
|
+
User=myname
|
163
|
+
WorkingDirectory=/var/www/rails/myapp
|
164
|
+
SyslogIdentifier=unicorn
|
165
|
+
Type=simple
|
166
|
+
|
167
|
+
ExecStart=/var/www/rails/myspp 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
168
|
+
|
169
|
+
[Install]
|
170
|
+
WantedBy=multi-user.target
|
171
|
+
```
|
172
|
+
権限エラー発生してしまう。
|
173
|
+
```
|
174
|
+
systemd[19988]: Failed at step EXEC spawning /var/www/rails/myapp: Permission denied
|
175
|
+
```
|
176
|
+
コマンドラインから、同ディレクトリ・同コマンドを入力してUnicornが起動することは確認済みにも関わらず、上記エラーが発生してしまう。
|
177
|
+
なお、同ディレクトリには実行権限が付与されていることも確認済みであり、エラー発生原因が不明。
|
178
|
+
```
|
179
|
+
drwxrwxr-x 15 myname myname 4096 11月 3 13:12 myapp
|
153
180
|
```
|
4
試したこと#2を追記。
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
※前提として、systemdを使わず、ワーキングディレクトリで直接`bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -D -E production`コマンドを入力し、Unicornが起動することは確認済みです。
|
68
68
|
|
69
|
-
###試したこと
|
69
|
+
###試したこと#1
|
70
70
|
環境変数を使用せず、unicornの再起動は実施しないようunicorn.serviceファイルを以下の通り変更。
|
71
71
|
|
72
72
|
```
|
@@ -114,4 +114,40 @@
|
|
114
114
|
11月 20 11:23:04 xxx.compute.internal unicorn[6590]: kill: not enough arguments
|
115
115
|
11月 25 09:48:42 xxx.compute.internal unicorn[16521]: kill: not enough arguments
|
116
116
|
|
117
|
+
```
|
118
|
+
|
119
|
+
###試したこと#2
|
120
|
+
unicorn.serviceファイルにおいて、依存関係や、ExecStop、 ExecReloadを削除し、ExecStartのみのシンプルな内容で実行。
|
121
|
+
```
|
122
|
+
[Unit]
|
123
|
+
Description=The unicorn process
|
124
|
+
|
125
|
+
[Service]
|
126
|
+
User=myname
|
127
|
+
WorkingDirectory=/var/www/rails/myapp
|
128
|
+
SyslogIdentifier=unicorn
|
129
|
+
Type=simple
|
130
|
+
|
131
|
+
ExecStart=/bin/bash -l -c 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
132
|
+
|
133
|
+
[Install]
|
134
|
+
WantedBy=multi-user.target
|
135
|
+
```
|
136
|
+
|
137
|
+
これまでと異なるログを得られたが、依然としてUnicronは起動せず、原因不明。
|
138
|
+
```
|
139
|
+
● unicorn.service - The unicorn process
|
140
|
+
Loaded: loaded (/etc/systemd/system/unicorn.service; disabled; vendor preset: disabled)
|
141
|
+
Active: inactive (dead)
|
142
|
+
|
143
|
+
11月 25 09:48:40 xxx.compute.internal systemd[1]: Started The unicorn process.
|
144
|
+
11月 25 09:48:40 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
145
|
+
11月 25 09:48:42 xxx.compute.internal unicorn[16521]: kill: not enough arguments
|
146
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: unicorn.service: control process exited, code=exited status=1
|
147
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: Unit unicorn.service entered failed state.
|
148
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: unicorn.service failed.
|
149
|
+
11月 25 10:04:26 xxx.compute.internal systemd[1]: Started The unicorn process.
|
150
|
+
11月 25 10:04:26 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
151
|
+
11月 25 11:23:00 xxx.compute.internal systemd[1]: Started The unicorn process.
|
152
|
+
11月 25 11:23:00 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
117
153
|
```
|
3
ジャーナルを追記。
title
CHANGED
File without changes
|
body
CHANGED
@@ -104,4 +104,14 @@
|
|
104
104
|
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service: control process exited, code=exited status=1
|
105
105
|
11月 20 11:23:04 xxx.compute.internal systemd[1]: Unit unicorn.service entered failed state.
|
106
106
|
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service failed.
|
107
|
+
```
|
108
|
+
|
109
|
+
unicorn.serviceのジャーナル。
|
110
|
+
```
|
111
|
+
(・・・中略・・・)
|
112
|
+
11月 20 10:44:15 xxx.compute.internal unicorn[5569]: kill: not enough arguments
|
113
|
+
11月 20 10:44:17 xxx.compute.internal unicorn[5972]: kill: not enough arguments
|
114
|
+
11月 20 11:23:04 xxx.compute.internal unicorn[6590]: kill: not enough arguments
|
115
|
+
11月 25 09:48:42 xxx.compute.internal unicorn[16521]: kill: not enough arguments
|
116
|
+
|
107
117
|
```
|
2
試したことを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,4 +64,44 @@
|
|
64
64
|
ログから、ExecStop=/usr/bin/kill -QUIT $MAINPID (code=exited, status=1/FAILURE)で失敗していると思われますが、原因や対応方法が分からず困っております。
|
65
65
|
ご支援のほど、よろしくお願いいたします。
|
66
66
|
|
67
|
-
※前提として、systemdを使わず、ワーキングディレクトリで直接`bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -D -E production`コマンドを入力し、Unicornが起動することは確認済みです。
|
67
|
+
※前提として、systemdを使わず、ワーキングディレクトリで直接`bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -D -E production`コマンドを入力し、Unicornが起動することは確認済みです。
|
68
|
+
|
69
|
+
###試したこと
|
70
|
+
環境変数を使用せず、unicornの再起動は実施しないようunicorn.serviceファイルを以下の通り変更。
|
71
|
+
|
72
|
+
```
|
73
|
+
[Unit]
|
74
|
+
Description=The unicorn process
|
75
|
+
After=network.target remote-fs.target nss-lookup.target
|
76
|
+
Before=nginx.service
|
77
|
+
|
78
|
+
[Service]
|
79
|
+
User=myname
|
80
|
+
WorkingDirectory=/var/www/rails/myapp
|
81
|
+
SyslogIdentifier=unicorn
|
82
|
+
Type=simple
|
83
|
+
|
84
|
+
ExecStart=/bin/bash -l -c 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
85
|
+
ExecStop=/usr/bin/kill -QUIT $MAINPID
|
86
|
+
ExecReload=/usr/bin/kill -USR2 $MAINPID
|
87
|
+
|
88
|
+
[Install]
|
89
|
+
WantedBy=multi-user.target
|
90
|
+
```
|
91
|
+
|
92
|
+
実行したところ、Unicornは起動せず、ログは以下の通り。
|
93
|
+
```lang-text
|
94
|
+
● unicorn.service - The unicorn process
|
95
|
+
Loaded: loaded (/etc/systemd/system/unicorn.service; disabled; vendor preset: disabled)
|
96
|
+
Active: failed (Result: exit-code) since 金 2020-11-20 11:23:04 JST; 36s ago
|
97
|
+
Process: 6590 ExecStop=/usr/bin/kill -QUIT $MAINPID (code=exited, status=1/FAILURE)
|
98
|
+
Process: 6190 ExecStart=/bin/bash -l -c bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D (code=exited, status=0/SUCCESS)
|
99
|
+
Main PID: 6190 (code=exited, status=0/SUCCESS)
|
100
|
+
|
101
|
+
11月 20 11:23:03 xxx.compute.internal systemd[1]: Started The unicorn process.
|
102
|
+
11月 20 11:23:03 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
103
|
+
11月 20 11:23:04 xxx.compute.internal unicorn[6590]: kill: not enough arguments
|
104
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service: control process exited, code=exited status=1
|
105
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: Unit unicorn.service entered failed state.
|
106
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service failed.
|
107
|
+
```
|
1
初心者マーク
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Amazon Linux2
|
1
|
+
Amazon Linux2で、systemdを使ってUnicornを起動したい
|
body
CHANGED
File without changes
|