以下の条件下で実施した際のログです。
[shell]
$ heroku login
Enter your Heroku credentials:
Email: *********@gmail.com
Password: *****************
Logged in as **********@gmail.com
[gemfile]
gem 'mini_racer', platforms: :ruby
# gem 'therubyracer', platforms: :ruby
gem 'rails_12factor', group: :production
[Procfile]
web: bundle exec rails server -p $PORT
[shell]
$ heroku create
› Warning: heroku update available from 7.0.22 to 7.14.4
Creating app... done, ⬢ hoge-fuga-12345
https://hoge-fuga-12345.herokuapp.com/ | https://git.heroku.com/hoge-fuga-12345.git
[shell]
$ heroku addons:create cleardb:ignite
› Warning: heroku update available from 7.0.22 to 7.14.4
Creating cleardb:ignite on ⬢ hoge-fuga-12345... !
▸ Please verify your account to install this add-on plan (please enter a credit card) For more information, see https://devcenter.heroku.com/categories/billing Verify now at https://heroku.com/verify
[shell]
$ heroku addons:create cleardb:ignite
› Warning: heroku update available from 7.0.22 to 7.14.4
Creating cleardb:ignite on ⬢ hoge-fuga-12345... free
Created cleardb-piyo-12345 as CLEARDB_DATABASE_URL
Use heroku addons:docs cleardb to view documentation
[shell]
$ heroku update
› Warning: heroku update available from 7.0.22 to 7.14.4
heroku: Updating CLI from 7.0.22 to 7.14.4... done
heroku: Updating CLI... done
Updating completions... done
[shell]
$ heroku config
=== hoge-fuga-12345 Config Vars
CLEARDB_DATABASE_URL: mysql://foo:bar-cdbr-iron-east-01.cleardb.net/heroku_12345?reconnect=true
CLEARDB_DATABASE_URL: mysql://[ユーザ名]:[パスワード]@[ホスト名]/[スキーマ名]?reconnect=true
という、書式らしい。
[shell]
$ heroku config:set DATABASE_URL='mysql2://foo:bar-cdbr-iron-east-01.cleardb.net/heroku_12345?reconnect=true'
Setting DATABASE_URL and restarting ⬢ hoge-fuga-12345... done, v4
DATABASE_URL: mysql2://foo:bar@us-cdbr-iron-east-01.cleardb.net/heroku_12345?reconnect=true
[shell]
$ heroku config:set DATABASE_PASSWORD = *****************
▸ DATABASE_PASSWORD is invalid. Must be in the format FOO=bar.
[shell]
$ heroku config:set DATABASE_PASSWORD=*****************
Setting DATABASE_PASSWORD and restarting ⬢ hoge-fuga-12345... done, v5
DATABASE_PASSWORD: *****************
[shell]
$ heroku config
=== hoge-fuga-12345 Config Vars
CLEARDB_DATABASE_URL: mysql://foo:bar@us-cdbr-iron-east-01.cleardb.net/heroku_12345?reconnect=true
DATABASE_PASSWORD: *****************
DATABASE_URL: mysql2://foo:bar@us-cdbr-iron-east-01.cleardb.net/heroku_12345?reconnect=true
[変更前]
production:
<<: *default
username: YOURNAME
database: YOURDB
password: <%= ENV['MYBOZU_DATABASE_PASSWORD'] %>
[変更後]
production:
<<: *default
username: foo
database: heroku_12345
password: <%= ENV['DATABASE_PASSWORD'] %>
[shell]
$ git push heroku release-heroku:master
[shell]
︙
remote: rake aborted!
remote: Devise.secret_key was not set. Please add the following to your Devise initializer:
remote:
remote: config.secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx'
︙
[/config/initializers/devise.rb]
Devise.setup do |config|
config.secret_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx'
[shell]
$ git push heroku release-heroku:master
[shell]
remote: Download Yarn at https://yarnpkg.com/en/docs/install
remote: rake aborted!
remote: Uglifier::Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
[config/environments/production.rb]
Rails.application.configure do
︙
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.js_compressor = :uglifier
︙
[shell]
$ git push heroku release-heroku:master
[shell]
remote: Verifying deploy... done.
To https://git.heroku.com/hoge-fuga-12345.git
* [new branch] release-heroku -> master
[shell]
# database.ymlの内容でデータベースを作成
$ heroku run rake db:create
# 未実行のマイグレーションファイルを全て実行する
$ heroku run rake db:migrate
最後までお読みいただき、ありがとうございました。
ご意見などありましたら@hippohackへDMをお願いいたします。