grails 2.0 - deploying WAR to remote server (Tomcat), not connecting - grails

I generally run Grails 2.0 from my IDE but have been seeking to deploy an app to a remote Virtual Private Server (linux) where I installed Tomcat and Mysql. I create a production WAR file and copy it to the Tomcat webapps dir, where I can see Tomcat restart and after some "fixing" I see the application come up, adding minimal bootstrap entries into the MySql database fine.
However, I cannot connect to the Grails app (remotely). If I specify www.mydomain.com, I am (finally) able to reach the main Tomcat server "welcome page". I also reach Tomcat if I add a "/" at the end, not my grails app.
As such I'm tried putting in full controller paths that I know work on my dev machine, and then accessing them on the remote machine (note grails.serverURL is configured as http://www.mydomain.com). Doing this, I get
HTTP Status 404 -- The requested resource (/BareBones/bare/create) is not available.
This error is from a BareBones application I created, as I was having some problems with VPS available memory. In any case, on my dev machine I can reach the this BareBones app URL
http://localhost:8080/BareBones/bare/create
as expected. When I deploy, I get the same HTTP Status 404 error (resource not available) when I do:
http://www.mydomain.com/bare/create
In Config.groovy, in this BareBones app I've got the minimal change:
environments {
development {
grails.logging.jul.usebridge = true
}
production {
grails.logging.jul.usebridge = false
grails.serverURL = "http://www.mydomain.com"
}
}
In my Tomcat server.xml file I changed over from the default 8080/8443 ports to 80/443, but using either either set results in the same problem.
I'm probably missing an easy step, just don't know what it is.
P.S. When I deploy the sample.war file that comes with Tomcat (isn't Grails, just a hello-world servlet), it works. I'm able to access that at
www.mydomain.com/sample
Since I FTP'd sample.war from my computer to the server, it would appear to indicate my FTPs are good, and the routing to the server is right, narrowing this down to Grails & Tomcat.

Usually in dev mode Grails mounts, as you pointed out, the context of appName, i.e. http://localhost:8080/BareBones/ here.
But the path it mounts on tomcat is not up to Grails itself, it is wholly dependent on the Tomcat configuration and primarily the name of the WAR file.
Even if you have BareBones as your appName and you deploy it as ROOT.war then it will mount the root "/" context. If you deploy it as BareBones.war then it should mount the same dir as in dev mode.
Because sites are usually mounted as ROOT.war "/", I can recommend setting
grails.app.context = "/"
in your Config.groovy file which will make it so that you will use the root context path also in dev, i.e. http://localhost:8080/
This makes it simpler since both dev and production will now have identical relative paths to everywhere and only the hostname:port will change.

Related

How do i deploy a blazor docker container application to multiple environments?

I've got a blazor server and client side application that is deployed into a docker container. I have multiple appsettings.json files. Each file should be deployed with its corresponding environment
I've seen some discussions which assert that the ASPNETCORE_ENVIRONMENT needs to be set for the server side application, which would automatically set the same value for the client side application. I've tried this. However, it seems that for the dev environment example, the appsettings.json file is still being used. I get a sign in error on the deployed dev environment which indicates that it's still using the appsettings.json file.
thanks
This was happening because we incorrectly set the ASPNETCORE_ENVIRONMENT correctly in the server application. Once we did that, it worked.

Deploy Rails server on Digital Ocean, works with direct IP address only, not with domain name

Got server deployed in production mode through this tutorial.
It works on my direct Digital Ocean IP address, but my domain name still shows ZPanel
Have you installed mod_passenger?
Have you created the virtual host in your apache httpd.conf?
Have you restarted apache?
Hint: put a index.html file in your application - public/ directory and some gibberish in it, then see if it loads fine in your browser. If it does not, then your apache config needs work, if it does but the Rails app still won't work, you should look at that one instead.

Is there a way make a Grails app aware of changes in properties file without server restart?

I've externalized the properties file for my production Grails app running on Tomcat.
I'm wondering if there is a way the Grails app will read the configs from the config file in real time instead of having the changes take affect only after server restart.
For example, I'm using the LDAP plugin which has the following config:
grails.plugin.springsecurity.ldap.context.managerDn = 'somethinghere'
If I change the above setting in the external config file the server needs to be restarted for it to take effect.
I googled "grails external reload" and the first result was http://grails.org/plugin/external-config-reload

How to make GlassFish web server use JRuby on Rails?

I installed Ubuntu, GlassFish web server, installed JRuby on Rails using GlassFish's admin tools, deployed my application from .war archive. The problem is only - when I attempt to run this web application nothing happens. GlassFish isn't listening on port 8080 as promised. The GlassFish administration web console listens on port 4848 and works fine. What to do to pair GlassFish and JRuby on Rails the correct way, remembering that it isn't a separate JRuby installation?
Update: it seems that this problem lies somewhere around access rights because I can deploy an application through
sudo ./asadmin deploy
but can not do the same through web console. The output is as if the application has been deployed, without any error messages (web interface shows the presence of application, domain folder contains my application's file/folder structure), but something in server's internals isn't bound to application.
I didn't think much and applied quick and dirty solution: set "777" access rights to /home/glassfish and all its contents. It helped.

Grails 2.0, Resource Plugin and root hosting

I've been upgrading a Grails 1.3.7 project to Grails 2.0. Everything was going smoothly until I hit integration (first non-local deployment). The gist of the problem is that it appears the Resource plugin always prepends the app name to the static CSS/JS URLs it generates, regardless of the grails.serverURL or grails.app.context specified for the environment. What's strange is image resources are hosted with the appropriate URL "/static/foo.png" but CSS/JS files attempt to be served as "/AppName/static/foo.js". Tracking this issue in ResourceTagLib, this initially looks like a issue in Resource Plugin but I don't want to jump to conclusions.
Our integration environment is setup with Apache proxy passing all traffic from "/" to ":8080/AppName" hosted on Tomcat. Therefore, all traffic to "http://int.sitename.com" is hitting the app running on Tomcat. Previously, in 1.3.7, grails.serverURL="http://int.sitename.com" was all that was required to get resources to served correctly.
Does anyone know a way to resolve this issue or does this look like a bug present in Resource plugin.
I'm using Grails 2.0 too. There is a line app.context=/ in the application.properties. As application is deployed to Tomcat, it's also on renamed to ROOT.war on deployment, so Tomcat will use a ROOT ie / context for this application. As result I don't have the described issue.

Resources