O_k
O_k

Reputation: 1013

Deploying grails 3 app to openshift

I have created a grails 3 app and configured the production environment as follow:

environments {
    production {
        dataSource {
            dbCreate = "update"
            driverClassName = "org.postgresql.Driver"
            dialect= CustomPostgresDialect
            uri = new URI(System.getenv("OPENSHIFT_POSTGRESQL_DB_URL"))
            url = "jdbc:postgresql://" + uri.host + ":" + uri.port + "/" + System.getenv("OPENSHIFT_APP_NAME")
            username = System.getenv("OPENSHIFT_POSTGRESQL_DB_USERNAME")
            password = System.getenv("OPENSHIFT_POSTGRESQL_DB_PASSWORD")
        }
    }
}

and i followed the steps in: https://blog.openshift.com/day-6-rapid-web-development-on-the-jvm-with-grails/

But when i try to access the app URL i get a 404.

And I can't figure out the problem from the logs:

In app-root/logs/postgresql.log

2016-06-20 12:16:20 GMT LOG:  database system is shut down
2016-06-20 12:16:29 GMT LOG:  could not bind socket for statistics collector: Permission denied
2016-06-20 12:16:29 GMT LOG:  trying another address for the statistics collector
2016-06-20 12:16:29 GMT LOG:  could not bind socket for statistics collector: Cannot assign requested address
2016-06-20 12:16:29 GMT LOG:  disabling statistics collector for lack of working socket
2016-06-20 12:16:29 GMT WARNING:  autovacuum not started because of misconfiguration
2016-06-20 12:16:29 GMT HINT:  Enable the "track_counts" option.
2016-06-20 12:16:29 GMT LOG:  database system was shut down at 2016-06-20 12:16:20 GMT
2016-06-20 12:16:29 GMT FATAL:  the database system is starting up
2016-06-20 12:16:29 GMT LOG:  database system is ready to accept connections

In app-root/logs/jbossews.log

Jun 20, 2016 8:16:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Jun 20, 2016 8:16:36 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/5767c8e30c1e6699f90000eb/app-root/runtime/dependencies/jbossews/webapps/ROOT.war
Jun 20, 2016 8:17:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/5767c8e30c1e6699f90000eb/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in 29,596 ms
Jun 20, 2016 8:17:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.12.216.1-8080"]
Jun 20, 2016 8:17:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 29969 ms

What am i missing?

Upvotes: 2

Views: 489

Answers (1)

O_k
O_k

Reputation: 1013

The error was with the setup of spring security. By default, spring security was redirecting to a URL that I do not support.

By going over the documentation I found out that that setting could be overriding as follow:

grails.plugin.springsecurity.auth.loginFormUrl = '/api/login'

if it is not specified spring security will use the default: /login/auth

Spring security defaults

Upvotes: 2

Related Questions