When packaging the application using warbler, the symbolic links are lost and the actual contents the symlink points to are packaged as part of the WAR.
In my case, I have a symlink from public/images/upload to /var/myproject/upload. After I deploy the war in tomcat, in the exploded folder public/images/upload has all the contents of /var/myproject/upload copied to it instead of linking to the folder.
UPDATE: My questions is "will warbler retain the symbolic links inside the project when deployed as a war?"
Environment Info:
jruby 1.6.2 (ruby-1.8.7-p330) | warbler 1.3.1 | Cent OS 5.5 | Java SE "1.6.0_26"
I had the same problem. I solved it by creating global (##) variables for each path that I used in the environment files. For example my production.rb file contains ##rejectedPage="/pathto/page/in/tomcat", while in my development.rb file I set ##rejectedPage="/the/normal/path". This way I can easily switch from my development environment to my production environment.
Warbler does not support symbolic links currently, so it tries to copy its contents. Your best bet is to configure Warbler to ignore the link and post process the .war file with some other program that would store the link.
Feel free to file a feature request for this, or better, submit a patch/pull request.
Related
Suppose I have a Grails application named myCoolApp.
Furthermore, suppose I have defined some basic properties in grails-app/conf/Config.groovy and grails-app/conf/DataSource.groovy under the test and production profiles.
Config.groovy is set to merge with the following .groovy external configuration file, if found at all:
grails.config.locations = ["file:${userHome}/.grails/${appName}-config.groovy"]
Finally, I have also defined, inside an external testing server, such a file, under a local *NIX user path:
/home/appServerTestUser/.grails/myCoolApp-config.groovy
Sadly, I find that for some reason, the external .groovy file's properties are not being merged when a Tomcat instance starts up.
What options do I have to make Grails tell me: "Oh, yes, I found your external config file at: /home/appServerTestUser/.grails/myCoolApp-config.groovy" and these are the properties I merged into Config.groovy?
Thanks!
File-based paths don't make much sense in a deployed app. It could work when deploying on your dev machine for testing, but will likely fail on any other machine. And it'll probably fail locally even if configured with the correct path since the process will like run as a different low-priviledge user.
You can use absolute paths, e.g. /etc/myapp/path/to/file, but this tends to couple deployment to filesystem structure, so if you develop in Windows and deploy on Linux it'd be tricky to get them both working.
So the best bet for Tomcat deployment is to use the classpath syntax. You can specify multiple files and it will load all that it finds, so I usually have one entry for local dev and one for the deployed app:
grails.config.locations = [
"classpath:${appName}-config.groovy",
"file:./${appName}-config.groovy"
]
I delete the entries for .properties files because Groovy syntax is so much more flexible, but use them if you like. I also keep the dev files in the project root (and exclude from source control).
So when deploying, name the file correctly (different apps will have different files, so no clashing there) and put them in Tomcat's lib directory. This is in the classpath, and so the classpath: entry will see it.
I am attempting to get a Grails project working but need help setting it up. I have an Ubuntu server running on a VM that has Redis installed. The project won't run unless I create a config file that can use Redis on the Ubuntu server. This is the settings I pulled down from GitHub located in the grails-app/conf/Config.groovy file.
http://snag.gy/eYhUY.jpg
I was told I need to create a separate config file that will override these parameters so my project will talk to the ubuntu server on my machine. This is a noob question but where do I create a config file? I can't seem to find a .grails folder. I know I'm suppose to reference my config file, once i've created one, in the grails-app/conf/Config.groovy file
http://snag.gy/SpGGt.jpg
Look at the grails.config.locations specified in your Config.grooy and you can create any of those locations for creating the external Config file.
I prefer using the classpath route. Here is what I would do.
Create a folder (say appConfig) and place it in the tomcat/conf folder.
Add the application config file (proghorn-config.groovy in your case) to the folder, with the required configurations in the file.
Add the folder to the Tomcat classpath by updating either the tomcat/conf/catalina.properties or by creating the tomcat/bin/setenv.sh
The location of the .grails folder depends upon the user account running the container (Tomcat, Jetty, etc.) which hosts your Grails application.
For example on Debian 6 running Tomcat 6.x the location is:
/usr/share/tomcat6/.grails/
You can also use static paths as well:
file:/usr/local/tomcat/conf/myspecific-config.groovy
I am trying to install JRuby in my system, I follow the following steps:
Download a copy of the latest JRuby from the JRuby download page.
Unzip the file with your achive program. If you don't have one that works, download 7-Zip.
Copy the JRuby folder called jruby-1.7.2 directly to "C:/"
Set environment variables on your system. Right click "My Computer" go to "Advanced" then "Environmental Variables". Create these: JRUBY_HOME = C:/jruby-1.7.2
Next you'll have to edit the PATH variable. Add ;C:\jruby-1.1.5\bin; to the end of that variable.
And then I am running the command:
C:\Users\sitanshu\rubyApp\jruby-1.7.2>jruby -v
then it shows the following error:
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 1.7.0-ea-b19 [Windows Vista-x86]
NameError: uninitialized constant Java::JavaLang::ProcessBuilder::Redirect
const_missing at org/jruby/RubyModule.java:2677
ProcessManager at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:12
JRuby at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:6
(root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:3
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel.rb:1
So where am I going wrong and what is the solution for that?
I would test that java is updated and working
java -version
Under your environment variables, make sure you have a JAVA_HOME variable pointing to your JRE root folder, like this:
C:\Program Files\Java\jre7\
Make sure your Java JRE bin folder is also part of your PATH variable:
;C:\Program Files\Java\jre7\bin\
Additionally, when you are adding jruby to your PATH variable, make sure you are referencing the correct folder location. In the example you have given, you are installing jruby to C:\jruby-1.7.2, but then you are actually referring to this different folder C:\jruby-1.1.5 in your PATH configuration.
Also, when you are defining your JRUBY_HOME variable, make sure you are using backslash \ characters. In your example above you used a forward slash / character. Remember, that windows uses backslashes between folders.
Finally, after you've made all your environment variable changes, remember to open a new command window for your changes to take effect.
Highcharts (Highcharts), just released an update to their offering with a bundled export server. This is to enable you to generate charts serverside and include them automatically in emails/pdfs/etc.
Their instructions on how to prepare this is: Github instructions
I'm running XAMPP on Mountain Lion. I have successfully built the war package and opened the demo page.
I am now preparing a war for the production environment (centOS 6). The production site is running the Yii framework.
What I do not understand, the variables that need to be configured:
app.properties = weburl
dev.properties = weburl
prod.properties = weburl
In a MVC framework environment (such as yii) what should these url's be?
2.After the war is created, the github tutorial says to upload this file. But, what other files are required? The entire exporting-server directory? If so, where on the server should these files be placed? Is the file location the url path that should be referenced in the weburl variables?
Greater clarification on how to setup/deploy the export server would be much appreciated.
The created .war file should be uploaded to an Java application server, such as Tomcat, Jboss, TC-server, Glassfish, etc.
It's not suitable to run in a PHP environment.
I just installed ruby on rails on my new computer ( I was using instantrails before) and I'm trying to get everything setup.
Im running Windows 7. So I followed the instructions from this tutorial.
http://blogupstairs.com/ruby-on-rails/installing-ruby-on-rails-on-windows-7/
The problem i'm guessing is step 3
"Add the newly installed bin directory to your path in your windows system : Open windows explorer-> right click the icon computer-> choose Properties -> in the contol panel Home, Click Advanced system settings and then click Envitonment Variables button->in the system variables click new and add new system variables like this : Variable name : RUBY_HOME , Variable Value : C:\Ruby, after that add it in to the path and add the bin after a semicolon to the “Path” variable like this : C:\Program Files\Common Files\Adobe\AGL;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%RUBY_HOME%\bin"
I set created the system variables but when I try to run script/generate in the main directory of my app I get the error
"Ruby: no such file or directory --script/generate"
I checked the apps directory and the script folder is in there. How can I run the "ruby script/generate" commands from the control panel?
I was guessing it was something with the path but I dont know any ways to check to find out whats going wrong.
Are you using Rails 3.0+? In this version of rails and up, the script/* folder has been deprecated in favor of rails generate, rails server, etc. See here.
In 99.99999% of all cases, if a computer tells you that it cannot find a file at a specific location, it is because that file is not at that specific location.
So, is there actually a file named generate in a directory named script in the current directory?
I have recently installed RoR on my "clean" Win7 as well.
What IDE are you using?
I suggest trying JRuby with NetBeans/RubyMine:
JRuby installer does all the work (even adds the proper variables to your path in system environment settings...,
IDEs take care of gems, setting up servers etc.
As for the commands, as Nuclearsandwitch mentioned, there is no script/generate or script/server in Rails 3. Just make sure you in the directory with your Rails app and then try running rails server. It should work :-)