Ayer hablábamos de que sería bueno publicar estas cosas que vamos haciendo, para no olvidarlas y para poder compartirlas… así que volverán las notas técnicas al blog.
Pueden optar por seguir este tutorial (en el cual yo me basé) o utilizar la versión simplificada que les presento, que evita problemas que ya veremos más adelante
lucas@atlantis:~/workspace-grails$ grails create-app herokutest | Created Grails Application at /home/lucas/workspace-grails/herokutest lucas@atlantis:~/workspace-grails$ cd herokutest/ lucas@atlantis:~/workspace-grails/herokutest$ grails uninstall-plugin hibernate | Uninstalled plugin [hibernate]
Agregamos a BuildConfig.groovy el plugin:
plugins {
compile ':heroku:1.0'
...
}
Y asegurémonos de quitar el de Hibernate.
lucas@atlantis:~/workspace-grails/herokutest$ git init Initialized empty Git repository in /home/lucas/workspace-grails/herokutest/.git/ lucas@atlantis:~/workspace-grails/herokutest$ heroku create --stack cedar Creating morning-frost-8251... done, stack is cedar http://morning-frost-8251.herokuapp.com/ | git@heroku.com:morning-frost-8251.git Git remote heroku added lucas@atlantis:~/workspace-grails/herokutest$ grails create-controller info | Uninstalled plugin [memcached] | Uninstalled plugin [mongodb] | Compiling 53 source files | Created file grails-app/controllers/herokutest/InfoController.groovy | Created file grails-app/views/info | Created file test/unit/herokutest/InfoControllerTests.groovy
Creamos el archivo /grails-app/views/info/index.gsp con el siguiente contenido:
<html>
<body>
<h1>Hola!</h1>
</body>
</html>
lucas@atlantis:~/workspace-grails/herokutest$ grails integrate-with --git
| Created Git project files..
lucas@atlantis:~/workspace-grails/herokutest$ git add .
lucas@atlantis:~/workspace-grails/herokutest$ git commit -m "Commit inicial"
[master (root-commit) 93196c2] Commit inicial
61 files changed, 2817 insertions(+), 0 deletions(-)
...
lucas@atlantis:~/workspace-grails/herokutest$ git push heroku master
lucas@atlantis:~/workspace-grails/herokutest$ git push heroku master
Counting objects: 82, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (73/73), done.
Writing objects: 100% (82/82), 98.53 KiB, done.
Total 82 (delta 2), reused 0 (delta 0)
-----> Heroku receiving push
-----> Grails app detected
-----> Grails 2.0.0 app detected
-----> Installing Grails 2.0.0.....
-----> Done
-----> Executing grails -plain-output -Divy.default.ivy.user.dir=/app/tmp/repo.git/.cache war
|Loading Grails 2.0.0
|Configuring classpath
...
|Building WAR file
......................................
|Done creating WAR target/herokutest-0.1.war
-----> No server directory found. Adding jetty-runner 7.5.4.v20111024 automatically.
-----> Discovering process types
Procfile declares types -> (none)
Default types for Grails -> web
-----> Compiled slug size is 26.4MB
-----> Launching... done, v5
http://morning-frost-8251.herokuapp.com deployed to Heroku
To git@heroku.com:morning-frost-8251.git
* [new branch] master -> master
Y podemos ver el resultado, o el repositorio con el proyecto entero.
¡Feliz Heroku para todos! ;)

