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

質問編集履歴

3

Gemfileを追加

2019/03/27 06:49

投稿

k.chisato
k.chisato

スコア18

title CHANGED
File without changes
body CHANGED
@@ -138,5 +138,90 @@
138
138
  password: <%= ENV['VER0_2_DATABASE_PASSWORD'] %>
139
139
  ```
140
140
 
141
+ ```Gemfile
142
+ source 'https://rubygems.org'
143
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
141
144
 
145
+ ruby '2.5.1'
146
+
147
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
148
+ gem 'rails', '~> 5.2.2', '>= 5.2.2.1'
149
+ # Use mysql as the database for Active Record
150
+ gem 'mysql2', '0.5.2'
151
+ # Use Puma as the app server
152
+ gem 'puma', '~> 3.11'
153
+ # Use SCSS for stylesheets
154
+ gem 'sass-rails', '~> 5.0.7'
155
+ # Use Uglifier as compressor for JavaScript assets
156
+ gem 'uglifier', '>= 1.3.0'
157
+ # See https://github.com/rails/execjs#readme for more supported runtimes
158
+ # gem 'mini_racer', platforms: :ruby
159
+
160
+ # Use CoffeeScript for .coffee assets and views
161
+ gem 'coffee-rails', '~> 4.2'
162
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
163
+ gem 'turbolinks', '~> 5'
164
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
165
+ gem 'jbuilder', '~> 2.5'
166
+ # Use Redis adapter to run Action Cable in production
167
+ # gem 'redis', '~> 4.0'
168
+ # Use ActiveModel has_secure_password
169
+ # gem 'bcrypt', '~> 3.1.7'
170
+
171
+ # Use ActiveStorage variant
172
+ # gem 'mini_magick', '~> 4.8'
173
+
174
+ # Use Capistrano for deployment
175
+ # gem 'capistrano-rails', group: :development
176
+
177
+ # Reduces boot times through caching; required in config/boot.rb
178
+ gem 'bootsnap', '>= 1.1.0', require: false
179
+
180
+ group :development, :test do
181
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
182
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
183
+ end
184
+
185
+ group :development do
186
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
187
+ gem 'web-console', '>= 3.3.0'
188
+ gem 'listen', '>= 3.0.5', '< 3.2'
189
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
190
+ gem 'spring'
191
+ gem 'spring-watcher-listen', '~> 2.0.0'
192
+ end
193
+
194
+ group :test do
195
+ # Adds support for Capybara system testing and selenium driver
196
+ gem 'capybara', '>= 2.15'
197
+ gem 'selenium-webdriver'
198
+ # Easy installation and use of chromedriver to run system tests with Chrome
199
+ gem 'chromedriver-helper'
200
+ end
201
+
202
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
203
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
204
+
205
+ # アマゾンS3を追加
206
+ gem 'aws-sdk-s3', require: false
207
+
208
+ # 基本項目
209
+ gem 'pry-rails'
210
+ gem 'compass-rails', '3.1.0'
211
+ gem 'sprockets', '3.7.2'
212
+ gem 'hirb'
213
+ gem 'hirb-unicode'
214
+
215
+ # jQuery
216
+ gem "jquery-rails"
217
+
218
+ # ログイン
219
+ gem 'devise'
220
+
221
+ group :production do
222
+ gem 'rails_12factor'
223
+ end
224
+ ```
225
+
226
+
142
227
  どなたかアドバイスを頂けると幸いです・・・

2

schema.rbとdatabase.ymlを追加

2019/03/27 06:49

投稿

k.chisato
k.chisato

スコア18

title CHANGED
File without changes
body CHANGED
@@ -39,4 +39,104 @@
39
39
  State: created
40
40
  ```
41
41
 
42
+ 以下schema.rb
43
+ ```
44
+ ActiveRecord::Schema.define(version: 2019_03_19_064642) do
45
+
46
+ create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
47
+ t.string "name", null: false
48
+ t.string "record_type", null: false
49
+ t.bigint "record_id", null: false
50
+ t.bigint "blob_id", null: false
51
+ t.datetime "created_at", null: false
52
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
53
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
54
+ end
55
+
56
+ create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
57
+ t.string "key", null: false
58
+ t.string "filename", null: false
59
+ t.string "content_type"
60
+ t.text "metadata"
61
+ t.bigint "byte_size", null: false
62
+ t.string "checksum", null: false
63
+ t.datetime "created_at", null: false
64
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
65
+ end
66
+
67
+ create_table "countries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
68
+ t.string "country"
69
+ t.string "capital"
70
+ t.datetime "created_at", null: false
71
+ t.datetime "updated_at", null: false
72
+ t.string "continent"
73
+ t.float "latitude", limit: 53
74
+ t.float "longitude", limit: 53
75
+ end
76
+
77
+ create_table "remove_latitude_from_countries", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
78
+ t.integer "latitude"
79
+ t.integer "longitude"
80
+ t.datetime "created_at", null: false
81
+ t.datetime "updated_at", null: false
82
+ end
83
+
84
+ create_table "stamps", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
85
+ t.integer "user_id"
86
+ t.text "title"
87
+ t.text "description"
88
+ t.datetime "shooted_at"
89
+ t.datetime "created_at", null: false
90
+ t.datetime "updated_at", null: false
91
+ t.integer "country_id"
92
+ end
93
+
94
+ create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
95
+ t.string "email", default: "", null: false
96
+ t.string "encrypted_password", default: "", null: false
97
+ t.string "reset_password_token"
98
+ t.datetime "reset_password_sent_at"
99
+ t.datetime "remember_created_at"
100
+ t.datetime "created_at", null: false
101
+ t.datetime "updated_at", null: false
102
+ t.string "family_name"
103
+ t.string "first_name"
104
+ t.string "family_name_kana"
105
+ t.string "first_name_kana"
106
+ t.index ["email"], name: "index_users_on_email", unique: true
107
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
108
+ end
109
+
110
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
111
+ end
112
+
113
+ ```
114
+
115
+
116
+ 以下database.yml
117
+ ```
118
+ default: &default
119
+ adapter: mysql2
120
+ encoding: utf8
121
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
122
+ username: root
123
+ password:
124
+ socket: /var/lib/mysql/mysql.sock
125
+
126
+ development:
127
+ <<: *default
128
+ database: ver0_2_development
129
+
130
+ test:
131
+ <<: *default
132
+ database: ver0_2_test
133
+
134
+ production:
135
+ <<: *default
136
+ database: ver0_2_production
137
+ username: ver0_2
138
+ password: <%= ENV['VER0_2_DATABASE_PASSWORD'] %>
139
+ ```
140
+
141
+
42
142
  どなたかアドバイスを頂けると幸いです・・・

1

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

2019/03/27 06:24

投稿

k.chisato
k.chisato

スコア18

title CHANGED
@@ -1,1 +1,1 @@
1
- ClearDBアドオンを用いてHerokuにデプロイ出来ない
1
+ HerokuにClearDBアドオンをしたらDBのテーブルが足りない
body CHANGED
@@ -1,210 +1,42 @@
1
1
  ### 前提
2
2
 
3
+ ユーザー登録を必要とするSNS的なアプリを開発中です。
3
- Heroku上にアプリケーション作成するころでは出来ています
4
+ いよいよα版公開!思ったら最後の最後につづいています・・・
4
- ![イメージ説明](d8a653e24349f477e2e7c7ffaacf4284.png)
5
5
 
6
- Herokuのバージョンは18、
7
- Rubyのバージョンは2.5.1、
8
- railsのバージョンは5.2.2.1です。
6
+ [https://life-stamp-rally.herokuapp.com/users](https://life-stamp-rally.herokuapp.com/users)
9
7
 
8
+ Heroku上にアプリケーションを作成し、ブラウザにトップページを表示するところまでは出来ています。
10
- DBは開発環境でMySQLを使っています。
9
+ しかしログインページや新規会員登録に遷移ると下記エラーが発生
11
10
 
12
- しかしその後にClearDBでアドオンをしたく下記コドをターミナルに打ち込むとエラーが発生します。
11
+ ![イメジ説明](39924f14a146771d44ff024d0c9c27a7.png)
13
12
 
14
- heroku addons:add cleardb
13
+ HeidiSQLを使用してデータベースに接続をしてみると、
15
- ```
16
- ec2-user:~/environment/ver0.2 (master) $ heroku addons:add cleardb
17
- Creating cleardb on ⬢ life-stamp-rally-ver0... !
18
- ▸ Couldn't find that app.
14
+ 本来あるはずのUsersテーブルがありませんでした!!
19
- ```
20
- ※”life-stamp-rally-ver0”というのは以前作成したcleardbです。
21
-  何故か選択されてしまい・・・
22
15
 
23
- ここで下記コードを打ち込んでアプリを選択して進むも、
24
- ```
25
- heroku addons:add cleardb:ignite --app whispering-ridge-52187
26
- ```
27
- 次の下記コードで再びエラーが出てしまい・・・
28
- ```
29
- heroku config | grep CLEARDB_DATABASE_URL
30
- › Error: Couldn't find that app.
31
-
32
- › Error ID: not_found
33
- ```
34
16
 
35
- 下記にタミナルの履歴を載せておきます。
17
+ ![イメジ説明](60a766501539d35d131db95049d7187c.png)
18
+ ※開発環境
36
19
 
20
+ ![イメージ説明](39a19a1ecafa28a5ea9e25cfa625b7ed.png)
37
- なお、Gemfileは下記を記載→bundle install済み。
21
+ ※HeidiSQL(herokuデプロイしたアプリのデータベース)
38
- ```
39
- group :production do
40
- gem 'rails_12factor'
41
- end
42
- ```
43
22
 
44
- 個人的には一度色々リセット出来ればと思っています。
45
- しかしHeroku内のアプリは削除出来ても、ClearDBの設定?は削除できず・・
46
23
 
24
+ Herokuのバージョンは18、
47
- ### ターミナル履歴全部
25
+ Rubyバージョンは2.5.1、
26
+ railsのバージョンは5.2.2.1、
27
+ DBは開発環境でMySQL(phpmyadmin)を使っています。
48
28
 
49
- ```
50
- ec2-user:~/environment $ curl -OL https://cli-assets.heroku.com/heroku-linux-x64.tar.gz
51
- % Total % Received % Xferd Average Speed Time Time Time Current
52
- Dload Upload Total Spent Left Speed
53
- 100 25.8M 100 25.8M 0 0 25.1M 0 0:00:01 0:00:01 --:--:-- 25.1M
54
- ec2-user:~/environment $ tar zxf heroku-linux-x64.tar.gz && rm -f heroku-linux-x64.tar.gz
55
- ec2-user:~/environment $ sudo mv heroku /usr/local
56
- mv: cannot move ‘heroku’ to ‘/usr/local/heroku’: Directory not empty
57
- ec2-user:~/environment $ echo 'PATH=/usr/local/heroku/bin:$PATH' >> $HOME/.bash_profile
58
- ec2-user:~/environment $ source $HOME/.bash_profile > /dev/null
59
- ec2-user:~/environment $ cd ver0.3
60
- ec2-user:~/environment/ver0.3 (master) $ heroku login
61
- heroku: Press any key to open up the browser to login or q to exit:
62
- Opening browser to https://cli-auth.heroku.com/auth/browser/909e9189-75d5-4365-b700-3e32e9429daa
63
- › Warning: Cannot open browser.
64
- Logging in... done
65
- Logged in as ★メールアドレス★
66
- ec2-user:~/environment/ver0.3 (master) $ bundle install
67
- 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`.
68
- Using rake 12.3.2
69
- Using concurrent-ruby 1.1.5
70
- Using i18n 1.6.0
71
- Using minitest 5.11.3
72
- Using thread_safe 0.3.6
73
- Using tzinfo 1.2.5
74
- Using activesupport 5.2.2.1
75
- Using builder 3.2.3
76
- Using erubi 1.8.0
77
- Using mini_portile2 2.4.0
78
- Using nokogiri 1.10.1
79
- Using rails-dom-testing 2.0.3
80
- Using crass 1.0.4
81
- Using loofah 2.2.3
82
- Using rails-html-sanitizer 1.0.4
83
- Using actionview 5.2.2.1
84
- Using rack 2.0.6
85
- Using rack-test 1.1.0
86
- Using actionpack 5.2.2.1
87
- Using nio4r 2.3.1
88
- Using websocket-extensions 0.1.3
89
- Using websocket-driver 0.7.0
90
- Using actioncable 5.2.2.1
91
- Using globalid 0.4.2
92
- Using activejob 5.2.2.1
93
- Using mini_mime 1.0.1
94
- Using mail 2.7.1
95
- Using actionmailer 5.2.2.1
96
- Using activemodel 5.2.2.1
97
- Using arel 9.0.0
98
- Using activerecord 5.2.2.1
99
- Using mimemagic 0.3.3
100
- Using marcel 0.3.3
101
- Using activestorage 5.2.2.1
102
- Using public_suffix 3.0.3
103
- Using addressable 2.6.0
104
- Using io-like 0.3.0
105
- Using archive-zip 0.12.0
106
- Using aws-eventstream 1.0.2
107
- Using aws-partitions 1.144.0
108
- Using aws-sigv4 1.1.0
109
- Using http-2 0.10.1
110
- Using jmespath 1.4.0
111
- Using aws-sdk-core 3.47.0
112
- Using aws-sdk-kms 1.14.0
113
- Using aws-sdk-s3 1.32.0
114
- Using bcrypt 3.1.12
115
- Using bindex 0.5.0
116
- Using msgpack 1.2.9
117
- Using bootsnap 1.4.1
118
- Using bundler 2.0.1
119
- Using byebug 11.0.0
120
- Using regexp_parser 1.3.0
121
- Using xpath 3.2.0
122
- Using capybara 3.14.0
123
- Using ffi 1.10.0
124
- Using childprocess 0.9.0
125
- Using chromedriver-helper 2.1.0
126
- Using chunky_png 1.3.11
127
- Using coderay 1.1.2
128
- Using coffee-script-source 1.12.2
129
- Using execjs 2.7.0
130
- Using coffee-script 2.4.1
131
- Using method_source 0.9.2
132
- Using thor 0.20.3
133
- Using railties 5.2.2.1
134
- Using coffee-rails 4.2.2
135
- Using multi_json 1.13.1
136
- Using sass 3.4.25
137
- Using compass-core 1.0.3
138
- Using compass-import-once 1.0.5
139
- Using rb-fsevent 0.10.3
140
- Using rb-inotify 0.10.0
141
- Using compass 1.0.3
142
- Using sprockets 3.7.2
143
- Using sprockets-rails 3.2.1
144
- Using tilt 2.0.9
145
- Using sass-rails 5.0.7
146
- Using compass-rails 3.1.0
147
- Using orm_adapter 0.5.0
148
- Using responders 2.4.1
149
- Using warden 1.2.8
150
- Using devise 4.6.1
151
- Using hirb 0.7.3
152
- Using unicode-display_width 0.1.1
153
- Using hirb-unicode 0.0.5
154
- Using jbuilder 2.8.0
155
- Using jquery-rails 4.3.3
156
- Using ruby_dep 1.5.0
157
- Using listen 3.1.5
158
- Using mysql2 0.5.2
159
- Using pry 0.12.2
160
- Using pry-rails 0.3.9
161
- Using puma 3.12.0
162
- Using rails 5.2.2.1
163
- Using rails_serve_static_assets 0.0.5
164
- Using rails_stdout_logging 0.0.5
165
- Using rails_12factor 0.0.3
166
- Using rubyzip 1.2.2
167
- Using selenium-webdriver 3.141.0
168
- Using spring 2.0.2
169
- Using spring-watcher-listen 2.0.1
170
- Using turbolinks-source 5.2.0
171
- Using turbolinks 5.2.0
172
- Using uglifier 4.1.20
173
- Using web-console 3.7.0
174
- Bundle complete! 27 Gemfile dependencies, 106 gems now installed.
175
- Use `bundle info [gemname]` to see where a bundled gem is installed.
176
- ec2-user:~/environment/ver0.3 (master) $ git init
177
- Reinitialized existing Git repository in /home/ec2-user/environment/ver0.3/.git/
178
- ec2-user:~/environment/ver0.3 (master) $ heroku create
179
- Creating app... done, ⬢ whispering-ridge-52187
180
- https://whispering-ridge-52187.herokuapp.com/ | https://git.heroku.com/whispering-ridge-52187.git
181
- ec2-user:~/environment/ver0.3 (master) $ heroku addons:add cleardb
182
- Creating cleardb on ⬢ life-stamp-rally-ver0... free
183
- Created cleardb-tetrahedral-33673 as CLEARDB_PUCE_URL
184
- Use heroku addons:docs cleardb to view documentation
185
- ec2-user:~/environment/ver0.3 (master) $ heroku addons:add cleardb:ignite --app whispering-ridge-52187
186
- Creating cleardb:ignite on ⬢ whispering-ridge-52187... free
187
- Created cleardb-asymmetrical-62509 as CLEARDB_DATABASE_URL
188
- Use heroku addons:docs cleardb to view documentation
189
- ec2-user:~/environment/ver0.3 (master) $ heroku config | grep CLEARDB_DATABASE_URL
190
- › Error: Couldn't find that app.
191
-
192
- › Error ID: not_found
193
- ec2-user:~/environment/ver0.3 (master) $
194
- ```
195
29
 
196
- ### 試したこと
197
-
198
- アドオンするアプリの名前を、消してしまった”life-stamp-rally-ver0”に変更してみたところ、
199
- 途中まで上手行きましたが、最後
30
+ アドオンは普通に問題無出来ている様見えます・・・
200
31
  ```
32
+ ec2-user:~/environment/ver0.3 (master) $ heroku addons:info cleardb
33
+ === cleardb-crystalline-67196
34
+ Attachments: life-stamp-rally::CLEARDB_DATABASE
35
+ Installed at: Tue Mar 26 2019 02:24:55 GMT+0000 (Coordinated Universal Time)
36
+ Owning app: life-stamp-rally
37
+ Plan: cleardb:ignite
201
- heroku apps:info
38
+ Price: free
39
+ State: created
202
40
  ```
203
- で調べたところ
204
- ```
205
- Repo Size: 0 KB
206
- ```
207
- となりURLを叩いてもエラーとなってしまいました。
208
- ![イメージ説明](e3c78b36354bba0591728f3813a9e736.png)
209
41
 
210
42
  どなたかアドバイスを頂けると幸いです・・・