質問編集履歴
4
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -113,7 +113,7 @@
|
|
113
113
|
|
114
114
|
|
115
115
|
|
116
|
-
# 追
|
116
|
+
# 追記
|
117
117
|
|
118
118
|
```ここに言語を入力
|
119
119
|
$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|
3
docker-compose.ymlの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,10 +22,10 @@
|
|
22
22
|
# 試したこと
|
23
23
|
### 試したこと①
|
24
24
|
```
|
25
|
-
[ec2-user@ip-10-0-2-234
|
25
|
+
[ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec find app/assets/ -type f -exec touch {} \;
|
26
|
-
[ec2-user@ip-10-0-2-234
|
26
|
+
[ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:clobber RAILS_ENV=production
|
27
27
|
をしたあとで、
|
28
|
-
[ec2-user@ip-10-0-2-234
|
28
|
+
[ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|
29
29
|
の実行。
|
30
30
|
```
|
31
31
|
|
@@ -54,13 +54,13 @@
|
|
54
54
|
|
55
55
|
【画像ファイルの確認】
|
56
56
|
$ docker-compose exec app bash でコンテナ内を覗いてみる。
|
57
|
-
root@7bde1a234794:/var/www/
|
57
|
+
root@7bde1a234794:/var/www/アプリ名/public/packs/media/images
|
58
58
|
上記の中にちゃんと画像ファイルが格納されておりました。
|
59
59
|
|
60
60
|
|
61
61
|
【SCSSの確認】
|
62
62
|
$ docker-compose exec app bash でコンテナ内を覗いてみる。
|
63
|
-
root@7bde1a234794:/var/www/
|
63
|
+
root@7bde1a234794:/var/www/アプリ名/public/assets
|
64
64
|
上記の中にcssファイルが格納されておりました。
|
65
65
|
|
66
66
|
|
@@ -121,20 +121,20 @@
|
|
121
121
|
|
122
122
|
上記実行の結果はこちらです。
|
123
123
|
```
|
124
|
-
[ec2-user@ip-10-0-2-234
|
124
|
+
[ec2-user@ip-10-0-2-234 アプリ名]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|
125
|
-
Creating network "
|
125
|
+
Creating network "アプリ名_default" with the default driver
|
126
126
|
yarn install v1.22.5
|
127
127
|
[1/4] Resolving packages...
|
128
128
|
success Already up-to-date.
|
129
129
|
Done in 0.91s.
|
130
|
-
I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/
|
130
|
+
I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/アプリ名/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
|
131
|
-
I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/
|
131
|
+
I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/アプリ名/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
|
132
|
-
I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/
|
132
|
+
I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/アプリ名/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
|
133
|
-
I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/
|
133
|
+
I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/アプリ名/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
|
134
|
-
I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/
|
134
|
+
I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/アプリ名/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
|
135
|
-
I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/
|
135
|
+
I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/アプリ名/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
|
136
136
|
Compiling...
|
137
|
-
Compiled all packs in /var/www/
|
137
|
+
Compiled all packs in /var/www/アプリ名/public/packs
|
138
138
|
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
|
139
139
|
|
140
140
|
WARNING: 75 repetitive deprecation warnings omitted.
|
@@ -170,11 +170,11 @@
|
|
170
170
|
[2] (webpack)/buildin/module.js 552 bytes {0} [built]
|
171
171
|
[6] ./app/javascript/images/haikei2.jpg 103 bytes {0} [optional] [built]
|
172
172
|
[7] ./app/javascript/images/logo.png 100 bytes {0} [optional] [built]
|
173
|
-
|
173
|
+
・
|
174
|
-
[9] ./app/javascript/images/map.index.png 105 bytes {0} [optional] [built]
|
175
|
-
[10] ./app/javascript/images/post.show.png 105 bytes {0} [optional] [built]
|
176
|
-
[11] ./app/javascript/images/programming.jpg 107 bytes {0} [optional] [built]
|
177
|
-
|
174
|
+
・
|
175
|
+
・
|
176
|
+
・
|
177
|
+
・
|
178
178
|
[15] ./app/javascript/packs/application.js 776 bytes {0} [built]
|
179
179
|
[16] ./app/javascript/channels/index.js 205 bytes {0} [built]
|
180
180
|
[17] ./app/javascript/channels sync _channel.js$ 160 bytes {0} [built]
|
@@ -216,7 +216,52 @@
|
|
216
216
|
エラーではなくWARNINGですが、こちらが原因の可能性もありますでしょうか?
|
217
217
|
|
218
218
|
|
219
|
+
#追記2
|
220
|
+
docker-compose.ymlの中身はこちらです。
|
219
221
|
|
222
|
+
```
|
223
|
+
# docker-compose.yml
|
224
|
+
version: "3"
|
225
|
+
services:
|
226
|
+
app:
|
227
|
+
build:
|
228
|
+
context: .
|
229
|
+
env_file:
|
230
|
+
- ./environments/db.env
|
231
|
+
# command: bundle exec puma -C config/puma.rb
|
232
|
+
command: bundle exec rails server -e production
|
233
|
+
volumes:
|
234
|
+
- .:/var/www/アプリ名
|
235
|
+
- public-data:/var/www/アプリ名/public
|
236
|
+
- tmp-data:/var/www/アプリ名/tmp
|
237
|
+
- log-data:/var/www/アプリ名/log
|
238
|
+
# depends_on:
|
239
|
+
# - db
|
240
|
+
# db:
|
241
|
+
# image: mysql:5.7
|
242
|
+
# env_file:
|
243
|
+
# - ./environments/db.env
|
244
|
+
# volumes:
|
245
|
+
# - db-data:/var/lib/mysql
|
246
|
+
web:
|
247
|
+
build:
|
248
|
+
context: containers/nginx
|
249
|
+
volumes:
|
250
|
+
- ./nginx.conf:/etc/nginx/nginx.conf
|
251
|
+
- ./アプリ名.conf:/etc/nginx/conf.d/アプリ名.conf
|
252
|
+
- public-data:/var/www/アプリ名/public
|
253
|
+
- tmp-data:/var/www/アプリ名/tmp
|
254
|
+
ports:
|
255
|
+
- 80:80
|
256
|
+
depends_on:
|
257
|
+
- app
|
258
|
+
volumes:
|
259
|
+
public-data:
|
260
|
+
tmp-data:
|
261
|
+
log-data:
|
262
|
+
db-data:
|
263
|
+
```
|
264
|
+
|
220
265
|
もう丸4日も経過しておりまして困ってしまっています。。
|
221
266
|
何かお気づきのことがありましたら教えていただきたいです。
|
222
267
|
よろしくお願いいたします。
|
2
補足情報追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -86,7 +86,7 @@
|
|
86
86
|
### 試したこと⑦
|
87
87
|
キャッシュを削除
|
88
88
|
|
89
|
-
#
|
89
|
+
# ファイル構成
|
90
90
|
rails6のためwebpackerにより管理していまして、
|
91
91
|
javascriptとSCSSのローカルでのファイル構成は下記の通りです。
|
92
92
|
|
@@ -111,6 +111,112 @@
|
|
111
111
|
Github
|
112
112
|
```
|
113
113
|
|
114
|
+
|
115
|
+
|
116
|
+
# 追加
|
117
|
+
|
118
|
+
```ここに言語を入力
|
119
|
+
$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|
120
|
+
```
|
121
|
+
|
122
|
+
上記実行の結果はこちらです。
|
123
|
+
```
|
124
|
+
[ec2-user@ip-10-0-2-234 remote-work-space]$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|
125
|
+
Creating network "remote-work-space_default" with the default driver
|
126
|
+
yarn install v1.22.5
|
127
|
+
[1/4] Resolving packages...
|
128
|
+
success Already up-to-date.
|
129
|
+
Done in 0.91s.
|
130
|
+
I, [2021-07-19T14:31:52.318242 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
|
131
|
+
I, [2021-07-19T14:31:52.318986 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
|
132
|
+
I, [2021-07-19T14:31:52.319451 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
|
133
|
+
I, [2021-07-19T14:31:52.320366 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
|
134
|
+
I, [2021-07-19T14:31:52.320794 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
|
135
|
+
I, [2021-07-19T14:31:52.321203 #1] INFO -- : Writing /var/www/remote-work-space/public/assets/inquiry-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
|
136
|
+
Compiling...
|
137
|
+
Compiled all packs in /var/www/remote-work-space/public/packs
|
138
|
+
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
|
139
|
+
|
140
|
+
WARNING: 75 repetitive deprecation warnings omitted.
|
141
|
+
|
142
|
+
|
143
|
+
Hash: 3174971661e2025a3966
|
144
|
+
Version: webpack 4.46.0
|
145
|
+
Time: 19141ms
|
146
|
+
Built at: 07/19/2021 2:32:14 PM
|
147
|
+
Asset Size Chunks Chunk Names
|
148
|
+
css/application-ab380ca8.css 500 KiB 0 [emitted] [immutable] [big] application
|
149
|
+
css/application-ab380ca8.css.br 45.4 KiB [emitted]
|
150
|
+
css/application-ab380ca8.css.gz 59.7 KiB [emitted]
|
151
|
+
js/application-eb3d27609911ccb97804.js 1.44 MiB 0 [emitted] [immutable] [big] application
|
152
|
+
js/application-eb3d27609911ccb97804.js.LICENSE.txt 1.9 KiB [emitted]
|
153
|
+
js/application-eb3d27609911ccb97804.js.br 421 KiB [emitted] [big]
|
154
|
+
js/application-eb3d27609911ccb97804.js.gz 521 KiB [emitted] [big]
|
155
|
+
js/application-eb3d27609911ccb97804.js.map 2.55 MiB 0 [emitted] [dev] application
|
156
|
+
js/application-eb3d27609911ccb97804.js.map.br 633 KiB [emitted] [big]
|
157
|
+
js/application-eb3d27609911ccb97804.js.map.gz 801 KiB [emitted] [big]
|
158
|
+
manifest.json 1.15 KiB [emitted]
|
159
|
+
manifest.json.br 357 bytes [emitted]
|
160
|
+
manifest.json.gz 420 bytes [emitted]
|
161
|
+
media/images/haikei2-fdccd5a9818591770d37f9ea066dca2d.jpg 303 KiB [emitted] [big]
|
162
|
+
media/images/logo-5cea09c33174e593e3035e44c30ab207.png 12.3 KiB [emitted]
|
163
|
+
media/images/map-c720af287cec6da110cee7488771bfcd.png 799 KiB [emitted] [big]
|
164
|
+
media/images/map.index-059b208860fe7bb3fa1129d1ac328a69.png 456 KiB [emitted] [big]
|
165
|
+
media/images/post.show-cf557d5bd5c5823e89b9427013c266cd.png 422 KiB [emitted] [big]
|
166
|
+
media/images/programming-81fcef8481ff9060ba2295a1582a3ec1.jpg 176 KiB [emitted]
|
167
|
+
media/images/user-b7eb3153b0adb70287b66b7ae9d7c8be.png 31.6 KiB [emitted]
|
168
|
+
Entrypoint application [big] = css/application-ab380ca8.css js/application-eb3d27609911ccb97804.js js/application-eb3d27609911ccb97804.js.map
|
169
|
+
[0] (webpack)/buildin/global.js 905 bytes {0} [built]
|
170
|
+
[2] (webpack)/buildin/module.js 552 bytes {0} [built]
|
171
|
+
[6] ./app/javascript/images/haikei2.jpg 103 bytes {0} [optional] [built]
|
172
|
+
[7] ./app/javascript/images/logo.png 100 bytes {0} [optional] [built]
|
173
|
+
[8] ./app/javascript/images/map.png 99 bytes {0} [optional] [built]
|
174
|
+
[9] ./app/javascript/images/map.index.png 105 bytes {0} [optional] [built]
|
175
|
+
[10] ./app/javascript/images/post.show.png 105 bytes {0} [optional] [built]
|
176
|
+
[11] ./app/javascript/images/programming.jpg 107 bytes {0} [optional] [built]
|
177
|
+
[12] ./app/javascript/images/user.png 100 bytes {0} [optional] [built]
|
178
|
+
[15] ./app/javascript/packs/application.js 776 bytes {0} [built]
|
179
|
+
[16] ./app/javascript/channels/index.js 205 bytes {0} [built]
|
180
|
+
[17] ./app/javascript/channels sync _channel.js$ 160 bytes {0} [built]
|
181
|
+
[22] ./app/javascript/stylesheets/application.scss 39 bytes {0} [built]
|
182
|
+
[24] ./app/javascript/images sync ^./.*$ 380 bytes {0} [built]
|
183
|
+
+ 12 hidden modules
|
184
|
+
|
185
|
+
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
|
186
|
+
This can impact web performance.
|
187
|
+
Assets:
|
188
|
+
media/images/haikei2-fdccd5a9818591770d37f9ea066dca2d.jpg (303 KiB)
|
189
|
+
media/images/map-c720af287cec6da110cee7488771bfcd.png (799 KiB)
|
190
|
+
media/images/map.index-059b208860fe7bb3fa1129d1ac328a69.png (456 KiB)
|
191
|
+
media/images/post.show-cf557d5bd5c5823e89b9427013c266cd.png (422 KiB)
|
192
|
+
css/application-ab380ca8.css (500 KiB)
|
193
|
+
js/application-eb3d27609911ccb97804.js (1.44 MiB)
|
194
|
+
js/application-eb3d27609911ccb97804.js.gz (521 KiB)
|
195
|
+
js/application-eb3d27609911ccb97804.js.map.gz (801 KiB)
|
196
|
+
js/application-eb3d27609911ccb97804.js.br (421 KiB)
|
197
|
+
js/application-eb3d27609911ccb97804.js.map.br (633 KiB)
|
198
|
+
|
199
|
+
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
|
200
|
+
Entrypoints:
|
201
|
+
application (1.93 MiB)
|
202
|
+
css/application-ab380ca8.css
|
203
|
+
js/application-eb3d27609911ccb97804.js
|
204
|
+
|
205
|
+
|
206
|
+
WARNING in webpack performance recommendations:
|
207
|
+
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
|
208
|
+
For more info visit https://webpack.js.org/guides/code-splitting/
|
209
|
+
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:
|
210
|
+
Entrypoint mini-css-extract-plugin = *
|
211
|
+
[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]
|
212
|
+
[3] ./app/javascript/images/haikei2.jpg 103 bytes {0} [built]
|
213
|
+
+ 2 hidden modules
|
214
|
+
|
215
|
+
```
|
216
|
+
エラーではなくWARNINGですが、こちらが原因の可能性もありますでしょうか?
|
217
|
+
|
218
|
+
|
219
|
+
|
114
220
|
もう丸4日も経過しておりまして困ってしまっています。。
|
115
221
|
何かお気づきのことがありましたら教えていただきたいです。
|
116
222
|
よろしくお願いいたします。
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
【Rails6+Docker+AWS(EC2)+Puma+Nginx】で本番環境にデプロイしたのですが、
|
1
|
+
【Rails6+Docker+AWS(EC2,RDS,VPC)+Puma+Nginx】で本番環境にデプロイしたのですが、
|
2
2
|
CSSと画像が読み込まれません。
|
3
3
|
```ここに言語を入力
|
4
4
|
$ docker-compose run app bundle exec rails assets:precompile RAILS_ENV=production
|