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
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
190
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
10
1.3k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
880
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
役立つログに取り組もう
irof
28
9.6k
Realtime API 入門
riofujimon
0
150
受け取る人から提供する人になるということ
little_rubyist
0
230
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
940
Arm移行タイムアタック
qnighy
0
330
Featured
See All Featured
Docker and Python
trallard
40
3.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
The Cult of Friendly URLs
andyhume
78
6k
Being A Developer After 40
akosma
87
590k
4 Signs Your Business is Dying
shpigford
180
21k
Happy Clients
brianwarren
98
6.7k
A Philosophy of Restraint
colly
203
16k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
What's new in Ruby 2.0
geeforr
343
31k
A better future with KSS
kneath
238
17k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
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
͓ ɹΘɹ Γ