Dienstag, 21. Juni 2011

Grails Cloud Foundry Integration

Trotz kleiner Fallen geht es sehr einfach, eine Gails-App auf Cloud Foundry laufen zu lassen, denn es gibt ja für alles ein Grails Plugin. Hier zum Beispiel das Plugin Cloud Foundry Integration von Burt Beckwith.

Ich habe das ganze mal mit Eclipse (STS) + Grails-Plugin ausprobiert, geht aber genauso auf der Kommandozeile. Hier die notwendigen Schritte:
  1. Bei Cloud Foundry anmelden
  2. Neues Grails-Projekt cftwest
  3. Grails Command Prompt: install-plugin cloud-foundry
  4. Anmeldedaten von Cloud Foundry in der Datei /cftwest/grails-app/conf/Config.groovy eintragen:

    grails.plugin.cloudfoundry.username = 'xyz@xyz.de'
    grails.plugin.cloudfoundry.password = 'xyz'
  5. Ein kleiner Test:
    Grails Command Prompt: cf-info

    VMware's Cloud Application Platform
    For support visit support@cloudfoundry.com

    Target:   http://api.cloudfoundry.com (v0.999)

    User:     xyz@xyz.de
    Usage:    Memory   (512,0M of 2,0G total)
              Services (1 of 16 total)
              Apps     (1 of 20 total)
  6. Und deployen:
    • Grails Command Prompt: prod cf-push
    • Auf die Frage nicht mit y sondern mit der URL antworten:
      Application Deployed URL: 'cftwest.cloudfoundry.com'?
      cftwest.cloudfoundry.com
    • Service wird noch nicht benötigt:
      Would you like to bind the 'mysql-68c6b11' service? ([y], n)
      n
  7. Jetzt unter http://cftwest.cloudfoundry.com/ aufrufen!
  8. Update der Anwendung mit:
    Grails Command Prompt: prod cf-update

Weitere Infos zum Plugin findet man unter Cloud Foundry Plugin - Reference Documentation und weitere Links zum Thema in Graeme Rocher's Blog.

Als nächstes werde ich das mal zusammen mit CouchDB und Cloudant ausprobieren...