質問編集履歴

4

誤字

2021/07/19 15:29

投稿

asm_t
asm_t

スコア14

test CHANGED
File without changes
test CHANGED
@@ -228,7 +228,7 @@
228
228
 
229
229
 
230
230
 
231
- # 追
231
+ # 追
232
232
 
233
233
 
234
234
 

3

docker-compose.ymlの追加

2021/07/19 15:29

投稿

asm_t
asm_t

スコア14

test CHANGED
File without changes
test CHANGED
@@ -46,13 +46,13 @@
46
46
 
47
47
  ```
48
48
 
49
- [ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec find app/assets/ -type f -exec touch {} \;

49
+ [ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec find app/assets/ -type f -exec touch {} \;

50
-
50
+
51
- [ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec rails assets:clobber RAILS_ENV=production

51
+ [ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:clobber RAILS_ENV=production

52
52
 
53
53
  をしたあとで、
54
54
 
55
- [ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
55
+ [ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
56
56
 
57
57
  の実行。
58
58
 
@@ -110,7 +110,7 @@
110
110
 
111
111
  $ docker-compose exec app bash でコンテナ内を覗いてみる。
112
112
 
113
- root@7bde1a234794:/var/www/remote-work-space/public/packs/media/images
113
+ root@7bde1a234794:/var/www/アプリ名/public/packs/media/images
114
114
 
115
115
  上記の中にちゃんと画像ファイルが格納されておりました。
116
116
 
@@ -122,7 +122,7 @@
122
122
 
123
123
  $ docker-compose exec app bash でコンテナ内を覗いてみる。
124
124
 
125
- root@7bde1a234794:/var/www/remote-work-space/public/assets
125
+ root@7bde1a234794:/var/www/アプリ名/public/assets
126
126
 
127
127
  上記の中にcssファイルが格納されておりました。
128
128
 
@@ -244,9 +244,9 @@
244
244
 
245
245
  ```
246
246
 
247
- [ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
247
+ [ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
248
-
248
+
249
- Creating network "remote-work-space_default" with the default driver
249
+ Creating network "アプリ名_default" with the default driver
250
250
 
251
251
  yarn install v1.22.5
252
252
 
@@ -256,21 +256,21 @@
256
256
 
257
257
  Done in 0.91s.
258
258
 
259
- I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
259
+ I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/アプリ名/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
260
-
260
+
261
- I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
261
+ I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/アプリ名/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
262
-
262
+
263
- I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
263
+ I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/アプリ名/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
264
-
264
+
265
- I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
265
+ I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/アプリ名/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
266
-
266
+
267
- I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
267
+ I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/アプリ名/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
268
-
268
+
269
- I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
269
+ I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/アプリ名/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
270
270
 
271
271
  Compiling...
272
272
 
273
- Compiled all packs in /var/www/remote-work-space/public/packs
273
+ Compiled all packs in /var/www/アプリ名/public/packs
274
274
 
275
275
  DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
276
276
 
@@ -342,15 +342,15 @@
342
342
 
343
343
  [7] ./app/javascript/images/logo.png 100 bytes {0} [optional] [built]
344
344
 
345
- [8] ./app/javascript/images/map.png 99 bytes {0} [optional] [built]
345
+
346
-
347
- [9] ./app/javascript/images/map.index.png 105 bytes {0} [optional] [built]
346
+
348
-
349
- [10] ./app/javascript/images/post.show.png 105 bytes {0} [optional] [built]
350
-
351
- [11] ./app/javascript/images/programming.jpg 107 bytes {0} [optional] [built]
352
-
353
- [12] ./app/javascript/images/user.png 100 bytes {0} [optional] [built]
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
354
 
355
355
  [15] ./app/javascript/packs/application.js 776 bytes {0} [built]
356
356
 
@@ -434,6 +434,96 @@
434
434
 
435
435
 
436
436
 
437
+ #追記2
438
+
439
+ docker-compose.ymlの中身はこちらです。
440
+
441
+
442
+
443
+ ```
444
+
445
+ # docker-compose.yml
446
+
447
+ version: "3"
448
+
449
+ services:
450
+
451
+ app:
452
+
453
+ build:
454
+
455
+ context: .
456
+
457
+ env_file:
458
+
459
+ - ./environments/db.env
460
+
461
+ # command: bundle exec puma -C config/puma.rb
462
+
463
+ command: bundle exec rails server -e production
464
+
465
+ volumes:
466
+
467
+ - .:/var/www/アプリ名
468
+
469
+ - public-data:/var/www/アプリ名/public
470
+
471
+ - tmp-data:/var/www/アプリ名/tmp
472
+
473
+ - log-data:/var/www/アプリ名/log
474
+
475
+ # depends_on:
476
+
477
+ # - db
478
+
479
+ # db:
480
+
481
+ # image: mysql:5.7
482
+
483
+ # env_file:
484
+
485
+ # - ./environments/db.env
486
+
487
+ # volumes:
488
+
489
+ # - db-data:/var/lib/mysql
490
+
491
+ web:
492
+
493
+ build:
494
+
495
+ context: containers/nginx
496
+
497
+ volumes:
498
+
499
+ - ./nginx.conf:/etc/nginx/nginx.conf
500
+
501
+ - ./アプリ名.conf:/etc/nginx/conf.d/アプリ名.conf
502
+
503
+ - public-data:/var/www/アプリ名/public
504
+
505
+ - tmp-data:/var/www/アプリ名/tmp
506
+
507
+ ports:
508
+
509
+ - 80:80
510
+
511
+ depends_on:
512
+
513
+ - app
514
+
515
+ volumes:
516
+
517
+ public-data:
518
+
519
+ tmp-data:
520
+
521
+ log-data:
522
+
523
+ db-data:
524
+
525
+ ```
526
+
437
527
 
438
528
 
439
529
  もう丸4日も経過しておりまして困ってしまっています。。

2

補足情報追加

2021/07/19 15:29

投稿

asm_t
asm_t

スコア14

test CHANGED
File without changes
test CHANGED
@@ -174,7 +174,7 @@
174
174
 
175
175
 
176
176
 
177
- # 補足
177
+ # ファイル構成
178
178
 
179
179
  rails6のためwebpackerにより管理していまして、
180
180
 
@@ -224,6 +224,218 @@
224
224
 
225
225
 
226
226
 
227
+
228
+
229
+
230
+
231
+ # 追加
232
+
233
+
234
+
235
+ ```ここに言語を入力
236
+
237
+ $ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
238
+
239
+ ```
240
+
241
+
242
+
243
+ 上記実行の結果はこちらです。
244
+
245
+ ```
246
+
247
+ [ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
248
+
249
+ Creating network "remote-work-space_default" with the default driver
250
+
251
+ yarn install v1.22.5
252
+
253
+ [1/4] Resolving packages...
254
+
255
+ success Already up-to-date.
256
+
257
+ Done in 0.91s.
258
+
259
+ I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
260
+
261
+ I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
262
+
263
+ I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
264
+
265
+ I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
266
+
267
+ I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
268
+
269
+ I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
270
+
271
+ Compiling...
272
+
273
+ Compiled all packs in /var/www/remote-work-space/public/packs
274
+
275
+ DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
276
+
277
+
278
+
279
+ WARNING: 75 repetitive deprecation warnings omitted.
280
+
281
+
282
+
283
+
284
+
285
+ Hash: 3174971661e2025a3966
286
+
287
+ Version: webpack 4.46.0
288
+
289
+ Time: 19141ms
290
+
291
+ Built at: 07/19/2021 2:32:14 PM
292
+
293
+ Asset Size Chunks Chunk Names
294
+
295
+ css/application-ab380ca8.css 500 KiB 0 [emitted] [immutable] [big] application
296
+
297
+ css/application-ab380ca8.css.br 45.4 KiB [emitted]
298
+
299
+ css/application-ab380ca8.css.gz 59.7 KiB [emitted]
300
+
301
+ js/application-eb3d27609911ccb97804.js 1.44 MiB 0 [emitted] [immutable] [big] application
302
+
303
+ js/application-eb3d27609911ccb97804.js.LICENSE.txt 1.9 KiB [emitted]
304
+
305
+ js/application-eb3d27609911ccb97804.js.br 421 KiB [emitted] [big]
306
+
307
+ js/application-eb3d27609911ccb97804.js.gz 521 KiB [emitted] [big]
308
+
309
+ js/application-eb3d27609911ccb97804.js.map 2.55 MiB 0 [emitted] [dev] application
310
+
311
+ js/application-eb3d27609911ccb97804.js.map.br 633 KiB [emitted] [big]
312
+
313
+ js/application-eb3d27609911ccb97804.js.map.gz 801 KiB [emitted] [big]
314
+
315
+ manifest.json 1.15 KiB [emitted]
316
+
317
+ manifest.json.br 357 bytes [emitted]
318
+
319
+ manifest.json.gz 420 bytes [emitted]
320
+
321
+ media/images/haikei2-fdccd5a9818591770d37f9ea066dca2d.jpg 303 KiB [emitted] [big]
322
+
323
+ media/images/logo-5cea09c33174e593e3035e44c30ab207.png 12.3 KiB [emitted]
324
+
325
+ media/images/map-c720af287cec6da110cee7488771bfcd.png 799 KiB [emitted] [big]
326
+
327
+ media/images/map.index-059b208860fe7bb3fa1129d1ac328a69.png 456 KiB [emitted] [big]
328
+
329
+ media/images/post.show-cf557d5bd5c5823e89b9427013c266cd.png 422 KiB [emitted] [big]
330
+
331
+ media/images/programming-81fcef8481ff9060ba2295a1582a3ec1.jpg 176 KiB [emitted]
332
+
333
+ media/images/user-b7eb3153b0adb70287b66b7ae9d7c8be.png 31.6 KiB [emitted]
334
+
335
+ Entrypoint application [big] = css/application-ab380ca8.css js/application-eb3d27609911ccb97804.js js/application-eb3d27609911ccb97804.js.map
336
+
337
+ [0] (webpack)/buildin/global.js 905 bytes {0} [built]
338
+
339
+ [2] (webpack)/buildin/module.js 552 bytes {0} [built]
340
+
341
+ [6] ./app/javascript/images/haikei2.jpg 103 bytes {0} [optional] [built]
342
+
343
+ [7] ./app/javascript/images/logo.png 100 bytes {0} [optional] [built]
344
+
345
+ [8] ./app/javascript/images/map.png 99 bytes {0} [optional] [built]
346
+
347
+ [9] ./app/javascript/images/map.index.png 105 bytes {0} [optional] [built]
348
+
349
+ [10] ./app/javascript/images/post.show.png 105 bytes {0} [optional] [built]
350
+
351
+ [11] ./app/javascript/images/programming.jpg 107 bytes {0} [optional] [built]
352
+
353
+ [12] ./app/javascript/images/user.png 100 bytes {0} [optional] [built]
354
+
355
+ [15] ./app/javascript/packs/application.js 776 bytes {0} [built]
356
+
357
+ [16] ./app/javascript/channels/index.js 205 bytes {0} [built]
358
+
359
+ [17] ./app/javascript/channels sync _channel.js$ 160 bytes {0} [built]
360
+
361
+ [22] ./app/javascript/stylesheets/application.scss 39 bytes {0} [built]
362
+
363
+ [24] ./app/javascript/images sync ^./.*$ 380 bytes {0} [built]
364
+
365
+ + 12 hidden modules
366
+
367
+
368
+
369
+ WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
370
+
371
+ This can impact web performance.
372
+
373
+ Assets:
374
+
375
+ media/images/haikei2-fdccd5a9818591770d37f9ea066dca2d.jpg (303 KiB)
376
+
377
+ media/images/map-c720af287cec6da110cee7488771bfcd.png (799 KiB)
378
+
379
+ media/images/map.index-059b208860fe7bb3fa1129d1ac328a69.png (456 KiB)
380
+
381
+ media/images/post.show-cf557d5bd5c5823e89b9427013c266cd.png (422 KiB)
382
+
383
+ css/application-ab380ca8.css (500 KiB)
384
+
385
+ js/application-eb3d27609911ccb97804.js (1.44 MiB)
386
+
387
+ js/application-eb3d27609911ccb97804.js.gz (521 KiB)
388
+
389
+ js/application-eb3d27609911ccb97804.js.map.gz (801 KiB)
390
+
391
+ js/application-eb3d27609911ccb97804.js.br (421 KiB)
392
+
393
+ js/application-eb3d27609911ccb97804.js.map.br (633 KiB)
394
+
395
+
396
+
397
+ WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
398
+
399
+ Entrypoints:
400
+
401
+ application (1.93 MiB)
402
+
403
+ css/application-ab380ca8.css
404
+
405
+ js/application-eb3d27609911ccb97804.js
406
+
407
+
408
+
409
+
410
+
411
+ WARNING in webpack performance recommendations:
412
+
413
+ You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
414
+
415
+ For more info visit https://webpack.js.org/guides/code-splitting/
416
+
417
+ Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/stylesheets/application.scss:
418
+
419
+ Entrypoint mini-css-extract-plugin = *
420
+
421
+ [0] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/stylesheets/application.scss 1.61 MiB {0} [built]
422
+
423
+ [3] ./app/javascript/images/haikei2.jpg 103 bytes {0} [built]
424
+
425
+ + 2 hidden modules
426
+
427
+
428
+
429
+ ```
430
+
431
+ エラーではなくWARNINGですが、こちらが原因の可能性もありますでしょうか?
432
+
433
+
434
+
435
+
436
+
437
+
438
+
227
439
  もう丸4日も経過しておりまして困ってしまっています。。
228
440
 
229
441
  何かお気づきのことがありましたら教えていただきたいです。

1

誤字

2021/07/19 14:36

投稿

asm_t
asm_t

スコア14

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- 【Rails6+Docker+AWS(EC2)+Puma+Nginx】で本番環境にデプロイしたのですが、
1
+ 【Rails6+Docker+AWS(EC2,RDS,VPC)+Puma+Nginx】で本番環境にデプロイしたのですが、
2
2
 
3
3
  CSSと画像が読み込まれません。
4
4