Your SlideShare is downloading. ×
  • Like
G*なクラウド 雲のかなたに ショートバージョン
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

G*なクラウド 雲のかなたに ショートバージョン

  • 1,461 views
Published

Groovy Grailsをクラウドで活用

Groovy Grailsをクラウドで活用

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,461
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
9
Comments
0
Likes
0

Embeds 0

No embeds

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. JGGUG japan grails/groovy user group G*
  • 2. JGGUG japan grails/groovy user group 2009/11/19 @JSUG JGGUG 2009/11 def speaker = new Cast(name:”T.Yamamoto”,version:”Sp-2009-11-19”)
  • 3. JGGUG japan grails/groovy user group DTP DTP Web Web 80% Grails JGGUG( ) Grails 9-11 Grails Acegi Plugin http://d.hatena.ne.jp/mottsnite/ twitter @tyama
  • 4. JGGUG japan grails/groovy user group
  • 5. JGGUG japan grails/groovy user group
  • 6. Grails PaaS
  • 7. # 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
  • 8. ... ... dataSource { dbCreate = "update" driverClassName = "com.staxnet.jdbc.Driver" url = "jdbc:stax://jggug" username = "tyama" password = "*****" } ... ...
  • 9. ... log4j = { appenders { null name:'stacktrace' ... ...
  • 10. 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
  • 11. $ grails cloud-foundry-xxxxx $ grails cloud-foundry xxxxx
  • 12. grails create-app sampleapp cd sampleapp Grails grails install-plugin clould-foundry vi grails-app/conf/CloudFoundry.groovy cp ../CloudFoundry.groovy !$ grails war grails cloud-foundry-deploy grails cloud-foundry-info grails war grails cloud-foundry-upload grails cloud-foundry-redeploy grails cloud-foundry-stop
  • 13. $ grails create-app mygaeapp ← appengine (Config.groovy google.appengine.application="mygaeapp" OK) $ cd mygaeapp $ grails install-plugin app-engine jpa/jdo ”jpa” OK export APPENGINE_HOME=/opt/appengine-java-sdk-1.2.6 google.appengine.sdk='/opt/appengine-java-sdk-1.2.6'
  • 14. $ grails install-plugin gorm-jpa app-engine $ grails create-domain-class jp.grails.Chat $ grails generate-all jp.grails.Chat @Entity class Chat implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id ... ... @Column String message JPA class Chat { ... ... String message ... ...
  • 15. $ grails app-engine run = GAE grails set-version 1 GAE grails app-engine package GAE SDK $APPENGINE_HOME/bin/appcfg.sh update ./target/war grails app-engine deploy
  • 16. s/Groovy/Grails/ Gr stringchararrayaccessor.disabled=true
  • 17. grails.project.plugins.dir="plugins"
  • 18. 11
  • 19. import groovy.xml.StreamingMarkupBuilder import groovy.xml.MarkupBuilder includeTargets << new File("${appEnginePluginDir}/scripts/_AppEngineCommon.groovy") eventStatusFinal = { msg -> def appXmlFile = new File("$stagingDir/WEB-INF/appengine-web.xml") def xml = new XmlSlurper().parse(appXmlFile) xml."system-properties".appendNode { property(name:"stringchararrayaccessor.disabled",value:"true") } def smb = new StreamingMarkupBuilder() def result = smb.bind{ mkp.declareNamespace("":"http://appengine.google.com/ns/1.0") mkp.yield xml } new FileOutputStream(appXmlFile).withWriter('UTF8'){w-> w << result } } <appengine-web-app xmlns='http://appengine.google.com/ns/1.0'> <application>jggugv4</application> <version>2</version> <sessions-enabled>true</sessions-enabled> <ssl-enabled>true</ssl-enabled> <system-properties> <property name='stringchararrayaccessor.disabled' value='true'/> </appengine-web-app>
  • 20. APPENGINE_HOME export APPENGINE_HOME=/opt/appengine-java-sdk-1.2.6 grails install-plugin app-engine grails install-plugin gorm-jpa grails app-engine run grails set-version 1 grails app-engine package GAE SDK $APPENGINE_HOME/bin/appcfg.sh update ./target/war grails app-engine package $APPENGINE_HOME/bin/appcfg.sh update ./target/war
  • 21. $ dev_appserver.sh ./war ※Windows .sh!.cmd
  • 22. wget http://grails.jp/sample/gaelyk-setup.sh chmod +x gaelyk-setup.sh ./gaelyk-setup.sh myapp1 ←
  • 23. request['name'] = params.name request['list'] = [1, 2, 3, 4] request['date'] = new Date() forward 'example.gtpl' <html>     <body> <h2>${request.name}</h2>     <% request.list.each { number -> %>         <p>${number}</p>     <% } %>         <p>${request.date}</p>     </body> </html>
  • 24. // params request['name'] = params.name //request.setAttribute('list', [1, 2, 3, 4]) request['list'] = [1, 2, 3, 4] request.date = new Date() forward 'example.gtpl'
  • 25. mailService.send to: 'foobar@gmail.com', subject: 'Hello World', htmlBody: '<bold>Hello</bold>' datastoreService.withTransaction { // your code }
  • 26. import com.google.appengine.api.datastore.Entity def person = new Entity("person") person['name'] = " " println person['name'] person.age = 27 println person.age // person.save() // person.delete() // def q = new Query('person') def list = datastoreService.prepare(q).asList( Builder.withLimit(20).offset(0) )
  • 27. <system-properties> <property name="file.encoding" value="UTF-8"/> <property name="groovy.source.encoding" value="UTF-8"/> </system-properties>
  • 28. Grails/Groovy http://www.jggug.org/