We have a moderately sized Grails web application using GORM/Hibernate over PostgreSQL and GSPs serving HTML, and also a few REST APIs. We are standardising on Scala, and would like to migrate this application to Play or Spray, with Slick to access the existing database.

Nimble is currently used for authentication/authorisation and user/role/etc. management.

What are the approaches we can take in order to do the migration step by step, avoiding a big bang migration?

They are both JVM languages, is there a way to avoid treating them as separate web apps running on separate ports at arms length?

  • Fun with project names, but a reasonable approach could be to use an application proxy to provide a single namespace. Another option is to run them as separate WAR files in a web container like Tomcat. I've not done Grails or Scala, but if the web APIs are a wrapper around Java Servlets then you are golden. If not, you'll have to use the app proxy to hide the separate ports, etc. – Berin Loritsch Dec 18 '17 at 14:35

Personally, a rewrite sounds more efficient to me, but if you need to do it in stepwise pieces I would suggest you take the following approach:

  • Move your existing database code to use Slick (you'll probably need wrappers around it to shield your existing code from too many changes).
  • Next, integrate Play into your runtime and use Silhouette for authentication and authorization with Play Actions.
  • You should then be able to move individual GSPs to Play/Twirl one at a time.

Unfortunately, I don't know of a way to make them listen to the same port so you'd have to redirect from Grails to the Play port in order to make it seamless.

Your Answer

