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
290
Rustで作るi386エミュレータ
krhitoshi
0
220
パスワードの保存方法について Kanazawa.rb meetup #4
krhitoshi
0
110
Other Decks in Programming
See All in Programming
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
php-conference-japan-2024
tasuku43
0
300
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Refactor your code - refactor yourself
xosofox
1
260
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
410
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
100
Beyond ORM
77web
7
840
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
410
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
430
Featured
See All Featured
Speed Design
sergeychernyshev
25
670
Docker and Python
trallard
42
3.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Automating Front-end Workflow
addyosmani
1366
200k
Designing Experiences People Love
moore
138
23k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
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
͓ ɹΘɹ Γ