質問編集履歴

3

修正

2020/09/04 07:02

投稿

tomsuma
tomsuma

スコア38

test CHANGED
File without changes
test CHANGED
@@ -197,3 +197,103 @@
197
197
  socket: /var/lib/mysql/mysql.sock
198
198
 
199
199
  ```
200
+
201
+
202
+
203
+ ```
204
+
205
+ docker-compose.yml
206
+
207
+
208
+
209
+ version: '3'
210
+
211
+ services:
212
+
213
+ db:
214
+
215
+ command: --default-authentication-plugin=mysql_native_password
216
+
217
+ restart: always
218
+
219
+ environment:
220
+
221
+ MYSQL_ROOT_PASSWORD: example
222
+
223
+ image: mysql
224
+
225
+ ports:
226
+
227
+ - "4306:3306"
228
+
229
+
230
+
231
+ web:
232
+
233
+ build: .
234
+
235
+ command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
236
+
237
+ volumes:
238
+
239
+ - .:/app_name
240
+
241
+ ports:
242
+
243
+ - "3000:3000"
244
+
245
+ depends_on:
246
+
247
+ - db
248
+
249
+ ```
250
+
251
+
252
+
253
+ ```
254
+
255
+
256
+
257
+ dockerfile
258
+
259
+
260
+
261
+
262
+
263
+ FROM ruby:2.6
264
+
265
+
266
+
267
+ RUN apt-get update -qq && \
268
+
269
+ apt-get install -y build-essential \
270
+
271
+ libpq-dev \
272
+
273
+ nodejs
274
+
275
+
276
+
277
+ RUN mkdir /Books
278
+
279
+
280
+
281
+ ENV APP_ROOT /Books
282
+
283
+ WORKDIR $APP_ROOT
284
+
285
+
286
+
287
+ ADD ./Gemfile $APP_ROOT/Gemfile
288
+
289
+ ADD ./Gemfile.lock $APP_ROOT/Gemfile.lock
290
+
291
+
292
+
293
+ RUN gem install bundler
294
+
295
+ RUN bundle install
296
+
297
+ ADD . $APP_ROOT
298
+
299
+ ```

2

修正

2020/09/04 07:02

投稿

tomsuma
tomsuma

スコア38

test CHANGED
File without changes
test CHANGED
@@ -69,3 +69,131 @@
69
69
  . SUCCESS!
70
70
 
71
71
  ```
72
+
73
+
74
+
75
+ ```
76
+
77
+ ターミナル
78
+
79
+
80
+
81
+ web_1 | web-console (4.0.4) lib/web_console/middleware.rb:19:in `block in call'
82
+
83
+ web_1 | web-console (4.0.4) lib/web_console/middleware.rb:17:in `catch'
84
+
85
+ web_1 | web-console (4.0.4) lib/web_console/middleware.rb:17:in `call'
86
+
87
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
88
+
89
+ web_1 | railties (6.0.3.2) lib/rails/rack/logger.rb:37:in `call_app'
90
+
91
+ web_1 | railties (6.0.3.2) lib/rails/rack/logger.rb:26:in `block in call'
92
+
93
+ web_1 | activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:80:in `block in tagged'
94
+
95
+ web_1 | activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:28:in `tagged'
96
+
97
+ web_1 | activesupport (6.0.3.2) lib/active_support/tagged_logging.rb:80:in `tagged'
98
+
99
+ web_1 | railties (6.0.3.2) lib/rails/rack/logger.rb:26:in `call'
100
+
101
+ web_1 | sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
102
+
103
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
104
+
105
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/request_id.rb:27:in `call'
106
+
107
+ web_1 | rack (2.2.3) lib/rack/method_override.rb:24:in `call'
108
+
109
+ web_1 | rack (2.2.3) lib/rack/runtime.rb:22:in `call'
110
+
111
+ web_1 | activesupport (6.0.3.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
112
+
113
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
114
+
115
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/static.rb:126:in `call'
116
+
117
+ web_1 | rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
118
+
119
+ web_1 | actionpack (6.0.3.2) lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
120
+
121
+ web_1 | webpacker (4.3.0) lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
122
+
123
+ web_1 | rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call'
124
+
125
+ web_1 | railties (6.0.3.2) lib/rails/engine.rb:527:in `call'
126
+
127
+ web_1 | puma (3.12.6) lib/puma/configuration.rb:227:in `call'
128
+
129
+ web_1 | puma (3.12.6) lib/puma/server.rb:706:in `handle_request'
130
+
131
+ web_1 | puma (3.12.6) lib/puma/server.rb:476:in `process_client'
132
+
133
+ web_1 | puma (3.12.6) lib/puma/server.rb:334:in `block in run'
134
+
135
+ web_1 | puma (3.12.6) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
136
+
137
+ ```
138
+
139
+
140
+
141
+ ```
142
+
143
+ database.yml
144
+
145
+
146
+
147
+ default: &default
148
+
149
+ adapter: mysql2
150
+
151
+ encoding: utf8
152
+
153
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
154
+
155
+ username: root
156
+
157
+ password: password
158
+
159
+ # socket: /tmp/mysql.sock
160
+
161
+
162
+
163
+ host: db
164
+
165
+
166
+
167
+ development:
168
+
169
+ <<: *default
170
+
171
+ database: Books_development
172
+
173
+
174
+
175
+ test:
176
+
177
+ <<: *default
178
+
179
+ database: Books_test
180
+
181
+
182
+
183
+ production:
184
+
185
+ <<: *default
186
+
187
+ database: Books_production
188
+
189
+ username: Books
190
+
191
+ password: <%= ENV['BOOKS_DATABASE_PASSWORD'] %>
192
+
193
+ username: root
194
+
195
+ password: <%= ENV['DATABASE_PASSWORD'] %>
196
+
197
+ socket: /var/lib/mysql/mysql.sock
198
+
199
+ ```

1

修正

2020/09/04 06:26

投稿

tomsuma
tomsuma

スコア38

test CHANGED
File without changes
test CHANGED
@@ -13,6 +13,10 @@
13
13
 
14
14
 
15
15
  が出て困っています。。
16
+
17
+ [エラー時参考](https://qiita.com/carotene4035/items/e00076fe3990b9178cc0)
18
+
19
+ [docker参考](https://qiita.com/momokan928/items/d560fff3855fcbe0b811#1dockerfiledocker-composeyml%E3%82%92%E6%97%A2%E5%AD%98%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%88%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%E3%81%AB%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B)
16
20
 
17
21
 
18
22