Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails4とさくらのVPSとAWS S3によるスモールスタートWebサービス「ランチボックス...
Search
Hitoshi Kurokawa
December 26, 2013
Programming
2
1.5k
Rails4とさくらのVPSとAWS S3によるスモールスタートWebサービス「ランチボックス」 Kanazawa.rb meetup #16
Kanazawa.rb meetup #16
@DMM.com Labo 金沢事業所 (ポルテ金沢13F)
2013年12月21日
Next SeeD 黒川 仁
Hitoshi Kurokawa
December 26, 2013
Tweet
Share
More Decks by Hitoshi Kurokawa
See All by Hitoshi Kurokawa
Docker + CentOS 6, 8 PHP 動作確認環境の構築
krhitoshi
1
280
Rustで作るi386エミュレータ
krhitoshi
0
200
パスワードの保存方法について Kanazawa.rb meetup #4
krhitoshi
0
100
Other Decks in Programming
See All in Programming
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
390
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
Identifying User Idenity
moro
6
7.6k
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
150
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.6k
Java ジェネリクス入門 2024
nagise
0
600
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
160
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
The Invisible Side of Design
smashingmag
297
50k
Happy Clients
brianwarren
97
6.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Optimizing for Happiness
mojombo
376
69k
Designing for Performance
lara
604
68k
Building Your Own Lightsaber
phodgson
102
6k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
107
49k
Adopting Sorbet at Scale
ufuk
73
9k
Scaling GitHub
holman
458
140k
Transcript
kanazawa.rb meetup #16 @DMM.com Labo ۚࣄۀॴ (ϙϧςۚ13F) 201312݄21 Next SeeD
ࠇ ਔ Rails4 εϞʔϧελʔτ ʮϥϯνϘοΫεʯ
ࠓͷ͓ ࣗݾհ WebαʔϏεʮϥϯνϘοΫεʯͷհ γεςϜߏ WebαʔϏεΛϦϦʔεͯ͠Έͨײ ࢀߟจݙ
ࣗݾհ ࠇ ਔ (krhitoshi) Next SeeD (ݸਓࣄۀओ) WebΤϯδχΞɻγεςϜ։ൃɻαʔόߏஙӡ༻ɻ iOSΞϓϦɻ Ruby,
Ruby on Rails, PHP, CentOS ۚग़ → ઋ → ۚ (2͘Β͍લ)
WebαʔϏε ʮϥϯνϘοΫεʯͷհ
https://www.lunchbox-jp.com
ϥϯνϘοΫεͷ֓ཁ ϥϯνͷ͓૬खΛϚονϯά Facebookೝূ 201312݄5ϕʔλ൛ϦϦʔε (ొड) ࣮࣭తʹࡢ(12݄20)͔Βར༻Մೳ 12݄21ݱࡏ εϚϗ൛ͷΈ ඪ 10ສϢʔβ!!
͡ΊͯͷWebαʔϏε
εφοϓγϣοτ
Team Lunchbox (։ൃνʔϜ) ӡӦɾσβΠϯ ɾɾɾ LSI Inc. http://www.lsi-design.net/
γεςϜ։ൃɾΠϯϑϥอक ɾɾɾ ͱݴͬͯ1ਓ+1ਓͷ2ਓମ੍
γεςϜߏ
γεςϜߏ - ͦͷ1 ͘͞ΒVPS 2G 2 ຊ൪༻ 1ɺεςʔδϯά༻ 1 ϝϞϦ2G,
σΟεΫ200GB, CPU3ίΞ αʔόར༻ྉ 1480ԁ×2 = 2,960ԁ/݄ OS: CentOS AWS S3 ը૾ϑΝΠϧͷকདྷతͳεέʔϧΛߟ͑ͯ ʮ1όΠτ͔Β5ςϥόΠτ·ͰͷσʔλΛؚΉΦϒδΣΫτΛॻ͖ࠐΈɺಡΈࠐ ΈɺআͰ͖·͢ɻ֨ೲͰ͖ΔΦϒδΣΫτͷʹ੍ݶ͋Γ·ͤΜɻʯ ൈ܈ͷίετύϑΥʔϚϯε!!
͘͞ΒVPS ࠓͳΒ͕͍͍͔ͬͪ͜
γεςϜߏ - ͦͷ2 ݴޠɾϑϨʔϜϫʔΫ Ruby 2.0.0 + Rails 4.0.2 ͳΔ͘ݱ࣌Ͱ࠷৽ͷόʔδϣϯΛ༻͍ͨ͠
WebαʔόɺDBαʔό Apache + PassengerɺMySQL ݸਓతʹӡ༻࣮͕͋ΔΈ߹Θͤ ηογϣϯͷอଘ Redis CookieͩͱηΩϡϦςΟతʹ৺ɺϢʔβʹݟͤͨ͘ͳ͍σʔλ
৺͕͚ͨ͜ͱ εϞʔϧελʔτ ΦʔόʔεϖοΫʹͳΒͳ͍Α͏ʹ ίετͰۭඈߦ(ͳΔ͘ܧଓ)Ͱ͖ΔΑ͏ʹ εέʔϧࢹʹೖΕͯ Ϣʔβ૿ՃʹΑΔෛՙ APPαʔό͍ͣΕҠస͢Δ ϢʔβʹΑΓΞοϓ͞ΕΔը૾AWS S3ʹอଘ
RubyʹΑΔFacebookͱͷ ೝূ FacebookͷRuby͚SDKͳ͍ gem omniauth Facebook OAuth 2.0ೝূ https://github.com/intridea/omniauth gem
koala Facebook API ϥΠϒϥϦ https://github.com/arsduo/koala gem 'omniauth' gem 'omniauth-facebook' Twitter, GitHubଞ ଟαʔϏεͷೝূରԠ
Facebook SDKs αʔυύʔςΟSDK https://developers.facebook.com/docs/sdks/#ruby
Facebook௨ ·ͩϕʔλ൛ https://developers.facebook.com/docs/games/ notifications/ uri = URI.parse("https://graph.facebook.com/oauth/access_token?client_id=#{FACEBOOK_CLIENT_ID} &client_secret=#{FACEBOOK_CLIENT_SECRET}&grant_type=client_credentials")! res =
Net::HTTP.get(uri)! post_uri = URI.parse("https://graph.facebook.com/#{user.fb_id}/notifications")! request = Net::HTTP::Post.new(post_uri.path)! access_token = res.gsub("access_token=","")! request.set_form_data({access_token: access_token, template: template}, "&")! http = Net::HTTP.new(post_uri.host, post_uri.port)! http.use_ssl = true! post_res = http.request(request)!
AWS SDK for Ruby Amazon͔ΒgemͰSDKఏڙ http://aws.amazon.com/jp/sdkforruby/ gem 'aws-sdk', '~> 1.0’
AIM (ΞΫηε੍ޚ)ʹϋϚΔ͔
FirefoxϨεϙϯγϒσβΠ ϯϏϡʔ πʔϧ - Web։ൃ - ϨεϙϯγϒσβΠϯϏϡʔ (option + command
+ M ϏϡʔΓସ͑)
SSLূ໌ॻ https://www.lunchbox-jp.com ࠷ॳ͔ΒSSL௨৴Խ config.force_ssl = true (config/environments/production.rb) Positive SSL Wildcard
Common Name: *.lunchbox-jp.com
Ruby, Railsͷ։ൃ ։ൃ։͔࢝ΒϦϦʔε·Ͱ (3ϲ݄) Ruby 2.0.0 p247 → 2.0.0-p353 Ruby
2.1.0-rc1 ຊϦϦʔε ਖ਼ࣜ൛12݄25ϦϦʔε Rails 4.0.0 → 4.0.2 Ͱ͖ΔݶΓ৽͍͠όʔδϣϯΛ༻͍ͨ͠
WebαʔϏεΛϦϦʔε ͯ͠Έͨײ
Rails4ʹؔͯ͠ ྑ͔ͬͨ RailsͬͺΓੜ࢈ੑ͕ߴ͍ ։ൃظؒ 3ϲ݄ ମײతʹಈ࡞͍ ໘ͩͬͨ Asset Pipeline developڥͱproductionڥͱͷဃ͕େ͖͍
turbolinks σβΠϯଆఏڙͷJavaScriptͱڝ߹ ϝϦοτͷํ͕ेʹେ͖͍
·ͱΊͱͯ͠ ! ͘͞ΒVPSͷίεύ࠷ߴ!! ϦϦʔε͢Δ·ͰͰेεΩϧߴ·Δ ͋ͱӡ༻εΩϧߴΊ͍ͨ ར༻͞Εͯಈ͍͍ͯΔγεςϜ͕໘ന͍ Βͳ͍ਓ͕Ξοϓϩʔυ͍ͯ͘͠ը૾ϩάΛோΊΔ σβΠφʔͱΤϯδχΞͷΈ߹Θ͕ͤ໘ന͍ ಘҙͷิؒɺൃͷҧ͍ͷົ ػձ͕͋ΕσβΠφʔͱΜͰԿ͔࡞Ζ͏!!
ࢀߟਤॻ Rails3 RailsʹΑΔΞδϟΠϧWebΞϓ Ϧέʔγϣϯ։ൃ ୈ4൛ Ruby on Rails 3 ΞϓϦέʔγϣϯ
ϓϩάϥϛϯά Rails3͚͚ͩͲे͑ͨ
ࢀߟਤॻ Rails4 WEB+DB PRESS Vol. 73 http://pragprog.com/book/rails4/agile-web-development-with-rails-4 Agile Web Development
with Rails 4
͓ ɹΘɹ Γ