Saturday, November 12, 2011

Apache, Tomcat, SVN, virtual hosts integration

Ever come across this kind of requirement involving Apache httpd, Tomcat, SVN and virtual hosts?



  • want static sites being served by Apache

  • want dyanmic content (jsps, etc) served by Tomcat

  • want to access your svn via port 80

  • must work in a multiple virtual hosts environment

  • want to do it an easy, extensible and with minimal reliance on 3rd party tools


Sure ... some would say. Easy problem. Just do it via http tunneling, or rewrite rules or some such.


And to an extent they would be valid. However, needs vary.



Here is one way to make all this happen.



Versions:

  • Apache 2.x

  • Tomcat 6.x

  • mod_jk 1.2.32

  • mod_proxy



Files required to be changed



  • Apache
    httpd.conf



  • Tomcat
    server.xml


Files added:



  • Apache
    $APACHE_HOME/conf.d/workers.properties
    $APACHE_HOME/conf.d/mod_jk.conf
    $APACHE_HOME/conf.d/httpd-vhosts.conf



Apache level changes



httpd.conf


Our Apache home is: /etc/httpd and its conf file is at /etc/httpd/conf/httpd.conf


Make sure your Apache conf is setup to autoload all conf files at startup.


Modify ApacheHome/conf.d, as needed




#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

If you had any include directives pointing to files in the conf.d directory, they are now redundant and can be removed.



workers.properties


Create the workers properties file $APACHE_HOME/conf.d/workers.properties as below:


# Define 1 real worker using ajp13
worker.list=ajp13,childtracker_ajp13

# Set properties for ajp13
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009

# Set properties for childtracker_ajp13
worker.childtracker_ajp13.type=ajp13
worker.childtracker_ajp13.host=localhost
worker.childtracker_ajp13.port=8009



mod_jk


For linux, mod_jk.so has to be compiled from source. Its a pretty straight-forward process.
Ref: Connections download page



Installation


mod_jk has been installed at -/usr/local/src/mod_jk_


Installation steps from "Build.txt":


$> cd native
$> ./configure --with-apxs=/usr/sbin/apxs (or where ever the apxs/apxs2 is)
$> make
$> su -c 'make install'



mod_jk.conf


Create file $APACHE_HOME/conf.d/mod_jk.conf as below:


#
# Added for Tomcat integration
# by Dheeraj
#

# Load mod_jk
LoadModule jk_module modules/mod_jk.so

# where to find workers.properties
JkWorkersFile /etc/httpd/conf.d/workers.properties

# where to put jk shared memory
JkShmFile /var/run/httpd/mod_jk.shm

# where to put logs
JkLogFile /etc/httpd/logs/mod_jk.log

# Set the jk log level
JkLogLevel info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S: %Y]"

# JkRequestLogFormat - set format
JkRequestLogFormat "%w %V %T"

# Send everything for context /examples to worker ajp13
JkMount /examples ajp13
JkMount /examples/* ajp13

AddHandler jserv-servlet .do
JkOptions +ForwardURICompatUnparsed


The commented lines highlight Windows level changes



Virtual hosts - httpd-vhosts.conf


Create this file in $APACHE_HOME/conf.d/http_vhosts.conf:



#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


<VirtualHost *:80>

ServerName abc.xyz.com
ProxyPass /repos !
ProxyPass / http://abc.xyz.com:8080/
ErrorLog logs/abc-error.log
CustomLog logs/abc-access.log common
</VirtualHost>


Tomcat level changes


Set the AJP connector


<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" enableLookups="false"/>



Verification



mod_jk.log


You should see output like this


[Mon Nov 07 02:38:26: 2011][26261:47626733695808] [info] init_jk::mod_jk.c (3252): mod_jk/1.2.32 () initialized



catalina.out


You should see output like this in catalina.out


Nov 7, 2011 2:43:12 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 7, 2011 2:43:12 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/10 config=null


for more details regarding each tool, pls refer to their respective home pages.

Sunday, August 21, 2011

Redmine Mylyn integration howto

There is a dearth of a reasonably complete step by step howto on integrating the latest version of Redmine (1.2) with Eclipse 3.5.2 (onwards). In fact, when I looked, the relevant information was somewhat "splintered" (frustration > progress) across sites that ultimately led me exasperated. This is what I am trying to address by this entry. Hopefully, it helps others get off to a running start.

Pre-requisites:
Eclipse: 3.5.2
Redmine: 1.2
Mylyn: 3.6.1

Install Eclipse plugin
1. In Eclipse: Help - Install New Software - Add
2. Enter the following details:

   The update site is: http://redmin-mylyncon.sourceforge.net/update-site/N/

Install Redmine plugin

This was the tricky part. Took most time to figure out. Git was not behaving. So, had to do things the old fashioned way ... sigh!

These steps need to be done on the server - where Redmine is hosted.

1. Use lynx or browser, open: http://redmin-mylyncon.git.sourceforge.net/git/gitweb-index.cgi
2. Click on "summary". You should see a list of commit log entries for the connector. For Redmine 1.2, one needs at least ver 2.7.4
3. Download the snapshot by clicking on the snapshot link. (I used ver 2.7.4 - use a more recent version, if available). You will get a tar.gz file
4. Unzip and untar it. You should get a "redmin-mylyn-connector" directory
5. Copy directory to <Redmine_HOME>/vendor/plugins (hint: Your cmd would be like: cp -R redmin-mylyn-connector <Redmine_HOME>/vendor/plugins"
6. Shutdown Redmine
7. Restart Redmine
8. Go to Administration - Plugins. Make sure you see "Mylyn Connector plugin" (min ver. 2.7.4)

Configure Redmine

1. Go to Administration - Settings - Authentication

2. Enable: Authentication Required
3. Enable: Enable REST web service

Configure Eclipse

1. Go to Eclipse menu: Window–>Show View–>Other–>Tasks–>Tasks List
2. Right click in the Tasks List area and select New–>Task.
3. Click 'Add Tasks Repository' button and select the Redmine task repository type.
4. In the popup form enter (http://<Redmine_URL>, label == "Redmine", user name, password)
5. Press "Validate Settings" button at the bottom of the form, and you should get a "Connection successful" status message. You should be able to submit issues from your eclipse IDE, now.

Setting up Task List

In Eclipse:

1. Open: Window - Open Perspective - Other
2. Select "Planning"

Create a List of "Open issues Assigned to me"

1. On the task list, right-click and choose New -> Query...
2. Select your newly created repository
3. Click "<<Create a new query>>" , click Next
4. Enter the following:
      Title: All Open Issues assigned to Me
      status_id: Open
      assigned_to_id: <Your name>
      click 'Finish'

You're done! Pat yourself on the back by closing this ticket from your Task list and send me a "Whoohoo" comment on this blog entry!



FAQ:

Q. I have followed the steps but I get a "404 message" when I validate settings
A. This typically happens when:
      - you don't have the right version of the connector installed. Review the Install Redmine plugin steps.

Thursday, January 7, 2010

iPhoney

Things have been silent. Sometimes that is a bad thing and sometimes it can be a good thing.

Thankfully, this time it is a good thing!

To keep to the focus of this post, I will talk about some really pioneering work that we have done. iPhone for all its warts, has been great for the mobile. It has made people think of the mobile as more than just a device for talking. Blackberry was doing that too, but in a very "corporate" and snobbish kind of way.

Hence the "AppStore"-effect. (Everyone is jumping on this bandwagon. Nokia, MS, Blackberry, Google, Intel, etc. - for lack of an option)

A couple of issues that we see with the iPhone and the AppStore are:
1. iPhone publishing takes at least 2 weeks.
2. Dynamic content feed into App happens via WebServices - leading to app complexity and longer development times
3. Limited dynamic updating of application.
4. Higher cost

These kind of constraints reduce the effectiveness of "fresh" solutions. "Fresh" solutions are those whose value is driven primarily by getting you the "latest" info, e.g. News, stock quotes, content aggregators, etc.

But, there does exist an option that allows for instant publishing, is lightweight, and provides almost total flexibility to both the user and the provider. WAP.
That's right. Unfortunately, what it was lacking mostly, was a "snazzy" UI, that also supports touch-actions, cool effects between pages, works in tall and wide orientations and provide an icon on desktop - that all the regular iPhone apps have.

Until now.

Check out our demo app!

It:
-- looks like an iPhone app
-- behaves like one (supports: touch-actions (slide, touch, etc), cool page transitions, orientation modes)
-- can be an icon on the iphone "desktop"
-- is updated in internet-time
-- does not need to be published
-- has none of the WebService bloat
-- easy to manage
-- allows personalization while being accessible by everyone
-- integrates seamlessly with payment gateways and any third-party online solution
-- works not just on the iPhone/iPod touch, but Blackberry touch and other "touch"-smart phones.

Low-down:
-- Using our MobiTouch framework, one can go from scratch to application is just 3 days! Add 2 more days for every addl 5 pages of your application!
A full blown app - including subscriptions, integration with payment gateways and other third-party online solutions

Happy New Year!

Saturday, October 31, 2009

Cost of a byte?

Consumer broadband costs across the world, a comparative ...

The Far East is FAR ahead of ...

Airtel boasts a chest-thumping 8mbps (ceiling) for consumers with the average household speed being closer to 512 kbps in metros and 256 outside.

Sweet to lick ...

Friday, July 31, 2009

Collapse-able dollar?

For last few months people have been getting on the soap box and pontificating about a new global currency (a gold backed one, at that which the dollar stopped @ 1972). All of a sudden. Out of seemingly nowhere, every economist was talking about a dollar-weakened future (well, not everyone).

This struck me as odd. What exactly was fueling their worries? How was this tied into the recession? And why a lot of learned business gurus were relating about how the US would take more than 10 years to get out of this recession/mess.

Mess? Yup. Mess.

So, I did some digging and here is what I found.

The (US) Mint has been busy. Real busy.
Its been minting. More than normal. Way more. To put things in perspective.
In the last 1 year, it has expanded the monetary base from the, then, 900-ish billion to approx. 1,700-billion-ish (and its still printing (hint: look at the far right) ...). That's right. In less than 1 year, Bernanke has tried to attack the recession by:
1. Printing his way out, and
2. Make firms and banks take money (remember TARP) and refuse to let them pay it back (a nice way to say, I own you!)

So, where is the money? When people are complaining about unemployment and housing slumps, etc..

Its with the banks. The banks are storing those reserves at 0% interest rates with the Fed in, what are known as excess reserves of Depository Institutions. Fancy ways of saying the money is being spread between the fed, banks, and the TARP-stained companies.

The Fed through the IOER rate (interest on excess reserves), will try to control monetary policy. Make sure that reserves deposited by the banks don't make it into the system. Buy time, until a solution can be found.

That is why Bernanke has gone on record to say that the interest rates are likely to be in the 0-0.25% range for "some time".

Just imagine the inflationary pressure, if a tenth of those funds make their way into the market. The question is how long before the dam breaks?

The CBO has projected
... that the federal debt as a share of the economy will double over the next decade, from about 41% last year to 82% by 2019.
(this debt is the by-product of the various stimulus packages)

This begs the question, why the analysts on CNBC go around talking about US coming out of the recession by the end of this year?

Do they not realize what is really happening or are they more PR and analysts less?
Is the dollar really safe or is it headed the way of the Zimbabwean dollar.

Monday, July 20, 2009

Web sense

Ever wondered who exactly uses the web and what are they doing?
Here's the result from a few places - based on region and apps using latest(2009) data (where available).









S.No.CountryNSIWSRemarks
1China253m298m(density: 19%) [2006 figures: 103m]
2US220m227m(density: 72.5%) [2006 figures: 209m]
3Japan94m94m(density: 74%) [2006 figures: 86m]
4Brazil67.5m67.5m(density: 26% / 22.4%) [2006 figures: 13m]
5India60m81m(density: 4% / 7.1%) [2006 figures: 40m]
6Germany52.5m55.2m(density: 64% / 67%) [2006 figures: 50.6m]
7UK43.2m43.2m(density: 69% / 70.9%) [2006 figures: 37.6m]


They estimate that in 3 years - China will outnumber US 3:1 and along with India - will become the big 3. Asian piece of the pie by 2012 - 490m

Top languages: Mandarin, English, Hindi, Portugese, Russian

Top apps:
Web - 45%
Email - 6% (78% spam)
P2P - 25%
Streaming - 8%
VOIP -3%

Top countries by penetration, according to Swivel are:
Iceland, Sweden, Netherlands, Australia, New Zealand, South Korea, Canada, Luxemborg, & US

(Apparently, when I publish the table it puts in a huge white space header. Its not there 'cuz of my code! Silly blogger!)

Sunday, July 19, 2009

Building a Firefox extension

Knowledge info:
-- some programming knowledge -- check
-- javascript -- so-so
-- understand XML files -- check
-- curiousity -- check

Useful tutorials/sites to help get you started.

@MozillaDev, @mozblog
@roachfiend
@lifehacker

Env setup:
some dev extensions

Just noting stuff for now.  Should have something like a beta out, hopefully, in a month's time.