G*なクラウド ~雲のかなたに~
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

G*なクラウド ~雲のかなたに~

  • 3,588 views
Uploaded on

日本 Java ユーザグループ CCC Fall 2009 でのスライドです。...

日本 Java ユーザグループ CCC Fall 2009 でのスライドです。
「G*なクラウド ~雲のかなたに~」
まわりを見渡せばクラウドの話で持ちきりです。様々なフレームワークがクラウドに対応するなか、もちろんG*なクラウド活用法も存在します。Grails でプラグインを使ってGAE/Jに対応や、Cloud Foundry(EC2)、GroovyでのGAE/J「Gaelyk」など、Grails/Groovyでのクラウドを紹介・解説します。

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,588
On Slideshare
2,964
From Embeds
624
Number of Embeds
5

Actions

Shares
Downloads
22
Comments
0
Likes
3

Embeds 624

http://d.hatena.ne.jp 613
http://webcache.googleusercontent.com 6
http://www.slideshare.net 2
http://hatenatunnel.appspot.com 2
http://s.deeeki.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 2009/10/08 @JJUG CCC def speaker = new Cast(name:”T.Yamamoto”,version:”G*C-2009-10-08”)
  • 2. ( ) DTP Web 75%Grails JGGUG( ) Grails 9-11 Grails Acegi Plugin http://d.hatena.ne.jp/mottsnite/ twitter @tyama
  • 3. JGGUG japan grails/groovy user group
  • 4. JGGUG japan grails/groovy user group
  • 5. Grails CMS
  • 6. JGGUG japan grails/groovy user group
  • 7. Grails PaaS
  • 8. # curl -L http://stax-downloads.s3.amazonaws.com/sdk/ stax-sdk-0.3.6-dist.zip > stax_sdk.zip # unzip stax_sdk.zip # rm stax_sdk.zip # cd stax-sdk-0.3.6 export STAX_HOME=/opt/stax-sdk-0.3.6 export PATH=$PATH:$STAX_HOME
  • 9. ... ... dataSource { dbCreate = "update" driverClassName = "com.staxnet.jdbc.Driver" url = "jdbc:stax://jggug" username = "tyama" password = "*****" } ... ...
  • 10. ... log4j = { appenders { null name:'stacktrace' ... ...
  • 11. Cloud Tool grails create-app demo cd demo grails install-plugin cloud-tool.zip Config.groovy import aws.properties grails cloud-tools-deploy grails cloud-tools-describe grails cloud-tools-stop
  • 12. war DB
  • 13. IP
  • 14. DB EBS
  • 15. UPTIME
  • 16. Apache tc Server MySQL
  • 17. HTTPD TC
  • 18. AWS ACCESS KEY ID KEY PAIRS
  • 19. SSH
  • 20. export APPENGINE_HOME=/opt/appengine-java-sdk-1.2.5 google.appengine.sdk='/opt/appengine-java-sdk-1.2.5'
  • 21. $ grails install-plugin app-engine Do you want to use JPA or JDO for persistence? (jpa, jdo) jpa grails-app/conf/ datastore-indexes.xml persistence.xml grails-app/conf/Config.groovy GAE google.appengine.application="jggugv4" Grails
  • 22. $ grails install-plugin gorm-jpa resources.groovy entityManagerFactory transactionManager entityManagerFactory(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) { beanClassLoader = ref("classLoader") } transactionManager(org.springframework.orm.jpa.JpaTransactionManager) { entityManagerFactory = entityManagerFactory } datanucleus-enhancer*.jar cp $APPENGINE_HOME/lib/tools/orm/datanucleus-enhancer-1.1.4.jar lib
  • 23. import org.datanucleus.jpa.annotations.Extension import javax.persistence.*; @Entity class Event implements Serializable { @Id @GeneratedValue (strategy = GenerationType.IDENTITY) @Extension (vendorName = "datanucleus", key = "gae.encoded-pk", value = "true") String id /** */ @Column // String eventName
  • 24. def save = { def eventInstance = new Event(params) Event.withTransaction{ if(eventInstance.save(flush:true)) { flash.message = "Event ${eventInstance.id} created" redirect action:"show", id:eventInstance.id } else { render view:'create', model:[eventInstance:eventInstance] } } }
  • 25. $ grails set-version 1 $ grails app-engine run
  • 26. $ grails set-version 1 $ grails app-engine deploy $ grails app-engine package $ rm target/war/WEB-INF/lib/jul-to-slf4j-1.5.6.jar $ appcfg.sh update ./target/war
  • 27. $ dev_appserver.sh ./war ※Windows .sh→.cmd
  • 28. View request.setAttribute 'list', [1, 2, 3, 4] request.setAttribute 'date', new Date()   forward 'display.gtpl'
  • 29. mailService.send to: 'foobar@gmail.com', subject: 'Hello World', htmlBody: '<bold>Hello</bold>' datastoreService.withTransaction { // your code }
  • 30. import com.google.appengine.api.datastore.Entity def person = new Entity("person") person['name'] = " " println person['name'] person.age = 31 println person.age // person.save() // person.delete() // def q = new Query('person') def list = datastoreService.prepare(q).asList( Builder.withLimit(20).offset(0) )
  • 31. <system-properties> <property name="file.encoding" value="UTF-8"/> <property name="groovy.source.encoding" value="UTF-8"/> </system-properties>
  • 32. $ ./gaelyk-setup.sh myapp001
  • 33. Grails/Groovy http://www.jggug.org/