comps
Once again Kudos Linode
by gregs on Jun.12, 2010, under *nix, debian, linode
I recently had to re-build my VPS and with the help of the documents over Linode’s Library I was up and running again within a couple of hours. A great concise, informative and accurate resource for configuring Linux based servers. Thanks again to the folks at Linode!
Configuring Jetty’s memory usage
by gregs on Apr.20, 2010, under *nix, debian, jetty
Debian specific, but if you need to edit jvm configuration details for Jetty, look for this file:
-
/etc/default/jetty
And locate the lines below to start fine tuning Jetty's memory usage:
-
# Extra options to pass to the JVM
-
JAVA_OPTIONS="-Xmx256m -Djava.awt.headless=true"
Deploying grails webapp to Jetty – resolving a few issues…
by gregs on Mar.23, 2010, under grails, jetty
So you have deployed your app and can access the start page of your grails app. If you are like me deploying your app to a Debian\Jetty type of configuration you might come across the following error:
-
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
When trying to access a controller from the default start page. I traced this to a missing dependency in grails (I use SpringSource Tool Suite for development so that maybe the root cause). By opening and editing your /project/grails-app/conf/(default package)/BuildConfig.groovy, add the following under grails.project.dependency.resolution.
-
grails.project.dependency.resolution = {
-
...
-
dependencies {
-
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
-
runtime "javax.servlet:jstl:1.1.2"
-
// runtime 'mysql:mysql-connector-java:5.1.5'
-
}
-
}
Build your war and re-deploy. Still getting an error?? I was. For jetty there was still an issue with calling the controller. After spending some time exploring, it looks like Jetty support was removed from Grails 1.2. I stumbled across a post mentioning installing the grails Jetty plugin with:
-
. grails install-plugin jetty
After running this, and re-building my war file and re-deploying it one final time, bingo it all worked.
Recursive delete
by gregs on Mar.22, 2010, under *nix, debian, os x
I new it was possible, just never took the time to look it up.
-
rm -rf `find . -type d -name .svn`
As with all types of deletes, recursive or not, use with caution.
Deploying grails app to Jetty
by gregs on Mar.20, 2010, under *nix, apache, debian, grails, jetty
Short and sweet, step by step guide for creating a grails war and deploying it to your Jetty server (includes apache2 proxy steps)
- grails war (your app), in this case epic.war
- Copy to server
CODE:
-
scp epic.war user@server:/location
-
- On Debian the location for jetty webapps is: /var/lib/jetty/webapps
- Copy from upload location to the above folder (I used sudo)
- Change permissions:
CODE:
-
sudo chown jetty:adm epic-0-0.1.war
-
- created a *.xml context file in /etc/jetty/contexts, with something like this [note case is important!!]:
CODE:
-
<?xml version="1.0" encoding="ISO-8859-1"?>
-
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
-
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
-
<Set name="contextPath">/epic</Set>
-
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/epic-0-0.1.war</Set>
-
</Configure>
-
- restart jetty :
CODE:
-
sudo /etc/init.d/jetty restart
(try stop/start as well)
-
- test with :
CODE:
-
lynx http://localhost:8080/epic/
-
- Nice but I'd like http://localhost/epic/ so enable mod_proxy in apache if you haven't already :
CODE:
-
a2enmod proxy
-
- edit /etc/apache2/mods-enabled/proxy.load and if not present add at end:
CODE:
-
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
-
- edit your virtualhost conf file I am using 000-default and add:
CODE:
-
ProxyRequests Off
-
<Proxy *>
-
Order deny,allow
-
Allow from all
-
</Proxy>
-
ProxyPass /epic http://localhost:8080/epic
-
ProxyPassReverse /epic http://localhost:8080/epic
-
ProxyPreserveHost On
-
- restart apache :
CODE:
-
sudo /etc/init.d/apache2 restart
-
- now you can
CODE:
-
lynx http://localhost/epic/
-
Update: I had omitted the ProxyPreserveHost On from the Apache configuration, which resulted in css, images and external javascripts not loading. It also caused an issue with accessing controllers.
Sources:
Apache/SSL configuration (on debian)
by gregs on Mar.16, 2010, under *nix, apache, debian, ssl
More for posterity, this was the last step that was eluding me. I had found numerous resources to get me started on the path to setting up Apache and SSL, but when it came to having a working config and server, when I went to browse my Debian test server, I would get this message:
-
(Error code: ssl_error_rx_record_too_long)
When you google for the solution I found a number of dead ends, but in the comments for one of them there was a helpful pointer.
When you do an 'ls -la' on sites-enabled (inside /etc/apache2), you will see a symbolic link to the sites-available folder and typically just for the default site (000-default -> default). However in sites-available there's also a default-ssl config file. Creating a symbolic link to this file and reloading apache fixed my problem and now I have apache serving up http over SSL .
Upgrading to Lenny
by gregs on Mar.09, 2010, under *nix, MySQL, apache, debian, linode
It's been while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came across some minor issues and these were resolved in minutes as opposed to hours.
- MySQL : failed to start, complaining about:
CODE:
-
/etc/init.d/mysql: ERROR: Using expire_logs_days without log_bin crashes
-
the server. See README.Debian.gz
Commenting out the expire_logs_days in the my.cnf file allowed me to restart MySQL.
-
- After the upgrade of Apache, my virtual hosts weren't working. A quick search via Google pointed me to this post - a quick edit of all of my host files and it was all working again.
- the php-mysql connector somehow hadn't been upgraded/installed so a quick
CODE:
-
apt-get install php5-mysql
fixed that problem.
-
- OpenBD : the only thing that remains broken was my tomcat5.5 Open BD install. Tomcat was working fine but Open BD refused to start up complaining about :
CODE:
-
javax.servlet.ServletException: Open BlueDragon Engine Failed to initialise tags: java.awt.Color
Since I am not really using it, it's not that important, but at some stage I'd like to get it working again. If you have any suggestions, please leave a comment.
-
SVN : authentication with a windows domain
by gregs on Mar.08, 2010, under apache, svn
Finally got round to implementing this for work. As a starting point I followed the instructions found here.
The config looked fine, but after restarting the service, I still wasn't getting prompted for a log in. After re-jigging the order to what you see below and restarting the apache service (we are using 2.0.59), it all worked. Maybe this will help someone else along the way.
-
<Location /svn>
-
DAV svn
-
# any "/svn/foo" URL will map to a repository /usr/local/svn/foo
-
SVNParentPath {drive letter}:/path/to/SVN/epositories/
-
-
AuthName "SVN"
-
AuthType SSPI
-
SSPIAuth On
-
SSPIAuthoritative On
-
SSPIOfferBasic On
-
SSPIOmitDomain on
-
SSPIDomain <domain controller>
-
SSPIBasicPreferred On
-
Require valid-user
-
</Location>
gnumake: *** No rule to make target `all’
by gregs on Apr.06, 2009, under *nix, mac, os x
I was using MacPorts to install ICU and Jam. After running the installer for the first time I got the following error message:
-
sudo port install icu jam
-
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source" && gnumake all " returned error 127
-
Command output: sh: gnumake: command not found
Oops forgot to install XCode (you always forget to install something on a new machine
). Quickly ran the XCode installer, however when I ran the command again I got a new error:
-
sudo port install icu jam
-
---> Building icu
-
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source" && gnumake all " returned error 2
-
Command output: gnumake: *** No rule to make target `all'. Stop.
Turns out you need to do a cleanup before attempting to run the command again:
-
sudo port clean --work icu
-
---> Cleaning icu
-
sudo port clean --work jam
-
---> Cleaning jam
-
sudo port install icu jam
-
---> Fetching icu
-
---> Verifying checksum(s) for icu
-
---> Extracting icu
-
---> Configuring icu
-
---> Building icu
-
---> Staging icu into destroot
-
---> Installing icu @4.0_0
-
---> Activating icu @4.0_0
-
---> Cleaning icu
-
---> Fetching jam
-
---> Attempting to fetch jam-2.5.tar from http://distfiles.macports.org/jam/2.5
-
---> Verifying checksum(s) for jam
-
---> Extracting jam
-
---> Applying patches to jam
-
---> Configuring jam
-
---> Building jam
-
---> Staging jam into destroot
-
---> Installing jam @2.5_1
-
---> Activating jam @2.5_1
-
---> Cleaning jam
Time to continue the Mapnik install.