質問編集履歴

3

Gemfileを追加

2019/03/27 06:49

投稿

k.chisato
k.chisato

スコア18

test CHANGED
File without changes
test CHANGED
@@ -278,6 +278,176 @@
278
278
 
279
279
 
280
280
 
281
+ ```Gemfile
282
+
283
+ source 'https://rubygems.org'
284
+
285
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
286
+
287
+
288
+
289
+ ruby '2.5.1'
290
+
291
+
292
+
293
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
294
+
295
+ gem 'rails', '~> 5.2.2', '>= 5.2.2.1'
296
+
297
+ # Use mysql as the database for Active Record
298
+
299
+ gem 'mysql2', '0.5.2'
300
+
301
+ # Use Puma as the app server
302
+
303
+ gem 'puma', '~> 3.11'
304
+
305
+ # Use SCSS for stylesheets
306
+
307
+ gem 'sass-rails', '~> 5.0.7'
308
+
309
+ # Use Uglifier as compressor for JavaScript assets
310
+
311
+ gem 'uglifier', '>= 1.3.0'
312
+
313
+ # See https://github.com/rails/execjs#readme for more supported runtimes
314
+
315
+ # gem 'mini_racer', platforms: :ruby
316
+
317
+
318
+
319
+ # Use CoffeeScript for .coffee assets and views
320
+
321
+ gem 'coffee-rails', '~> 4.2'
322
+
323
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
324
+
325
+ gem 'turbolinks', '~> 5'
326
+
327
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
328
+
329
+ gem 'jbuilder', '~> 2.5'
330
+
331
+ # Use Redis adapter to run Action Cable in production
332
+
333
+ # gem 'redis', '~> 4.0'
334
+
335
+ # Use ActiveModel has_secure_password
336
+
337
+ # gem 'bcrypt', '~> 3.1.7'
338
+
339
+
340
+
341
+ # Use ActiveStorage variant
342
+
343
+ # gem 'mini_magick', '~> 4.8'
344
+
345
+
346
+
347
+ # Use Capistrano for deployment
348
+
349
+ # gem 'capistrano-rails', group: :development
350
+
351
+
352
+
353
+ # Reduces boot times through caching; required in config/boot.rb
354
+
355
+ gem 'bootsnap', '>= 1.1.0', require: false
356
+
357
+
358
+
359
+ group :development, :test do
360
+
361
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
362
+
363
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
364
+
365
+ end
366
+
367
+
368
+
369
+ group :development do
370
+
371
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
372
+
373
+ gem 'web-console', '>= 3.3.0'
374
+
375
+ gem 'listen', '>= 3.0.5', '< 3.2'
376
+
377
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
378
+
379
+ gem 'spring'
380
+
381
+ gem 'spring-watcher-listen', '~> 2.0.0'
382
+
383
+ end
384
+
385
+
386
+
387
+ group :test do
388
+
389
+ # Adds support for Capybara system testing and selenium driver
390
+
391
+ gem 'capybara', '>= 2.15'
392
+
393
+ gem 'selenium-webdriver'
394
+
395
+ # Easy installation and use of chromedriver to run system tests with Chrome
396
+
397
+ gem 'chromedriver-helper'
398
+
399
+ end
400
+
401
+
402
+
403
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
404
+
405
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
406
+
407
+
408
+
409
+ # アマゾンS3を追加
410
+
411
+ gem 'aws-sdk-s3', require: false
412
+
413
+
414
+
415
+ # 基本項目
416
+
417
+ gem 'pry-rails'
418
+
419
+ gem 'compass-rails', '3.1.0'
420
+
421
+ gem 'sprockets', '3.7.2'
422
+
423
+ gem 'hirb'
424
+
425
+ gem 'hirb-unicode'
426
+
427
+
428
+
429
+ # jQuery
430
+
431
+ gem "jquery-rails"
432
+
433
+
434
+
435
+ # ログイン
436
+
437
+ gem 'devise'
438
+
439
+
440
+
441
+ group :production do
442
+
443
+ gem 'rails_12factor'
444
+
445
+ end
446
+
447
+ ```
448
+
449
+
450
+
281
451
 
282
452
 
283
453
  どなたかアドバイスを頂けると幸いです・・・

2

schema.rbとdatabase.ymlを追加

2019/03/27 06:49

投稿

k.chisato
k.chisato

スコア18

test CHANGED
File without changes
test CHANGED
@@ -80,4 +80,204 @@
80
80
 
81
81
 
82
82
 
83
+ 以下schema.rb
84
+
85
+ ```
86
+
87
+ ActiveRecord::Schema.define(version: 2019_03_19_064642) do
88
+
89
+
90
+
91
+ create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
92
+
93
+ t.string "name", null: false
94
+
95
+ t.string "record_type", null: false
96
+
97
+ t.bigint "record_id", null: false
98
+
99
+ t.bigint "blob_id", null: false
100
+
101
+ t.datetime "created_at", null: false
102
+
103
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
104
+
105
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
106
+
107
+ end
108
+
109
+
110
+
111
+ create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
112
+
113
+ t.string "key", null: false
114
+
115
+ t.string "filename", null: false
116
+
117
+ t.string "content_type"
118
+
119
+ t.text "metadata"
120
+
121
+ t.bigint "byte_size", null: false
122
+
123
+ t.string "checksum", null: false
124
+
125
+ t.datetime "created_at", null: false
126
+
127
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
128
+
129
+ end
130
+
131
+
132
+
133
+ create_table "countries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
134
+
135
+ t.string "country"
136
+
137
+ t.string "capital"
138
+
139
+ t.datetime "created_at", null: false
140
+
141
+ t.datetime "updated_at", null: false
142
+
143
+ t.string "continent"
144
+
145
+ t.float "latitude", limit: 53
146
+
147
+ t.float "longitude", limit: 53
148
+
149
+ end
150
+
151
+
152
+
153
+ create_table "remove_latitude_from_countries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
154
+
155
+ t.integer "latitude"
156
+
157
+ t.integer "longitude"
158
+
159
+ t.datetime "created_at", null: false
160
+
161
+ t.datetime "updated_at", null: false
162
+
163
+ end
164
+
165
+
166
+
167
+ create_table "stamps", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
168
+
169
+ t.integer "user_id"
170
+
171
+ t.text "title"
172
+
173
+ t.text "description"
174
+
175
+ t.datetime "shooted_at"
176
+
177
+ t.datetime "created_at", null: false
178
+
179
+ t.datetime "updated_at", null: false
180
+
181
+ t.integer "country_id"
182
+
183
+ end
184
+
185
+
186
+
187
+ create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
188
+
189
+ t.string "email", default: "", null: false
190
+
191
+ t.string "encrypted_password", default: "", null: false
192
+
193
+ t.string "reset_password_token"
194
+
195
+ t.datetime "reset_password_sent_at"
196
+
197
+ t.datetime "remember_created_at"
198
+
199
+ t.datetime "created_at", null: false
200
+
201
+ t.datetime "updated_at", null: false
202
+
203
+ t.string "family_name"
204
+
205
+ t.string "first_name"
206
+
207
+ t.string "family_name_kana"
208
+
209
+ t.string "first_name_kana"
210
+
211
+ t.index ["email"], name: "index_users_on_email", unique: true
212
+
213
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
214
+
215
+ end
216
+
217
+
218
+
219
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
220
+
221
+ end
222
+
223
+
224
+
225
+ ```
226
+
227
+
228
+
229
+
230
+
231
+ 以下database.yml
232
+
233
+ ```
234
+
235
+ default: &default
236
+
237
+ adapter: mysql2
238
+
239
+ encoding: utf8
240
+
241
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
242
+
243
+ username: root
244
+
245
+ password:
246
+
247
+ socket: /var/lib/mysql/mysql.sock
248
+
249
+
250
+
251
+ development:
252
+
253
+ <<: *default
254
+
255
+ database: ver0_2_development
256
+
257
+
258
+
259
+ test:
260
+
261
+ <<: *default
262
+
263
+ database: ver0_2_test
264
+
265
+
266
+
267
+ production:
268
+
269
+ <<: *default
270
+
271
+ database: ver0_2_production
272
+
273
+ username: ver0_2
274
+
275
+ password: <%= ENV['VER0_2_DATABASE_PASSWORD'] %>
276
+
277
+ ```
278
+
279
+
280
+
281
+
282
+
83
283
  どなたかアドバイスを頂けると幸いです・・・

1

質問内容を完結にしました!

2019/03/27 06:24

投稿

k.chisato
k.chisato

スコア18

test CHANGED
@@ -1 +1 @@
1
- ClearDBアドオンを用いてHerokuにデプロイ出来ない
1
+ HerokuにClearDBアドオンをしたらDBのテーブルが足りない
test CHANGED
@@ -2,9 +2,45 @@
2
2
 
3
3
 
4
4
 
5
- Heroku上にアプリケーション作成するところまは出来ています。
5
+ ユーザー登録を必要とするSNS的なアプリを開発中です。
6
6
 
7
+ いよいよα版を公開!と思ったら最後の最後につまづいています・・・
8
+
9
+
10
+
11
+ [https://life-stamp-rally.herokuapp.com/users](https://life-stamp-rally.herokuapp.com/users)
12
+
13
+
14
+
15
+ Heroku上にアプリケーションを作成し、ブラウザにトップページを表示するところまでは出来ています。
16
+
17
+ しかしログインページや新規会員登録に遷移すると下記エラーが発生。
18
+
19
+
20
+
7
- ![イメージ説明](d8a653e24349f477e2e7c7ffaacf4284.png)
21
+ ![イメージ説明](39924f14a146771d44ff024d0c9c27a7.png)
22
+
23
+
24
+
25
+ HeidiSQLを使用してデータベースに接続をしてみると、
26
+
27
+ 本来あるはずのUsersテーブルがありませんでした!!
28
+
29
+
30
+
31
+
32
+
33
+ ![イメージ説明](60a766501539d35d131db95049d7187c.png)
34
+
35
+ ※開発環境
36
+
37
+
38
+
39
+ ![イメージ説明](39a19a1ecafa28a5ea9e25cfa625b7ed.png)
40
+
41
+ ※HeidiSQL(herokuにデプロイしたアプリのデータベース)
42
+
43
+
8
44
 
9
45
 
10
46
 
@@ -12,408 +48,36 @@
12
48
 
13
49
  Rubyのバージョンは2.5.1、
14
50
 
15
- railsのバージョンは5.2.2.1です。
51
+ railsのバージョンは5.2.2.1
52
+
53
+ DBは開発環境でMySQL(phpmyadmin)を使っています。
16
54
 
17
55
 
18
56
 
19
- DBは開発環境でMySQLを使っています。
20
57
 
21
58
 
22
-
23
- しかしその後にClearDBでアドオンをしたく下記コードをターミナルに打ち込むとエラーが発生します。
24
-
25
-
26
-
27
- heroku addons:add cleardb
59
+ アドオンは普通に問題無く出来ている様に見えます・・・
28
60
 
29
61
  ```
30
62
 
31
- ec2-user:~/environment/ver0.2 (master) $ heroku addons:add cleardb
63
+ ec2-user:~/environment/ver0.3 (master) $ heroku addons:info cleardb
32
64
 
33
- Creating cleardb on ⬢ life-stamp-rally-ver0... !
65
+ === cleardb-crystalline-67196
34
66
 
35
- Couldn't find that app.
67
+ Attachments: life-stamp-rally::CLEARDB_DATABASE
36
68
 
37
- ```
69
+ Installed at: Tue Mar 26 2019 02:24:55 GMT+0000 (Coordinated Universal Time)
38
70
 
39
- ※”life-stamp-rally-ver0”というのは以前作成したcleardbです。
71
+ Owning app: life-stamp-rally
40
72
 
41
-  何故か選択されてしまい・・・
73
+ Plan: cleardb:ignite
42
74
 
75
+ Price: free
43
76
 
44
-
45
- ここで下記コードを打ち込んでアプリを選択して進むも、
46
-
47
- ```
48
-
49
- heroku addons:add cleardb:ignite --app whispering-ridge-52187
50
-
51
- ```
52
-
53
- 次の下記コードで再びエラーが出てしまい・・・
54
-
55
- ```
56
-
57
- heroku config | grep CLEARDB_DATABASE_URL
58
-
59
- › Error: Couldn't find that app.
60
-
61
-
62
-
63
- Error ID: not_found
77
+ State: created
64
78
 
65
79
  ```
66
80
 
67
81
 
68
82
 
69
- 下記にターミナルの履歴を載せておきます。
70
-
71
-
72
-
73
- なお、Gemfileには下記を記載→bundle install済み。
74
-
75
- ```
76
-
77
- group :production do
78
-
79
- gem 'rails_12factor'
80
-
81
- end
82
-
83
- ```
84
-
85
-
86
-
87
- 個人的には一度色々リセット出来ればと思っています。
88
-
89
- しかしHeroku内のアプリは削除出来ても、ClearDBの設定?は削除できず・・
90
-
91
-
92
-
93
- ### ターミナルの履歴全部
94
-
95
-
96
-
97
- ```
98
-
99
- ec2-user:~/environment $ curl -OL https://cli-assets.heroku.com/heroku-linux-x64.tar.gz
100
-
101
- % Total % Received % Xferd Average Speed Time Time Time Current
102
-
103
- Dload Upload Total Spent Left Speed
104
-
105
- 100 25.8M 100 25.8M 0 0 25.1M 0 0:00:01 0:00:01 --:--:-- 25.1M
106
-
107
- ec2-user:~/environment $ tar zxf heroku-linux-x64.tar.gz && rm -f heroku-linux-x64.tar.gz
108
-
109
- ec2-user:~/environment $ sudo mv heroku /usr/local
110
-
111
- mv: cannot move ‘heroku’ to ‘/usr/local/heroku’: Directory not empty
112
-
113
- ec2-user:~/environment $ echo 'PATH=/usr/local/heroku/bin:$PATH' >> $HOME/.bash_profile
114
-
115
- ec2-user:~/environment $ source $HOME/.bash_profile > /dev/null
116
-
117
- ec2-user:~/environment $ cd ver0.3
118
-
119
- ec2-user:~/environment/ver0.3 (master) $ heroku login
120
-
121
- heroku: Press any key to open up the browser to login or q to exit:
122
-
123
- Opening browser to https://cli-auth.heroku.com/auth/browser/909e9189-75d5-4365-b700-3e32e9429daa
124
-
125
- › Warning: Cannot open browser.
126
-
127
- Logging in... done
128
-
129
- Logged in as ★メールアドレス★
130
-
131
- ec2-user:~/environment/ver0.3 (master) $ bundle install
132
-
133
- The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
134
-
135
- Using rake 12.3.2
136
-
137
- Using concurrent-ruby 1.1.5
138
-
139
- Using i18n 1.6.0
140
-
141
- Using minitest 5.11.3
142
-
143
- Using thread_safe 0.3.6
144
-
145
- Using tzinfo 1.2.5
146
-
147
- Using activesupport 5.2.2.1
148
-
149
- Using builder 3.2.3
150
-
151
- Using erubi 1.8.0
152
-
153
- Using mini_portile2 2.4.0
154
-
155
- Using nokogiri 1.10.1
156
-
157
- Using rails-dom-testing 2.0.3
158
-
159
- Using crass 1.0.4
160
-
161
- Using loofah 2.2.3
162
-
163
- Using rails-html-sanitizer 1.0.4
164
-
165
- Using actionview 5.2.2.1
166
-
167
- Using rack 2.0.6
168
-
169
- Using rack-test 1.1.0
170
-
171
- Using actionpack 5.2.2.1
172
-
173
- Using nio4r 2.3.1
174
-
175
- Using websocket-extensions 0.1.3
176
-
177
- Using websocket-driver 0.7.0
178
-
179
- Using actioncable 5.2.2.1
180
-
181
- Using globalid 0.4.2
182
-
183
- Using activejob 5.2.2.1
184
-
185
- Using mini_mime 1.0.1
186
-
187
- Using mail 2.7.1
188
-
189
- Using actionmailer 5.2.2.1
190
-
191
- Using activemodel 5.2.2.1
192
-
193
- Using arel 9.0.0
194
-
195
- Using activerecord 5.2.2.1
196
-
197
- Using mimemagic 0.3.3
198
-
199
- Using marcel 0.3.3
200
-
201
- Using activestorage 5.2.2.1
202
-
203
- Using public_suffix 3.0.3
204
-
205
- Using addressable 2.6.0
206
-
207
- Using io-like 0.3.0
208
-
209
- Using archive-zip 0.12.0
210
-
211
- Using aws-eventstream 1.0.2
212
-
213
- Using aws-partitions 1.144.0
214
-
215
- Using aws-sigv4 1.1.0
216
-
217
- Using http-2 0.10.1
218
-
219
- Using jmespath 1.4.0
220
-
221
- Using aws-sdk-core 3.47.0
222
-
223
- Using aws-sdk-kms 1.14.0
224
-
225
- Using aws-sdk-s3 1.32.0
226
-
227
- Using bcrypt 3.1.12
228
-
229
- Using bindex 0.5.0
230
-
231
- Using msgpack 1.2.9
232
-
233
- Using bootsnap 1.4.1
234
-
235
- Using bundler 2.0.1
236
-
237
- Using byebug 11.0.0
238
-
239
- Using regexp_parser 1.3.0
240
-
241
- Using xpath 3.2.0
242
-
243
- Using capybara 3.14.0
244
-
245
- Using ffi 1.10.0
246
-
247
- Using childprocess 0.9.0
248
-
249
- Using chromedriver-helper 2.1.0
250
-
251
- Using chunky_png 1.3.11
252
-
253
- Using coderay 1.1.2
254
-
255
- Using coffee-script-source 1.12.2
256
-
257
- Using execjs 2.7.0
258
-
259
- Using coffee-script 2.4.1
260
-
261
- Using method_source 0.9.2
262
-
263
- Using thor 0.20.3
264
-
265
- Using railties 5.2.2.1
266
-
267
- Using coffee-rails 4.2.2
268
-
269
- Using multi_json 1.13.1
270
-
271
- Using sass 3.4.25
272
-
273
- Using compass-core 1.0.3
274
-
275
- Using compass-import-once 1.0.5
276
-
277
- Using rb-fsevent 0.10.3
278
-
279
- Using rb-inotify 0.10.0
280
-
281
- Using compass 1.0.3
282
-
283
- Using sprockets 3.7.2
284
-
285
- Using sprockets-rails 3.2.1
286
-
287
- Using tilt 2.0.9
288
-
289
- Using sass-rails 5.0.7
290
-
291
- Using compass-rails 3.1.0
292
-
293
- Using orm_adapter 0.5.0
294
-
295
- Using responders 2.4.1
296
-
297
- Using warden 1.2.8
298
-
299
- Using devise 4.6.1
300
-
301
- Using hirb 0.7.3
302
-
303
- Using unicode-display_width 0.1.1
304
-
305
- Using hirb-unicode 0.0.5
306
-
307
- Using jbuilder 2.8.0
308
-
309
- Using jquery-rails 4.3.3
310
-
311
- Using ruby_dep 1.5.0
312
-
313
- Using listen 3.1.5
314
-
315
- Using mysql2 0.5.2
316
-
317
- Using pry 0.12.2
318
-
319
- Using pry-rails 0.3.9
320
-
321
- Using puma 3.12.0
322
-
323
- Using rails 5.2.2.1
324
-
325
- Using rails_serve_static_assets 0.0.5
326
-
327
- Using rails_stdout_logging 0.0.5
328
-
329
- Using rails_12factor 0.0.3
330
-
331
- Using rubyzip 1.2.2
332
-
333
- Using selenium-webdriver 3.141.0
334
-
335
- Using spring 2.0.2
336
-
337
- Using spring-watcher-listen 2.0.1
338
-
339
- Using turbolinks-source 5.2.0
340
-
341
- Using turbolinks 5.2.0
342
-
343
- Using uglifier 4.1.20
344
-
345
- Using web-console 3.7.0
346
-
347
- Bundle complete! 27 Gemfile dependencies, 106 gems now installed.
348
-
349
- Use `bundle info [gemname]` to see where a bundled gem is installed.
350
-
351
- ec2-user:~/environment/ver0.3 (master) $ git init
352
-
353
- Reinitialized existing Git repository in /home/ec2-user/environment/ver0.3/.git/
354
-
355
- ec2-user:~/environment/ver0.3 (master) $ heroku create
356
-
357
- Creating app... done, ⬢ whispering-ridge-52187
358
-
359
- https://whispering-ridge-52187.herokuapp.com/ | https://git.heroku.com/whispering-ridge-52187.git
360
-
361
- ec2-user:~/environment/ver0.3 (master) $ heroku addons:add cleardb
362
-
363
- Creating cleardb on ⬢ life-stamp-rally-ver0... free
364
-
365
- Created cleardb-tetrahedral-33673 as CLEARDB_PUCE_URL
366
-
367
- Use heroku addons:docs cleardb to view documentation
368
-
369
- ec2-user:~/environment/ver0.3 (master) $ heroku addons:add cleardb:ignite --app whispering-ridge-52187
370
-
371
- Creating cleardb:ignite on ⬢ whispering-ridge-52187... free
372
-
373
- Created cleardb-asymmetrical-62509 as CLEARDB_DATABASE_URL
374
-
375
- Use heroku addons:docs cleardb to view documentation
376
-
377
- ec2-user:~/environment/ver0.3 (master) $ heroku config | grep CLEARDB_DATABASE_URL
378
-
379
- › Error: Couldn't find that app.
380
-
381
-
382
-
383
- › Error ID: not_found
384
-
385
- ec2-user:~/environment/ver0.3 (master) $
386
-
387
- ```
388
-
389
-
390
-
391
- ### 試したこと
392
-
393
-
394
-
395
- アドオンするアプリの名前を、消してしまった”life-stamp-rally-ver0”に変更してみたところ、
396
-
397
- 途中まで上手く行きましたが、最後に
398
-
399
- ```
400
-
401
- heroku apps:info
402
-
403
- ```
404
-
405
- で調べたところ
406
-
407
- ```
408
-
409
- Repo Size: 0 KB
410
-
411
- ```
412
-
413
- となりURLを叩いてもエラーとなってしまいました。
414
-
415
- ![イメージ説明](e3c78b36354bba0591728f3813a9e736.png)
416
-
417
-
418
-
419
83
  どなたかアドバイスを頂けると幸いです・・・