質問するログイン新規登録

質問編集履歴

4

database.yml

2020/09/07 05:26

投稿

masaosan18
masaosan18

スコア65

title CHANGED
File without changes
body CHANGED
@@ -88,4 +88,62 @@
88
88
  volumes:
89
89
  app_node_modules:
90
90
  db_data:
91
+ ```
92
+
93
+ ```ここに言語を入力
94
+ # MySQL. Versions 5.5.8 and up are supported.
95
+ #
96
+ # Install the MySQL driver
97
+ # gem install mysql2
98
+ #
99
+ # Ensure the MySQL gem is defined in your Gemfile
100
+ # gem 'mysql2'
101
+ #
102
+ # And be sure to use new-style password hashing:
103
+ # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
104
+ #
105
+ default: &default
106
+ adapter: mysql2
107
+ encoding: utf8mb4
108
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
109
+ username: <%= ENV.fetch("MYSQL_DATABASE") { "root" } %>
110
+ password: <%= ENV.fetch("MYSQL_ROOT_PASSWORD") { "password" } %>
111
+ host: db
112
+
113
+ development:
114
+ <<: *default
115
+ database: home_care_navi_development
116
+
117
+ # Warning: The database defined as "test" will be erased and
118
+ # re-generated from your development database when you run "rake".
119
+ # Do not set this db to the same as development or production.
120
+ test:
121
+ <<: *default
122
+ database: home_care_navi_test
123
+
124
+ # As with config/credentials.yml, you never want to store sensitive information,
125
+ # like your database password, in your source code. If your source code is
126
+ # ever seen by anyone, they now have access to your database.
127
+ #
128
+ # Instead, provide the password as a unix environment variable when you boot
129
+ # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
130
+ # for a full rundown on how to provide these environment variables in a
131
+ # production deployment.
132
+ #
133
+ # On Heroku and other platform providers, you may have a full connection URL
134
+ # available as an environment variable. For example:
135
+ #
136
+ # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
137
+ #
138
+ # You can use this database configuration with:
139
+ #
140
+ # production:
141
+ # url: <%= ENV['DATABASE_URL'] %>
142
+ #
143
+ production:
144
+ <<: *default
145
+ database: home_care_navi_production
146
+ username: home_care_navi
147
+ password: <%= ENV['home_care_navi_DATABASE_PASSWORD'] %>
148
+
91
149
  ```

3

yml

2020/09/07 05:26

投稿

masaosan18
masaosan18

スコア65

title CHANGED
File without changes
body CHANGED
@@ -51,4 +51,41 @@
51
51
  api_1 | puma (4.3.5) lib/puma/server.rb:328:in `block in run'
52
52
  api_1 | puma (4.3.5) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
53
53
 
54
+ ```
55
+
56
+ ```ここに言語を入力
57
+ version: '3'
58
+ services:
59
+ app:
60
+ build: ./app
61
+ tty: true
62
+ volumes:
63
+ - ./app:/app
64
+ - app_node_modules:/app/node_modules
65
+ ports:
66
+ - '4000:4000'
67
+
68
+ db:
69
+ image: mysql:5.7
70
+ environment:
71
+ MYSQL_DATABASE: root
72
+ MYSQL_ROOT_PASSWORD: password
73
+ ports:
74
+ - '3306:3306'
75
+ volumes:
76
+ - db_data:/var/lib/mysql
77
+
78
+ api:
79
+ build: ./api
80
+ command: bundle exec rails s -p 3000 -b '0.0.0.0'
81
+ volumes:
82
+ - ./api:/api
83
+ ports:
84
+ - '3000:3000'
85
+ links:
86
+ - db
87
+
88
+ volumes:
89
+ app_node_modules:
90
+ db_data:
54
91
  ```

2

タグ

2020/09/07 02:45

投稿

masaosan18
masaosan18

スコア65

title CHANGED
File without changes
body CHANGED
File without changes

1

エラー文

2020/09/07 02:41

投稿

masaosan18
masaosan18

スコア65

title CHANGED
File without changes
body CHANGED
@@ -4,4 +4,51 @@
4
4
 
5
5
  どのよう手順が必要なのでしょうか。
6
6
 
7
- やってみたこととしては、docker-compose.yml内の編集です。
7
+ やってみたこととしては、docker-compose.yml内の編集です。
8
+
9
+ ```ここに言語を入力
10
+ api_1 | Mysql2::Error::ConnectionError (Unknown MySQL server host 'db' (-2)):
11
+ api_1 |
12
+ api_1 | mysql2 (0.5.3) lib/mysql2/client.rb:90:in `connect'
13
+ api_1 | mysql2 (0.5.3) lib/mysql2/client.rb:90:in `initialize'
14
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `new'
15
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `mysql2_connection'
16
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
17
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
18
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
19
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
20
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
21
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
22
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
23
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_handling.rb:221:in `retrieve_connection'
24
+ api_1 | activerecord (6.0.3.1) lib/active_record/connection_handling.rb:189:in `connection'
25
+ api_1 | activerecord (6.0.3.1) lib/active_record/migration.rb:562:in `call'
26
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
27
+ api_1 | activesupport (6.0.3.1) lib/active_support/callbacks.rb:101:in `run_callbacks'
28
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
29
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
30
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
31
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
32
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
33
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:37:in `call_app'
34
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `block in call'
35
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `block in tagged'
36
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:28:in `tagged'
37
+ api_1 | activesupport (6.0.3.1) lib/active_support/tagged_logging.rb:80:in `tagged'
38
+ api_1 | railties (6.0.3.1) lib/rails/rack/logger.rb:26:in `call'
39
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
40
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
41
+ api_1 | rack (2.2.2) lib/rack/runtime.rb:22:in `call'
42
+ api_1 | activesupport (6.0.3.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
43
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
44
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/static.rb:126:in `call'
45
+ api_1 | rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
46
+ api_1 | actionpack (6.0.3.1) lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
47
+ api_1 | railties (6.0.3.1) lib/rails/engine.rb:527:in `call'
48
+ api_1 | puma (4.3.5) lib/puma/configuration.rb:228:in `call'
49
+ api_1 | puma (4.3.5) lib/puma/server.rb:713:in `handle_request'
50
+ api_1 | puma (4.3.5) lib/puma/server.rb:472:in `process_client'
51
+ api_1 | puma (4.3.5) lib/puma/server.rb:328:in `block in run'
52
+ api_1 | puma (4.3.5) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
53
+
54
+ ```