2011/10/08_Playframework_GAE_to_Heroku

5,375 views

Published on

2011/10/08 に Playframework勉強会で"Play! + GAE アプリをPlay! + Herokuで動かすとどうなるか"というタイトルで発表したスライド

Published in: Technology, Design
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,375
On SlideShare
0
From Embeds
0
Number of Embeds
2,650
Actions
Shares
0
Downloads
22
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 2011/10/08_Playframework_GAE_to_Heroku

    1. 1. Play! + GAE Play! + Heroku @hagikuratakeshi
    2. 2. • ( )Twitter @hagikuratakeshi•
    3. 3. • ( )•(Aws Management Console )• Hadoop
    4. 4.
    5. 5. Play!
    6. 6. BookShelfs•http://books-share.appspot.com/
    7. 7. BookShelfs•••( BookShelves)
    8. 8. BookShelfs•Play!(Java) + GAE + Siena• Amazon API• Twitter4j
    9. 9. Play! ?•Java••@ikeike443
    10. 10. GAE ?••Play! GAE Module •> play install gae•PaaS
    11. 11. Siena ?•GAE Datastore O/R•Play! Module •> play install siena•Playframework GAE/ Siena
    12. 12. GAE
    13. 13. ※ DisGAE
    14. 14. ••$8/ • SpinUp Always On ($0.30/ ) ( 3Instance )
    15. 15. ••$180/
    16. 16. $100
    17. 17. Heroku•Ruby PaaS (Java, Clojure, Node.js )•Play! !!•No vendor lock in !!• (Small Start )
    18. 18. Heroku
    19. 19. GAE, Siena
    20. 20. •$ heroku login•$ git init•$ git add .•$ git commit -m init•$ heroku create --stack cedar•$ git push heroku master
    21. 21. •http://bookshelfs-siena- local.herokuapp.com/
    22. 22. •Siena GAE →Heroku Deploy
    23. 23. ��������������
    24. 24. →Siena Model
    25. 25. Heroku PostgreSQL
    26. 26. JPAmodels
    27. 27. Siena 2.0 GAE MySQL/PostgreSQL/Hbase�����������������
    28. 28. Siena/PostgreSQL
    29. 29. 1•Model List →
    30. 30. 2•Model User -> Account PostgreSQL User Table
    31. 31. GAE Module•GAE Module •Task Queue (Tweet Queueing) • com.google.appengine.api.datastore.Blob •
    32. 32. KVS -> RDB•GAE BigTable -> PostgreSQL → → KVS → RDB →
    33. 33. KVS•Book Accountid account id name101 A01 A01 User1102 A01 A02 User2
    34. 34. (1/2)• Book id account name 101 A01 User1 102 A01 User1
    35. 35. (2/2) • Java@Overridepublic JsonElement serialize(Book book, Type type) { Account owner = Account.findById(book.ownerUserId); result.add("owner", gson.toJsonTree(owner));}
    36. 36. RDB• →•RDB -> KVS → join SQL
    37. 37. •BookShelfs Java → BigTable ( KVS) →
    38. 38. DB Index (1/3)•GAE filter, order Query Index -> deploy → datastore-indexes-auto.xml
    39. 39. DB Index (2/3) List<Borrow> borrows = Borrow.all().filter("borrowerUserId",userId) .filter("status ", BookStatus.RETURNED) .order("-createdAt") .fetch(); Index
    40. 40. DB Index (3/3)•Siena PostgreSQL Index annotation Index → Index ? → (fullscan, sort)
    41. 41. Heroku$ git commit$ git push heroku master
    42. 42. •http://bookshelfs- postgres.herokuapp.com/
    43. 43. HerokuGAE
    44. 44. GAE Datastore CSV URL:http://d.hatena.ne.jp/eller/20110103
    45. 45. Heroku PostgreSQL•$ heroku db:push → DB push sqlite PostgreSQL CSV
    46. 46. GAE → Heroku
    47. 47. Deploy••GAE -> $ play gae:deploy•Heroku -> $ git push heroku master (git )
    48. 48. •Heroku (2011/11 ) •GAE -> $180 (BookShelfs ) •Heroku -> $0 $15 (Shared Database )
    49. 49. •Heroku SpinUp →Amazon Ec2 Instance•DB
    50. 50. HerokuAddon
    51. 51. MongoDB Hosting Addon
    52. 52. MongoDB Module Play! → Morphia
    53. 53. Morphiapackage models;import play.data.validation.Email;import play.data.validation.Required;import play.modules.morphia.Model; Morphia Modelimport play.modules.morphia.Blob;import com.google.code.morphia.annotations.Entity;@Entitypublic class User extends Model { @Email @Required public String email; @Required public String password;
    54. 54. Model→Siena
    55. 55. Siena MongoDB PersistenceManager��������������
    56. 56. 1
    57. 57. Siena 2.0
    58. 58. Sienaapplication.confMongo PersistenceManager ↓play.modules.siena.SienaPlugin
    59. 59. application.confdb=mongodbsiena.mongodb.hostnames=dbh55.mongolab.com:27557siena.mongodb.databaseName=heroku_appxxxxxxxxsiena.mongodb.userName=heroku_appxxxxxxxsiena.mongodb.password=xxxxxxxxxxxxx
    60. 60. •http://bookshelfs- mongo.herokuapp.com/
    61. 61. MongoDB
    62. 62. DB Siena-MongoDB Merge→
    63. 63. •2011/11 Heroku PostgreSQL or MongoDB• OpenSource•Siena-MongoDB Merge
    64. 64. •No vendor lock in →Siena PostgreSQL•Play! + Heroku
    65. 65. • GAE ( URL • http://books-share.appspot.com/• Heroku • Siena-GAE(Ec2 ) • http://bookshelfs-siena-local.herokuapp.com/ • Siena-PostgreSQL • http://bookshelfs-postgres.herokuapp.com/ • Siena-MongoDB ( ) • http://bookshelfs-mongo.herokuapp.com/

    ×