質問編集履歴

4

database.yml

2020/09/07 05:26

投稿

masaosan18
masaosan18

スコア64

test CHANGED
File without changes
test CHANGED
@@ -179,3 +179,119 @@
179
179
  db_data:
180
180
 
181
181
  ```
182
+
183
+
184
+
185
+ ```ここに言語を入力
186
+
187
+ # MySQL. Versions 5.5.8 and up are supported.
188
+
189
+ #
190
+
191
+ # Install the MySQL driver
192
+
193
+ # gem install mysql2
194
+
195
+ #
196
+
197
+ # Ensure the MySQL gem is defined in your Gemfile
198
+
199
+ # gem 'mysql2'
200
+
201
+ #
202
+
203
+ # And be sure to use new-style password hashing:
204
+
205
+ # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
206
+
207
+ #
208
+
209
+ default: &default
210
+
211
+ adapter: mysql2
212
+
213
+ encoding: utf8mb4
214
+
215
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
216
+
217
+ username: <%= ENV.fetch("MYSQL_DATABASE") { "root" } %>
218
+
219
+ password: <%= ENV.fetch("MYSQL_ROOT_PASSWORD") { "password" } %>
220
+
221
+ host: db
222
+
223
+
224
+
225
+ development:
226
+
227
+ <<: *default
228
+
229
+ database: home_care_navi_development
230
+
231
+
232
+
233
+ # Warning: The database defined as "test" will be erased and
234
+
235
+ # re-generated from your development database when you run "rake".
236
+
237
+ # Do not set this db to the same as development or production.
238
+
239
+ test:
240
+
241
+ <<: *default
242
+
243
+ database: home_care_navi_test
244
+
245
+
246
+
247
+ # As with config/credentials.yml, you never want to store sensitive information,
248
+
249
+ # like your database password, in your source code. If your source code is
250
+
251
+ # ever seen by anyone, they now have access to your database.
252
+
253
+ #
254
+
255
+ # Instead, provide the password as a unix environment variable when you boot
256
+
257
+ # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
258
+
259
+ # for a full rundown on how to provide these environment variables in a
260
+
261
+ # production deployment.
262
+
263
+ #
264
+
265
+ # On Heroku and other platform providers, you may have a full connection URL
266
+
267
+ # available as an environment variable. For example:
268
+
269
+ #
270
+
271
+ # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
272
+
273
+ #
274
+
275
+ # You can use this database configuration with:
276
+
277
+ #
278
+
279
+ # production:
280
+
281
+ # url: <%= ENV['DATABASE_URL'] %>
282
+
283
+ #
284
+
285
+ production:
286
+
287
+ <<: *default
288
+
289
+ database: home_care_navi_production
290
+
291
+ username: home_care_navi
292
+
293
+ password: <%= ENV['home_care_navi_DATABASE_PASSWORD'] %>
294
+
295
+
296
+
297
+ ```

3

yml

2020/09/07 05:26

投稿

masaosan18
masaosan18

スコア64

test CHANGED
File without changes
test CHANGED
@@ -105,3 +105,77 @@
105
105
 
106
106
 
107
107
  ```
108
+
109
+
110
+
111
+ ```ここに言語を入力
112
+
113
+ version: '3'
114
+
115
+ services:
116
+
117
+ app:
118
+
119
+ build: ./app
120
+
121
+ tty: true
122
+
123
+ volumes:
124
+
125
+ - ./app:/app
126
+
127
+ - app_node_modules:/app/node_modules
128
+
129
+ ports:
130
+
131
+ - '4000:4000'
132
+
133
+
134
+
135
+ db:
136
+
137
+ image: mysql:5.7
138
+
139
+ environment:
140
+
141
+ MYSQL_DATABASE: root
142
+
143
+ MYSQL_ROOT_PASSWORD: password
144
+
145
+ ports:
146
+
147
+ - '3306:3306'
148
+
149
+ volumes:
150
+
151
+ - db_data:/var/lib/mysql
152
+
153
+
154
+
155
+ api:
156
+
157
+ build: ./api
158
+
159
+ command: bundle exec rails s -p 3000 -b '0.0.0.0'
160
+
161
+ volumes:
162
+
163
+ - ./api:/api
164
+
165
+ ports:
166
+
167
+ - '3000:3000'
168
+
169
+ links:
170
+
171
+ - db
172
+
173
+
174
+
175
+ volumes:
176
+
177
+ app_node_modules:
178
+
179
+ db_data:
180
+
181
+ ```

2

タグ

2020/09/07 02:45

投稿

masaosan18
masaosan18

スコア64

test CHANGED
File without changes
test CHANGED
File without changes

1

エラー文

2020/09/07 02:41

投稿

masaosan18
masaosan18

スコア64

test CHANGED
File without changes
test CHANGED
@@ -11,3 +11,97 @@
11
11
 
12
12
 
13
13
  やってみたこととしては、docker-compose.yml内の編集です。
14
+
15
+
16
+
17
+ ```ここに言語を入力
18
+
19
+ api_1 | Mysql2::Error::ConnectionError (Unknown MySQL server host 'db' (-2)):
20
+
21
+ api_1 |
22
+
23
+ api_1 | mysql2 (0.5.3) lib/mysql2/client.rb:90:in `connect'
24
+
25
+ api_1 | mysql2 (0.5.3) lib/mysql2/client.rb:90:in `initialize'
26
+
27
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `new'
28
+
29
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `mysql2_connection'
30
+
31
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
32
+
33
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
34
+
35
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
36
+
37
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
38
+
39
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
40
+
41
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
42
+
43
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
44
+
45
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_handling.rb:221:in `retrieve_connection'
46
+
47
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_handling.rb:189:in `connection'
48
+
49
+ api_1 | activerecord (6.0.3.1) lib/active_record/migration.rb:562:in `call'
50
+
51
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
52
+
53
+ api_1 | activesupport (6.0.3.1) lib/active_support/callbacks.rb:101:in `run_callbacks'
54
+
55
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
56
+
57
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
58
+
59
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
60
+
61
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
62
+
63
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
64
+
65
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:37:in `call_app'
66
+
67
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `block in call'
68
+
69
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `block in tagged'
70
+
71
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:28:in `tagged'
72
+
73
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `tagged'
74
+
75
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `call'
76
+
77
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
78
+
79
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
80
+
81
+ api_1 | rack (2.2.2) lib/rack/runtime.rb:22:in `call'
82
+
83
+ api_1 | activesupport (6.0.3.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
84
+
85
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
86
+
87
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/static.rb:126:in `call'
88
+
89
+ api_1 | rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
90
+
91
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
92
+
93
+ api_1 | railties (6.0.3.1) lib/rails/engine.rb:527:in `call'
94
+
95
+ api_1 | puma (4.3.5) lib/puma/configuration.rb:228:in `call'
96
+
97
+ api_1 | puma (4.3.5) lib/puma/server.rb:713:in `handle_request'
98
+
99
+ api_1 | puma (4.3.5) lib/puma/server.rb:472:in `process_client'
100
+
101
+ api_1 | puma (4.3.5) lib/puma/server.rb:328:in `block in run'
102
+
103
+ api_1 | puma (4.3.5) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
104
+
105
+
106
+
107
+ ```