1.4はGitの話。しかし、rails newしたときにgit initもされているように見える。お節介だなあ。
git add -Aして全部をコミットする。ん?bundle installのパスは要らないかもしれない。ミスった。まあ、いいや。
Bitbucketにコードを上げる説明が書いてあるけども、ここはパス。次からはGitHubかGitLabのどちらかにあげるけど、今回はまあ、いいでしょ。
1.5はHerokuへのデプロイ。
まず、productionはPostgreSQLを使うようにGemfileを修正。--without production をつけて、bundle installする。
> tail -n5 Gemfile group :production do gem 'pg', '0.20.0' end > bundle install --without production Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 12.3.1 Using concurrent-ruby 1.1.3 Using i18n 1.1.1 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.1.6 Using builder 3.2.3 Using erubi 1.7.1 Using mini_portile2 2.3.0 Using nokogiri 1.8.5 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 5.1.6 Using rack 2.0.6 Using rack-test 1.1.0 Using actionpack 5.1.6 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.6.5 Using actioncable 5.1.6 Using globalid 0.4.1 Using activejob 5.1.6 Using mini_mime 1.0.1 Using mail 2.7.1 Using actionmailer 5.1.6 Using activemodel 5.1.6 Using arel 8.0.0 Using activerecord 5.1.6 Using bindex 0.5.0 Using bundler 1.17.1 Using byebug 9.0.6 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.1.6 Using coffee-rails 4.2.2 Using ffi 1.9.25 Using multi_json 1.13.1 Using jbuilder 2.6.4 Using jquery-rails 4.3.1 Using rb-fsevent 0.10.3 Using rb-inotify 0.9.10 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.9.1 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.1.6 Using sass-listen 4.0.0 Using sass 3.7.2 Using tilt 2.0.8 Using sass-rails 5.0.6 Using spring 2.0.2 Using spring-watcher-listen 2.0.1 Using sqlite3 1.3.13 Using turbolinks-source 5.2.0 Using turbolinks 5.0.1 Using uglifier 3.2.0 Using web-console 3.5.1 Bundle complete! 15 Gemfile dependencies, 64 gems now installed. Gems in the group production were not installed. Bundled gems are installed into `./vender/bundle`
次に、Heroku CLIを入れる。
> brew install heroku/brew/heroku Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae abcm2ps curaengine grunt-completion maxwell sleuthkit azure-storage-cpp dnscrypt-proxy hunspell micronaut sratoolkit binaryen docfx imageoptim-cli mill stgit bundletool docker-machine-completion influxdb mysqltuner tile38 caddy erlang@18 jenkins nodeenv topgrade certbot erlang@20 jetty paket tunnel chakra exploitdb kibana@5.6 picard-tools uhd chamber fio kitchen-sync rabbitmq vault circleci fluxctl kobalt range-v3 wireguard-tools clojurescript fn lego restic consul gitlab-gem libqalculate rst-lint convox glslang libxlsxwriter shadowsocks-libev crystal-icr go-bindata lmod shc ==> Tapping heroku/brew Cloning into '/usr/local/Homebrew/Library/Taps/heroku/homebrew-brew'... remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (8/8), done. remote: Total 10 (delta 0), reused 7 (delta 0), pack-reused 0 Unpacking objects: 100% (10/10), done. Tapped 2 formulae (38 files, 28.6KB). ==> Installing heroku from heroku/brew ==> Installing dependencies for heroku/brew/heroku: heroku/brew/heroku-node ==> Installing heroku/brew/heroku dependency: heroku/brew/heroku-node ==> Downloading https://cli-assets.heroku.com/homebrew/node-11.1.0.tar.xz ######################################################################## 100.0% 🍺 /usr/local/Cellar/heroku-node/11.1.0: 3 files, 38.9MB, built in 13 seconds ==> Installing heroku/brew/heroku ==> Downloading https://cli-assets.heroku.com/heroku-v7.18.9/heroku-v7.18.9.tar.xz ######################################################################## 100.0% ==> Caveats To use the Heroku CLI's autocomplete -- Via homebrew's shell completion: 1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded and called, either explicitly or via a framework like oh-my-zsh. 2) Then run $ heroku autocomplete --refresh-cache OR Use our standalone setup: 1) Run and follow the install steps: $ heroku autocomplete Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completions have been installed to: /usr/local/share/zsh/site-functions ==> Summary 🍺 /usr/local/Cellar/heroku/7.18.9: 17,360 files, 44.7MB, built in 48 seconds ==> Caveats ==> heroku To use the Heroku CLI's autocomplete -- Via homebrew's shell completion: 1) Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded and called, either explicitly or via a framework like oh-my-zsh. 2) Then run $ heroku autocomplete --refresh-cache OR Use our standalone setup: 1) Run and follow the install steps: $ heroku autocomplete Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completions have been installed to:
確認
> heroku --version heroku/7.18.9 darwin-x64 node-v11.1.0
ログインを打つと、認証はブラウザで行われる。仕組みはよくわかんない・・・
> heroku login heroku: Press any key to open up the browser to login or q to exit: Logging in... done Logged in as m-tam@mbp.nifty.com
そして、heroku createする。うっかりこのときのコマンド実行ログを失った・・・。
まあ、とりあえず、空のアプリは動き出す。面白いね。
リポジトリもできるので、git pushするとアプリが動き出す。仕組みが気になるけど、ここでは深入りしない。
> git push heroku master Counting objects: 5500, done. Delta compression using up to 4 threads. Compressing objects: 100% (5136/5136), done. Writing objects: 100% (5500/5500), 21.77 MiB | 1.07 MiB/s, done. Total 5500 (delta 673), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.4.5 remote: -----> Installing dependencies using bundler 1.15.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote: Fetching gem metadata from https://rubygems.org/......... remote: Fetching version metadata from https://rubygems.org/.. remote: Fetching dependency metadata from https://rubygems.org/. remote: Fetching rake 12.3.1 remote: Fetching concurrent-ruby 1.1.3 remote: Fetching minitest 5.11.3 remote: Installing rake 12.3.1 remote: Installing minitest 5.11.3 remote: Installing concurrent-ruby 1.1.3 remote: Fetching thread_safe 0.3.6 remote: Fetching builder 3.2.3 remote: Installing thread_safe 0.3.6 remote: Installing builder 3.2.3 remote: Fetching erubi 1.7.1 remote: Installing erubi 1.7.1 remote: Fetching mini_portile2 2.3.0 remote: Fetching crass 1.0.4 remote: Installing mini_portile2 2.3.0 remote: Installing crass 1.0.4 remote: Fetching rack 2.0.6 remote: Installing rack 2.0.6 remote: Fetching nio4r 2.3.1 remote: Fetching websocket-extensions 0.1.3 remote: Installing websocket-extensions 0.1.3 remote: Fetching mini_mime 1.0.1 remote: Installing nio4r 2.3.1 with native extensions remote: Installing mini_mime 1.0.1 remote: Fetching arel 8.0.0 remote: Installing arel 8.0.0 remote: Using bundler 1.15.2 remote: Fetching coffee-script-source 1.12.2 remote: Fetching execjs 2.7.0 remote: Installing coffee-script-source 1.12.2 remote: Installing execjs 2.7.0 remote: Fetching method_source 0.9.2 remote: Fetching thor 0.20.3 remote: Installing method_source 0.9.2 remote: Installing thor 0.20.3 remote: Fetching ffi 1.9.25 remote: Fetching multi_json 1.13.1 remote: Installing multi_json 1.13.1 remote: Fetching pg 0.20.0 remote: Installing ffi 1.9.25 with native extensions remote: Installing pg 0.20.0 with native extensions remote: Fetching puma 3.9.1 remote: Installing puma 3.9.1 with native extensions remote: Fetching rb-fsevent 0.10.3 remote: Installing rb-fsevent 0.10.3 remote: Fetching tilt 2.0.8 remote: Installing tilt 2.0.8 remote: Fetching turbolinks-source 5.2.0 remote: Installing turbolinks-source 5.2.0 remote: Fetching tzinfo 1.2.5 remote: Installing tzinfo 1.2.5 remote: Fetching nokogiri 1.8.5 remote: Installing nokogiri 1.8.5 with native extensions remote: Fetching i18n 1.1.1 remote: Installing i18n 1.1.1 remote: Fetching websocket-driver 0.6.5 remote: Installing websocket-driver 0.6.5 with native extensions remote: Fetching mail 2.7.1 remote: Installing mail 2.7.1 remote: Fetching rack-test 1.1.0 remote: Installing rack-test 1.1.0 remote: Fetching sprockets 3.7.2 remote: Installing sprockets 3.7.2 remote: Fetching coffee-script 2.4.1 remote: Installing coffee-script 2.4.1 remote: Fetching uglifier 3.2.0 remote: Installing uglifier 3.2.0 remote: Fetching turbolinks 5.0.1 remote: Installing turbolinks 5.0.1 remote: Fetching rb-inotify 0.9.10 remote: Installing rb-inotify 0.9.10 remote: Fetching activesupport 5.1.6 remote: Installing activesupport 5.1.6 remote: Fetching sass-listen 4.0.0 remote: Installing sass-listen 4.0.0 remote: Fetching globalid 0.4.1 remote: Installing globalid 0.4.1 remote: Fetching activemodel 5.1.6 remote: Installing activemodel 5.1.6 remote: Fetching jbuilder 2.6.4 remote: Installing jbuilder 2.6.4 remote: Fetching sass 3.7.2 remote: Installing sass 3.7.2 remote: Fetching activejob 5.1.6 remote: Installing activejob 5.1.6 remote: Fetching activerecord 5.1.6 remote: Installing activerecord 5.1.6 remote: Fetching rails-dom-testing 2.0.3 remote: Fetching loofah 2.2.3 remote: Installing rails-dom-testing 2.0.3 remote: Installing loofah 2.2.3 remote: Fetching rails-html-sanitizer 1.0.4 remote: Installing rails-html-sanitizer 1.0.4 remote: Fetching actionview 5.1.6 remote: Installing actionview 5.1.6 remote: Fetching actionpack 5.1.6 remote: Installing actionpack 5.1.6 remote: Fetching actionmailer 5.1.6 remote: Fetching railties 5.1.6 remote: Fetching actioncable 5.1.6 remote: Installing actioncable 5.1.6 remote: Installing actionmailer 5.1.6 remote: Fetching sprockets-rails 3.2.1 remote: Installing railties 5.1.6 remote: Installing sprockets-rails 3.2.1 remote: Fetching jquery-rails 4.3.1 remote: Fetching coffee-rails 4.2.2 remote: Fetching rails 5.1.6 remote: Installing rails 5.1.6 remote: Installing coffee-rails 4.2.2 remote: Fetching sass-rails 5.0.6 remote: Installing sass-rails 5.0.6 remote: Installing jquery-rails 4.3.1 remote: Bundle complete! 15 Gemfile dependencies, 57 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into ./vendor/bundle. remote: Post-install message from sass: remote: remote: Ruby Sass is deprecated and will be unmaintained as of 26 March 2019. remote: remote: * If you use Sass as a command-line tool, we recommend using Dart Sass, the new remote: primary implementation: https://sass-lang.com/install remote: remote: * If you use Sass as a plug-in for a Ruby web framework, we recommend using the remote: sassc gem: https://github.com/sass/sassc-ruby#readme remote: remote: * For more details, please refer to the Sass blog: remote: http://sass.logdown.com/posts/7081811 remote: remote: Bundle completed (43.57s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v8.10.0-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: NoMethodError: undefined method `active_storage' for #<Rails::Application::Configuration:0x0000559958ffe4b0> remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/railtie/configuration.rb:95:in `method_missing' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/config/environments/production.rb:42:in `block in <top (required)>' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/railtie.rb:211:in `instance_eval' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/railtie.rb:211:in `configure' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/config/environments/production.rb:1:in `<top (required)>' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/engine.rb:599:in `each' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/engine.rb:599:in `block in <class:Engine>' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `each' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `tsort_each_child' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/config/environment.rb:5:in `<top (required)>' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6/lib/rails/application.rb:445:in `block in run_tasks_blocks' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define' remote: /tmp/build_810c7306c9346ae9969fea5f59763b29/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>' remote: Tasks: TOP => environment remote: (See full trace by running task with --trace) remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to rocky-falls-53583. remote: To https://git.heroku.com/rocky-falls-53583.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/rocky-falls-53583.git'
って、エラーになっとるやないの。
まあ、今回はもうこれ以上踏み込まないことにする。このエントリはもう十分長い。