3.0.0.M1 how to run on https connection - grails

Trying Grails 3.0.0.M1, a lot has changed!
How would I run-app --https and how would I configure it that way also for the production-environment-war?
Many thanks!

First of all, Grails 3.0.0.M1 is not production ready, if thinking about making the move.
Major changes for Grails 3 include:
Built on top of Spring Boot
Introduction of Gradle as the build system
And many more (which is not relevant to this question)
In order to setup SSL for Spring Boot app, server.ssl.* setting has to be added to application.properties or application.yml file.
In Grails 3 it would correspond to application.yml under grails-app/conf. Below changes (as an example) would be required:
server:
port: 8443
ssl:
key-store: classpath:keystore.jks
key-store-password: secret
key-password: another-secret
which is equivalent to Configuring SSL in Spring Boot.
However, documentation is limited right now and is being worked on. So let Grails 3 brew more until its GA where it can be used in production environment.
Grails community will be more than happy if any issues/problems/enhancement is reported in Grails JIRA

Related

Dataflow 1.2.0 YAML configuration changes

Yesterday I upgraded my development environment to Spring Cloud Dataflow 1.2.0 and all of my sink/source apps dependencies.
I have two main issues:
javaOpts: -Xmx128m is not longer being picked up, so locally deployed apps have the default Xmx value.
Here is the format of my previously working Dataflow yaml config.
See full here: https://pastebin.com/p1JmLnLJ
spring:
cloud:
dataflow:
applicationProperties:
stream:
spring:
cloud:
deployer:
local:
javaOpts: -Xmx128m
Kafka config options like ssl.truststore.location etc. are not being read correctly. Another stackoverflow post indicated these must be marked like this "[ssl.truststore.location]". Is there some documented working yaml config or list of breaking changes with 1.2.0? The file based authentication block was also moved, and I was able to figure that one out.
Yes, It looks like a bug in Spring Cloud Local Deployer to consider the common application properties passed via args. Created https://github.com/spring-cloud/spring-cloud-deployer-local/issues/48 to track this.

Grails get stuck at "finished configuring Spring Security REST"

I type grails run-app and it begins to run, but it gets stuck on the message:
----------------------------------------
Current config:
baseDir: db/migration/global
env: DEVELOPMENT
dataSource: default
url: jdbc:postgresql://localhost:5432/mydbapp
username: postgres
schemas: public
----------------------------------------
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security REST ...
... finished configuring Spring Security REST
It used to run fine like an hour ago. No strange logs or anything. Also, when hit ctrl+c in the terminal, grails will close, but when I run-app again, it will say something like:
Error Server failed to start for port 8080: Address already in use (Use --stacktrace to see the full trace)
Indicating that grails wasn't really terminated. Of course, I kill the app occupying 8080 and run-app again, but it's still getting stuck.
The port 8080 is been used for another thread. Try to find a java thread in your system that you don't recognize and stop it.
How to on windows
How to on Linux
In BuildConfig.groovy, change your apps port. Example:
grails.server.port.http = 8003
If you still get port in use, exit IntelliJ, goto Task Manager, sort by memory used, end any processes with IntelliJ or Grails.
If you are using liquibase database migration tool and if you somehow stopped it before it finishes it will put a lock at DATABASECHANGELOGLOCK table. Change it to LOCKED = false and it will start.

How to solve cross domain errors when running two grails apps on localhost

I am trying to run-app my project with other wars/wars also running. So for example we have a war/ear that has legacy web services that I would like to access. My goal is to deploy those existing wars/ears with my run-app. I can deploy both separately, as grails run-app on port 8081 and jboss on port 8080. The problem was when I tried to do a ajax POST, DELETE, or PUT I get a cross-domain error because each app is on its own port. Is there a way to use run-app so that my grails project is at localhost:8080/grails and the webservices are at localhost:8080/webservices
Env: Grails 2.1.1
Server: Jboss (perfered) or vFabric tc Server (by dropping in existing war/war)
I don't believe that you can "run-app" both projects on the same port because you're running an embedded container. However, what you can do is check out the Grails CORS plugin which will allow other domains to access your grails app during run-app or otherwise.
http://grails.org/plugin/cors

Grails application behind https

I've been playing with Grails for few months and I've just build my first app. Can someone tell me how to put my grails application behind https? I used Grails 1.3.7, Spring Security Core 1.2.7.2 and deployed it on Tomcat 7. If you need more info please say so.
If you're just using Tomcat you'll need to install an SSL cert for Tomcat. The details of that process are too lengthly, IMHO, for SO. Especially when the information is readily available on the web:
Install SSL Cert
You can also run it locally during dev in https mode by appending -https to your run-app command.

how can i convert my grails application from http to https under Linux operating system?

how can i convert my grails application from http to https under Linux operating system
the configuration depends on what container you are running the application in your production environment. You should be deploying a war to your Production Server not doing a grails run-app -https
here is a stackoverflow question with a configuration for Tomcat.
I am certain you can google around and find proper configuration based on your application server
What do you mean by "convert"?
You can run the embedded tomcat with HTTPS enabled by adding -https to the run-app command:
grails run-app -https
If you want HTTPS enabled in production then you need to configure your app server to support it.

Resources