I'm trying to use Grails new forked mode. I enabled it in BuildConfig.groovy file using
grails.project.fork.run = true
and now the tomcat server starts in "detached mode" as expected, but my application is not deployed.
I also configured an external directory where I put the war of my application, like this:
grails.project.autodeploy.dir = "../mywar"
but nothing changed.
Is there anything else I should do to configure forked mode?
Related
If I create a new web profile app, and generate-all, it runs fine in my local and deploys without error to JBoss. But when I try to access the app all URLs return 404. I know the app started up successfully, because it created tables in the database.
Here's what I'm doing.
grails 3.1.4> create-app demo
create-domain-class Book
create-domain-class Author
Edit domain classes
generate-all *
change tomcat dependency from compile to provided in build.gradle
change dataSource in application.yml to use my JNDI Oracle connection
Add server: contextPath: /demo to application.yml
run-app -> Works
gradle war
Deploy to JBoss EAP 6.4.0.GA
JBoss says deployment and activation of the app was successful. There are no errors of any sort in any JBoss log file. And dbCreate: update made the DDL changes to my Oracle database, so I know it got that far. But all URLs for the app return 404.
This is a known bug: Issue-9481
It has been added to grails 3.1.5 milestone.
During my grails app development phase (when I compile and run using grails run-app), all my static files reside in web-app folder as usual.
Is there a way (using config or command line parameter) I can use a different directory, say web-app2 for my static files? Something like grails run-app -Dgrails.static.loc=~/web-app2 run-app?
I need this only for development time. For production and deployment, I'm fine with the default behavior.
in your config.groovy you can set environment-specific configurations,
sth like
environments {
development {
grails.resources.work.dir = '/webapp-2/'
grails.resources.uri.prefix = '/staticstuff/'
}
production {
grails.resources.work.dir = '/webapp/'
grails.resources.uri.prefix = '/static/'
}
}
you can start your application with
grails dev run-app // runs with the "development" data source
grails prod run-app // runs with the production data source
I tryed it out, works well!
have a look at http://www.grails.org/Environments and http://grails-plugins.github.io/grails-resources/guide/9.%20Configuration.html
I was wanting to run a custom environment called "local"...as in a local dev. I would use the config (eg DB connections) of this before a war would be deployed to the "shared" development server. But I noticed that it lacks the behavior of the standard Grails "development" Environment, such as Changes to a GSP were not available when you refresh the browser.
So this led me to wonder how do you change the behaviours of a custom environment? How can you copy all the settings for "development" to another environment?
You can enable reloading of modified gsp in a custom environment specifying the run-app flag:
-Dgrails.gsp.enable.reload=true
I don't think the automatic reloading is environment dependent. If you execute grails run-app, reloading will happen regardless of which environment you run under. In other words, automatic reloading will happen for all of
grails dev run-app
grails prod run-app
grails test run-app
On the other hand, reloading will not happen if you build a war using grails war, then deploy it. So reloading depends on how you run the app, not the environment. The easiest way to define a custom environment that is similar to dev, is to define a set of default configuration, then selectively override the settings for each environemnt, e.g.
//default config
myApp {
userRoleName = 'ROLE_USER'
adminRoleName = 'ROLE_ADMIN'
dateFormat = 'yyyy-MM-dd'
}
environments {
// config overrides for dev
development {
myApp.dateFormat = 'yyyy/MM/dd'
}
// config overrides for local
local {
myApp.dateFormat = 'MM/yy/dd'
}
}
I have Weceem 1.0 plugin installed in an empty Grails 1.3.7 application. I did the initial setup from the docs page, and I switched the devDB from "mem" to "file" storage.
I can create a space, populate some content, but then when I restart the application (grails run-app), my space and content is gone.
The devDB.script and other files show traces of Weceem data, but I lose the content in the newly started application.
What do I need to do to get it persistent?
You need to remove the settings dbCreate = "create/create-drop" and replace it by "update" or "none" in your DataSource.groovy file for development environment.
you can also start running a mongo database,
$ grails install-plugin mongodb
remove hibernate and add this to your domain class, to save your stuff to mongodb:
static mapWith="mongo"
Bootstrap executes fine during run-app (database is seeded). But it doesn't appear to get invoked when Tomcat deploys the war (nothing in the database).
Does the Bootstrap get run during war deployment? If not, is there a way to make it run?
Specifically I am wanting my sample data to seed the database.
Yes it does....
i would look to make sure you have your environments configured properly if you see thing working in development, but not production