LoginSignup
7
7

More than 5 years have passed since last update.

OSXでAWS Elastic BeanstalkにRailsアプリをデプロイした

Last updated at Posted at 2014-07-15

基本は以下ページの通り。

https://pip.pypa.io/en/latest/installing.html からget-pip.pyをダウンロードし、以下コマンドでpipとbotoをインストール

sudo python get-pip.py

sudo pip install boto

AWS management consoleの
Software Configuration -> Environment Propertiesに行き、以下をセットする。

Property name : SECRET_KEY_BASE 
Property value : rake secretの実行結果

eb initでインスタンスの設定をする。

設定後git aws.pushでデプロイできる。

もしくは以下の通りにzipファイルを作成しそれをアップしてもデプロイできる。
git archive --format=zip HEAD > archive.zip

RDSでmysqlを利用する場合のconfig/database.yml

production:
  adapter: mysql2
  encoding: utf8
  database: <%= ENV['RDS_DB_NAME'] %>
  username: <%= ENV['RDS_USERNAME'] %>
  password: <%= ENV['RDS_PASSWORD'] %>
  host: <%= ENV['RDS_HOSTNAME'] %>
  port: <%= ENV['RDS_PORT'] %>

アプリはec2の以下にデプロイされる模様
/var/app/ondeck

RDS
新規にparameter groupを作成し、以下の値をutf8に変更する。
TODO 確認

character_set_database
character_set_client
character_set_connection
character_set_results
character_set_server

skip-character-set-client-handshakeを1に変更
該当インスタンスのparameter groupを作成したものに変更。

ec2からRDSに接続するコマンド

mysql -h $RDS_HOSTNAME -u $RDS_USERNAME -p $RDS_DB_NAME

作成済みのDBの文字コードを変更

alter database ebdb character set utf8;

http://blog.serverworks.co.jp/tech/2013/03/12/rds_on_beanstalk/

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7