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
210
パスワードの保存方法について Kanazawa.rb meetup #4
krhitoshi
0
110
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
710
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.8k
Macとオーディオ再生 2024/11/02
yusukeito
0
380
Arm移行タイムアタック
qnighy
0
340
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
240
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
Better Code Design in PHP
afilina
PRO
0
130
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
最新TCAキャッチアップ
0si43
0
200
Ethereum_.pdf
nekomatu
0
470
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Done Done
chrislema
181
16k
Adopting Sorbet at Scale
ufuk
73
9.1k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Into the Great Unknown - MozCon
thekraken
32
1.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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
͓ ɹΘɹ Γ