再挑戦したBotHeaven

試行錯誤中

事前準備

  • Windows7-64bitだけど、Ruby2.0.0-32bitをインストール
  • herokuにアカウントを作成
  • 「Create New App」でHeroku gitを行って必要なツールをインストール
  • Settingsでドメインを確認する(Redirect URIとして利用する)

コマンドプロンプト

heroku login
Enter your Heroku credentials.
Email:
Password (typing will be hidden):
Authentication successful.


git clone https://github.com/alfa-jpn/BotHeaven.git
Cloning into 'BotHeaven'...
remote: Counting objects: 344, done.
Receiving objects: 79% (272/344) 0 (delta 0), pack-reused 344R
Receiving objects: 100% (344/344), 72.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (120/120), done.
Checking connectivity... done.

cd BotHeaven
cp .env.example .env

.envを編集

SLACK_TEAM_ID=SlackのチームID(auth.testのteam_id
SLACK_APP_ID=SlackのアプリケーションID(Application DetailsのClient ID
SLACK_APP_SECRET=Slackのアプリケーションキー(Application DetailsのClient Secret
SLACK_BOT_NAME=Slackのボット名(BotsのCustomize Name
SLACK_BOT_TOKEN=Slackのボットトークン(BotsのAPI Token
SECRET_KEY_BASE=(http://www.convertstring.com/ja/Hash/SHA256で作成する

ぶんどる

C:\Users\kenmi_000\Documents\Heroku\BotHeaven>bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
(中略)
Installing puma 2.11.2 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

C:/Ruby200/bin/ruby.exe extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no

Installing puma on windowsのInstall the puma gemの手順通りに行うけど、最後だけ変更

C:\Users\kenmi_000\Documents\Heroku\BotHeaven>gem install puma -v '2.11.2' -- --with-opt-dir=c:\openssl
Fetching: puma-2.11.2.gem (100%)
Building native extensions with: '--with-opt-dir=c:\openssl'
This could take a while...
Successfully installed puma-2.11.2
Parsing documentation for puma-2.11.2
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/puma/puma_http11.so, skipping
Installing ri documentation for puma-2.11.2
1 gem installed

ここで大問題、gemでpumaをインストールすることには成功するけれども、bundleでpumaが入らない。
bundleの際にオプション指定をしていないことが原因だった。

>bundle config
(ずらずら)
>bundle config build.puma --with-opt-dir=c:\openssl

>bundle config build.hoge --hoge=hoge(間違って入力した!
>bundle config --delete build.hoge(削除する

>bundle install --path vendor/bundle(入った

次!

BotHeaven>bundle exec rake db:migrate RAILS_ENV=production --trace
'openssl' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
(ずらずら)

ん?

C:\Users\kenmi_000>openssl
'openssl' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

OpenSSLのインストールを参考にインストールする。PATHも記入する。
試す

BotHeaven>bundle exec rake db:migrate RAILS_ENV=production
rake aborted!
TZInfo::DataSourceNotFound: No source of timezone data could be found.
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error.

わかった。tzinfoね

BotHeaven>gem install tzinfo -v 1.2.2
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
2 gems installed

このtzinfoもgemでいくら入れてもダメだったのでGemfileに加える
Resolving TZInfo::DataSourceNotFound Errors

# Gemfile
group :development, :test do(このグループの中に入れる)
# ???
gem 'tzinfo'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
end

Gemfileを修正したので最初から

>bundle install --path vendor/bundle
>bundle exec rake db:migrate RAILS_ENV=production --trace

Invoke db:migrate (first_time)

Invoke environment (first_time)

Execute environment

Invoke db:load_config (first_time)

Execute db:load_config

Execute db:migrate

terminate called after throwing an instance of 'std::runtime_error'
what(): Encryption not available on this event-machine

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

event-machineでエラーなのでbundel config に記述してみる

>bundle config build.eventmachine --with-opt-dir=c:\openssl

エラーの内容が変わらない。もーわからん。Windowsでの操作を中止して、Macでやってみる。