Starting MOGOK - やさしい MOGOK の始めかた -
-
Upload
tomokazu-kiyohara -
Category
Technology
-
view
2.579 -
download
0
description
Transcript of Starting MOGOK - やさしい MOGOK の始めかた -
2013/02/16 Kanazawa.rb Meetup #6
Starting MOGOK~ やさしい MOGOK の始めかた ~
What is
MOGOK
✤ IIJ (Internet Initiative Japan) が提供する
✤ Ruby on Rails アプリケーションの
✤ 開発支援環境と実行環境を
✤ 提供するサービス
PaaS(Platform as a Service)
MOGOK
✤ IIJ (Internet Initiative Japan) が提供する
✤ Ruby on Rails アプリケーションの
✤ 開発支援環境と実行環境を
✤ 提供するサービス
PaaS(Platform as a Service)
!提供 : 今はすべて無償
MOGOK (開発支援環境)
✤ Web UI
✤ アプリケーション管理
✤ ドキュメント・フォーラム
✤ CLI (gem として提供)
✤ Git リポジトリ (最大 100MB)
MOGOK (実行環境)
✤ Web
✤ 1 process
✤ 400MB memory
✤ 150MB file (w/ gems)
✤ Thin/Ruby 1.9.3/RoR 3.x
✤ *.ruby.iijgio.com
✤ DB
✤ 1 connection
✤ 100MB memory
✤ 100MB data
✤ MySQL 5.5
MOGOK (実行環境)
✤ Web
✤ 1 process
✤ 400MB memory
✤ 150MB file (w/ gems)
✤ Thin/Ruby 1.9.3/RoR 3.x
✤ *.ruby.iijgio.com
✤ DB
✤ 1 connection
✤ 100MB memory
✤ 100MB data
✤ MySQL 5.5
いずれは有償プランも
How to
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
Git の導入
$ cd <your RoR app dir>
$ git init
$ git add .
$ git commit -m "first commit"
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
RoRアプリケーションのコンフィグ設定
✤ Bundler (Gemfile)
✤ Env (config/environments/production.rb)
Bundler
:
gem 'mysql2'
gem 'therubyracer', :platforms => :ruby
$ vim Gemfile
✤ MOGOK 環境で必要となる gem を設定
Env
$ vim config/environments/production.rb
:
config.serve_static_assets = true
:
✤ /public/* 等の static コンテンツを有効化
✤ (おそらく)あらかじめ false 設定があるので true に変更
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
MOGOK CLI のインストール
✤ gem ファイルのダウンロード
MOGOK CLI のインストール
✤ gem ファイルのインストール
$ gem install mogok-x.x.x.gem
$ mogok list
$ mogok --help
✤ MOGOK アカウントの "ID/Password" が求められる
✤ 最初の1回のみ
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
MOGOKへのデプロイ
✤ アプリケーション登録
✤ 資材の転送
✤ アプリケーション構築
アプリケーション登録
$ mogok create <app name>
✤ RoR app dir で実行することを強く推奨
✤ Git remote に MOGOK 環境が登録される※ MOGOK CLI はこの値を参照しながら動作する(--app option もあるがかなり面倒)
✤ <app name> は MOGOKシステム全体で一意
✤ <app name>.ruby.iijgio.com
資材の転送
$ git push mogok master
✤ MOGOK アカウントの "ID/Password" が求められる
✤ 毎回入力が必要
✤ "$ git config credential.helper store" しておくと楽
✤ "~/.git-credentials" に保存されるので扱いには注意
tips
アプリケーション構築
$ mogok build
$ mogok rake db:migrate
Flow
✤ Git の導入
✤ RoR アプリケーションのコンフィグ変更
✤ MOGOK CLI のインストール
✤ MOGOK へのデプロイ
✤ アプリケーション管理
アプリケーション管理
$ mogok info
$ mogok start
$ mogok stop
$ mogok restart
✤ MOGOK CLI からの操作
アプリケーション管理
✤ Web UI からの操作
Conclusion
まとめ
✤ Ruby on Rails な PaaS
✤ !版だが無料でかなりの機能が使える
✤ Git & mogok コマンドでデプロイ
✤ mogok コマンド or Web UI でコントロール
Thank you
Tomokazu Kiyoharahttp://facebook.com/tomokazu.kiyoharahttp://twitter.com/kiyohara
extra
Bundlertips
✤ 開発環境とMOGOK環境で依存 gem を分けると便利
✤ 開発環境に MySQL が入っていないときなど
group :mogok do
gem 'mysql2'
gem 'therubyracer', :platforms => :ruby
end
$ vim Gemfile
✤ MOGOK 環境向け gem を group 化
Bundlertips
:
BUNDLE_WITHOUT: mogok
$ vim .bundle/config
✤ 開発環境では bundle command の対象外に指定
Bundlertips
✤ config/database.yml
✤ 特別に編集する必要なし
✤ MOGOK環境デプロイ時には専用のものが利用される
Envtips
✤ "$mogok build" したら
✤ "$ mogok restart" →×✤ "$ mogok stop; mogok start" →○
build & restarttips