Skip to content

Instantly share code, notes, and snippets.

@usutani
Created October 9, 2011 13:51
Show Gist options
  • Save usutani/1273708 to your computer and use it in GitHub Desktop.
Save usutani/1273708 to your computer and use it in GitHub Desktop.
MySQLを使ったRailsアプリをCloud Foundryにデプロイする
# Rails 3.1.1 (ruby 1.9.2p180)
# Cloud Foundry (Target: v0.999, Client: v0.3.12)
# MySQL database service (5.1)
# APP_NAME
# SERVICE_NAME
# Gemfile
gem 'sqlite3'
group :production do
gem 'thin'
gem 'mysql2', '~>0.3.7'
end
# database.yml
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: APP_NAME_production
pool: 5
# production.rb
config.serve_static_assets = true
# Shell
# gem install mysql2
bundle install
rake assets:precompile RAILS_ENV=production
vmc push APP_NAME --runtime ruby19 --m 64M --no-start -n
vmc create-service mysql --name=SERVICE_NAME --bind=APP_NAME
vmc start APP_NAME
vmc logs APP_NAME
vmc files APP_NAME logs/migration.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment