質問編集履歴
8
unicorn.logの内容修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -310,19 +310,23 @@
|
|
310
310
|
|
311
311
|
```
|
312
312
|
|
313
|
-
I, [2020-11-25T
|
313
|
+
I, [2020-11-25T09:48:41.677152 #16516] INFO -- : Refreshing Gem list
|
314
|
-
|
314
|
+
|
315
|
-
I, [2020-11-25T
|
315
|
+
I, [2020-11-25T09:48:42.436156 #16516] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
|
316
|
-
|
316
|
+
|
317
|
-
I, [2020-11-25T
|
317
|
+
I, [2020-11-25T09:48:42.436349 #16516] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
|
318
|
-
|
318
|
+
|
319
|
-
I, [2020-11-25T
|
319
|
+
I, [2020-11-25T09:48:42.469695 #16516] INFO -- : master process ready
|
320
|
+
|
320
|
-
|
321
|
+
I, [2020-11-25T09:48:42.477058 #16520] INFO -- : worker=1 ready
|
322
|
+
|
323
|
+
I, [2020-11-25T09:48:42.478356 #16519] INFO -- : worker=0 ready
|
324
|
+
|
321
|
-
I, [2020-11-25T
|
325
|
+
I, [2020-11-25T09:48:42.583104 #16516] INFO -- : reaped #<Process::Status: pid 16519 exit 0> worker=0
|
322
|
-
|
326
|
+
|
323
|
-
I, [2020-11-25T
|
327
|
+
I, [2020-11-25T09:48:42.583221 #16516] INFO -- : reaped #<Process::Status: pid 16520 exit 0> worker=1
|
324
|
-
|
328
|
+
|
325
|
-
I, [2020-11-25T
|
329
|
+
I, [2020-11-25T09:48:42.583295 #16516] INFO -- : master complete
|
326
330
|
|
327
331
|
```
|
328
332
|
|
7
試したこと#2のunicon.logを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -306,6 +306,28 @@
|
|
306
306
|
|
307
307
|
|
308
308
|
|
309
|
+
unicorn.logの内容は以下の通り。
|
310
|
+
|
311
|
+
```
|
312
|
+
|
313
|
+
I, [2020-11-25T13:44:56.917052 #21248] INFO -- : Refreshing Gem list
|
314
|
+
|
315
|
+
I, [2020-11-25T13:44:57.628510 #21248] INFO -- : unlinking existing socket=/var/www/rails/myapp/tmp/sockets/.unicorn.sock
|
316
|
+
|
317
|
+
I, [2020-11-25T13:44:57.628675 #21248] INFO -- : listening on addr=/var/www/rails/myapp/tmp/sockets/.unicorn.sock fd=9
|
318
|
+
|
319
|
+
I, [2020-11-25T13:44:57.681889 #21248] INFO -- : master process ready
|
320
|
+
|
321
|
+
I, [2020-11-25T13:44:57.788457 #21248] INFO -- : reaped #<Process::Status: pid 21251 exit 0> worker=0
|
322
|
+
|
323
|
+
I, [2020-11-25T13:44:57.788555 #21248] INFO -- : reaped #<Process::Status: pid 21252 exit 0> worker=1
|
324
|
+
|
325
|
+
I, [2020-11-25T13:44:57.788628 #21248] INFO -- : master complete
|
326
|
+
|
327
|
+
```
|
328
|
+
|
329
|
+
|
330
|
+
|
309
331
|
###試したこと#3
|
310
332
|
|
311
333
|
ExecStartのパスを/bin/bashからワーキングディレクトリ(/var/www/rails/myapp)に変更して実行。
|
6
試したこと#3を修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -330,7 +330,7 @@
|
|
330
330
|
|
331
331
|
|
332
332
|
|
333
|
-
ExecStart=/var/www/rails/my
|
333
|
+
ExecStart=/var/www/rails/myapp 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
334
334
|
|
335
335
|
|
336
336
|
|
5
試したこと#3を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -303,3 +303,57 @@
|
|
303
303
|
11月 25 11:23:00 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
304
304
|
|
305
305
|
```
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
###試したこと#3
|
310
|
+
|
311
|
+
ExecStartのパスを/bin/bashからワーキングディレクトリ(/var/www/rails/myapp)に変更して実行。
|
312
|
+
|
313
|
+
```
|
314
|
+
|
315
|
+
[Unit]
|
316
|
+
|
317
|
+
Description=The unicorn process
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
[Service]
|
322
|
+
|
323
|
+
User=myname
|
324
|
+
|
325
|
+
WorkingDirectory=/var/www/rails/myapp
|
326
|
+
|
327
|
+
SyslogIdentifier=unicorn
|
328
|
+
|
329
|
+
Type=simple
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
ExecStart=/var/www/rails/myspp 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
[Install]
|
338
|
+
|
339
|
+
WantedBy=multi-user.target
|
340
|
+
|
341
|
+
```
|
342
|
+
|
343
|
+
権限エラー発生してしまう。
|
344
|
+
|
345
|
+
```
|
346
|
+
|
347
|
+
systemd[19988]: Failed at step EXEC spawning /var/www/rails/myapp: Permission denied
|
348
|
+
|
349
|
+
```
|
350
|
+
|
351
|
+
コマンドラインから、同ディレクトリ・同コマンドを入力してUnicornが起動することは確認済みにも関わらず、上記エラーが発生してしまう。
|
352
|
+
|
353
|
+
なお、同ディレクトリには実行権限が付与されていることも確認済みであり、エラー発生原因が不明。
|
354
|
+
|
355
|
+
```
|
356
|
+
|
357
|
+
drwxrwxr-x 15 myname myname 4096 11月 3 13:12 myapp
|
358
|
+
|
359
|
+
```
|
4
試したこと#2を追記。
test
CHANGED
File without changes
|
test
CHANGED
@@ -134,7 +134,7 @@
|
|
134
134
|
|
135
135
|
|
136
136
|
|
137
|
-
###試したこと
|
137
|
+
###試したこと#1
|
138
138
|
|
139
139
|
環境変数を使用せず、unicornの再起動は実施しないようunicorn.serviceファイルを以下の通り変更。
|
140
140
|
|
@@ -231,3 +231,75 @@
|
|
231
231
|
|
232
232
|
|
233
233
|
```
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
###試したこと#2
|
238
|
+
|
239
|
+
unicorn.serviceファイルにおいて、依存関係や、ExecStop、 ExecReloadを削除し、ExecStartのみのシンプルな内容で実行。
|
240
|
+
|
241
|
+
```
|
242
|
+
|
243
|
+
[Unit]
|
244
|
+
|
245
|
+
Description=The unicorn process
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
[Service]
|
250
|
+
|
251
|
+
User=myname
|
252
|
+
|
253
|
+
WorkingDirectory=/var/www/rails/myapp
|
254
|
+
|
255
|
+
SyslogIdentifier=unicorn
|
256
|
+
|
257
|
+
Type=simple
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
ExecStart=/bin/bash -l -c 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
[Install]
|
266
|
+
|
267
|
+
WantedBy=multi-user.target
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
これまでと異なるログを得られたが、依然としてUnicronは起動せず、原因不明。
|
274
|
+
|
275
|
+
```
|
276
|
+
|
277
|
+
● unicorn.service - The unicorn process
|
278
|
+
|
279
|
+
Loaded: loaded (/etc/systemd/system/unicorn.service; disabled; vendor preset: disabled)
|
280
|
+
|
281
|
+
Active: inactive (dead)
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
11月 25 09:48:40 xxx.compute.internal systemd[1]: Started The unicorn process.
|
286
|
+
|
287
|
+
11月 25 09:48:40 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
288
|
+
|
289
|
+
11月 25 09:48:42 xxx.compute.internal unicorn[16521]: kill: not enough arguments
|
290
|
+
|
291
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: unicorn.service: control process exited, code=exited status=1
|
292
|
+
|
293
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: Unit unicorn.service entered failed state.
|
294
|
+
|
295
|
+
11月 25 09:48:42 xxx.compute.internal systemd[1]: unicorn.service failed.
|
296
|
+
|
297
|
+
11月 25 10:04:26 xxx.compute.internal systemd[1]: Started The unicorn process.
|
298
|
+
|
299
|
+
11月 25 10:04:26 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
300
|
+
|
301
|
+
11月 25 11:23:00 xxx.compute.internal systemd[1]: Started The unicorn process.
|
302
|
+
|
303
|
+
11月 25 11:23:00 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
304
|
+
|
305
|
+
```
|
3
ジャーナルを追記。
test
CHANGED
File without changes
|
test
CHANGED
@@ -211,3 +211,23 @@
|
|
211
211
|
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service failed.
|
212
212
|
|
213
213
|
```
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
unicorn.serviceのジャーナル。
|
218
|
+
|
219
|
+
```
|
220
|
+
|
221
|
+
(・・・中略・・・)
|
222
|
+
|
223
|
+
11月 20 10:44:15 xxx.compute.internal unicorn[5569]: kill: not enough arguments
|
224
|
+
|
225
|
+
11月 20 10:44:17 xxx.compute.internal unicorn[5972]: kill: not enough arguments
|
226
|
+
|
227
|
+
11月 20 11:23:04 xxx.compute.internal unicorn[6590]: kill: not enough arguments
|
228
|
+
|
229
|
+
11月 25 09:48:42 xxx.compute.internal unicorn[16521]: kill: not enough arguments
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
```
|
2
試したことを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -131,3 +131,83 @@
|
|
131
131
|
|
132
132
|
|
133
133
|
※前提として、systemdを使わず、ワーキングディレクトリで直接`bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -D -E production`コマンドを入力し、Unicornが起動することは確認済みです。
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
###試したこと
|
138
|
+
|
139
|
+
環境変数を使用せず、unicornの再起動は実施しないようunicorn.serviceファイルを以下の通り変更。
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
[Unit]
|
146
|
+
|
147
|
+
Description=The unicorn process
|
148
|
+
|
149
|
+
After=network.target remote-fs.target nss-lookup.target
|
150
|
+
|
151
|
+
Before=nginx.service
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
[Service]
|
156
|
+
|
157
|
+
User=myname
|
158
|
+
|
159
|
+
WorkingDirectory=/var/www/rails/myapp
|
160
|
+
|
161
|
+
SyslogIdentifier=unicorn
|
162
|
+
|
163
|
+
Type=simple
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
ExecStart=/bin/bash -l -c 'bundle exec unicorn_rails -c /var/www/rails/myapp/config/unicorn.conf.rb -E production -D'
|
168
|
+
|
169
|
+
ExecStop=/usr/bin/kill -QUIT $MAINPID
|
170
|
+
|
171
|
+
ExecReload=/usr/bin/kill -USR2 $MAINPID
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
[Install]
|
176
|
+
|
177
|
+
WantedBy=multi-user.target
|
178
|
+
|
179
|
+
```
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
実行したところ、Unicornは起動せず、ログは以下の通り。
|
184
|
+
|
185
|
+
```lang-text
|
186
|
+
|
187
|
+
● unicorn.service - The unicorn process
|
188
|
+
|
189
|
+
Loaded: loaded (/etc/systemd/system/unicorn.service; disabled; vendor preset: disabled)
|
190
|
+
|
191
|
+
Active: failed (Result: exit-code) since 金 2020-11-20 11:23:04 JST; 36s ago
|
192
|
+
|
193
|
+
Process: 6590 ExecStop=/usr/bin/kill -QUIT $MAINPID (code=exited, status=1/FAILURE)
|
194
|
+
|
195
|
+
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)
|
196
|
+
|
197
|
+
Main PID: 6190 (code=exited, status=0/SUCCESS)
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
11月 20 11:23:03 xxx.compute.internal systemd[1]: Started The unicorn process.
|
202
|
+
|
203
|
+
11月 20 11:23:03 xxx.compute.internal systemd[1]: Starting The unicorn process...
|
204
|
+
|
205
|
+
11月 20 11:23:04 xxx.compute.internal unicorn[6590]: kill: not enough arguments
|
206
|
+
|
207
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service: control process exited, code=exited status=1
|
208
|
+
|
209
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: Unit unicorn.service entered failed state.
|
210
|
+
|
211
|
+
11月 20 11:23:04 xxx.compute.internal systemd[1]: unicorn.service failed.
|
212
|
+
|
213
|
+
```
|
1
初心者マーク
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Amazon Linux2
|
1
|
+
Amazon Linux2で、systemdを使ってUnicornを起動したい
|
test
CHANGED
File without changes
|