• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
G*なクラウド 雲のかなたに ショートバージョン
 

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

on

  • 2,101 views

Groovy Grailsをクラウドで活用

Groovy Grailsをクラウドで活用

Statistics

Views

Total Views
2,101
Views on SlideShare
2,100
Embed Views
1

Actions

Likes
0
Downloads
9
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

    • JGGUG japan grails/groovy user group G*
    • 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”)
    • 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
    • JGGUG japan grails/groovy user group
    • JGGUG japan grails/groovy user group
    • Grails PaaS
    • # 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
    • ... ... dataSource { dbCreate = "update" driverClassName = "com.staxnet.jdbc.Driver" url = "jdbc:stax://jggug" username = "tyama" password = "*****" } ... ...
    • ... log4j = { appenders { null name:'stacktrace' ... ...
    • 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
    • $ grails cloud-foundry-xxxxx $ grails cloud-foundry xxxxx
    • 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
    • $ 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'
    • $ 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 ... ...
    • $ 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
    • s/Groovy/Grails/ Gr stringchararrayaccessor.disabled=true
    • grails.project.plugins.dir="plugins"
    • 11
    • 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>
    • 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
    • $ dev_appserver.sh ./war ※Windows .sh!.cmd
    • wget http://grails.jp/sample/gaelyk-setup.sh chmod +x gaelyk-setup.sh ./gaelyk-setup.sh myapp1 ←
    • 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>
    • // 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'
    • mailService.send to: 'foobar@gmail.com', subject: 'Hello World', htmlBody: '<bold>Hello</bold>' datastoreService.withTransaction { // your code }
    • 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) )
    • <system-properties> <property name="file.encoding" value="UTF-8"/> <property name="groovy.source.encoding" value="UTF-8"/> </system-properties>
    • Grails/Groovy http://www.jggug.org/