Description
Dylan Carlson (RETIRED)
2003-03-28 03:16:48 UTC
Created attachment 11074 [details]
VERY basic ebuild file to build ONLY mod_jk2
I needed an ebuild for mod_jk2, so I put together a VERY simple one. It ONLY
builds mod_jk2, and it includes 2 BASIC config files. I used this as a
starting point, and expect that any real attempt at a connectors ebuild will go
far beyond what I've done here.
But for what it's worth, here are the files:
mod_jk2-2.0.2.ebuild
workers2.properties
105_mod_jk2.conf
mod_jk2-server-apache2-Makefile.in.patch
I put them in my /usr/local/portage directory like this:
/usr/local/portage/net-www/mod_jk2/mod_jk2-2.0.2.ebuild
/usr/local/portage/net-www/mod_jk2/files/workers2.properties
/usr/local/portage/net-www/mod_jk2/files/105_mod_jk2.conf
/usr/local/portage/net-www/mod_jk2/files/mod_jk2-server-apache2-Makefile.in.patch
I look forward to a better ebuild of the connectors. In the meantime, this
works for me and I hope this could help a few others as well.
Created attachment 11075 [details]
Apache directives to load mod_jk2 if -D JK2 is defined
Created attachment 11076 [details]
Basic workers2.properties. Adjust to meet your needs.
Created attachment 11077 [details]
Patch to help the buildfile find Apache's build/libtool on Gentoo without Apache2 src
Created attachment 14543 [details]
New ebuild - now also compiles jkjni.so module
This adds jni support to the mod_jk2 module, the only change is an edit to one
line, the configure line. I've tested them on two computers, one with the old
version and one with no previous version. Both work fine.
Here is what I added to tomcat's conf/server.xml file:
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
/>
(note: that block was added just before </Server>
Hope this was helpful.
-Duff
Created attachment 14544 [details]
New ebuild - now also compiles jkjni.so module
This adds jni support (and a java_home path, and tomcat_path, which btw, is
hardcoded so make sure to change it under "src_compile()", in the "sh
configure" line) to the mod_jk2 module, the only change is an edit to one line,
the configure line. I've tested them on two computers, one with the old
version and one with no previous version. Both work fine.
Here is what I added to tomcat's conf/server.xml file:
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
/>
(note: that block was added just before </Server>
Hope this was helpful.
-Duff
Created attachment 14545 [details]
New ebuild - now also compiles jkjni.so module
This adds jni support (and a java_home path, and tomcat_path, which btw, is
hardcoded so make sure to change it under "src_compile()", in the "sh
configure" line) to the mod_jk2 module, the only change is an edit to one line,
the configure line. I've tested them on two computers, one with the old
version and one with no previous version. Both work fine.
Here is what I added to tomcat's conf/server.xml file:
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
/>
(note: that block was added just before </Server>
Hope this was helpful.
-Duff
Created attachment 14546 [details]
Changed the "sh configure" statement to add jni support.
This adds jni support and a java_home path, and tomcat_path, which btw,
is hardcoded so make sure to change it under "src_compile()", in the "sh
configure" line) to the mod_jk2 module from
--with-tomcat41=$CATALINA_HOME to --with-tomcat[version you have
installed]=$CATALINA_HOME, I realize I haven't tested that, so I am
uncertain what would happen with the wrong version of tomcat put in
there. It might not be an issue. I've tested this ebuild on two
computers, one with the old version and one with no previous version.
Both work fine.
Here is what I added to tomcat's conf/server.xml file:
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
/>
(note: that block was added just before </Server>
Hope this was helpful.
-Duff
Just tested this on a server and it works great with apache 2, tomcat 4.1, and Sun-jdk 1.4.2. I've get this error when I try to emerge this:
------------------------------------------------------------------------------
Calculating dependencies ...done!
>>> emerge (1 of 1) net-www/mod_jk2-2.0.2 to /
>>> md5 src_uri ;-) jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz
>>> Unpacking source...
>>> Unpacking jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz to /var/tmp/portage/mod_jk2-2.0.2/work
* Applying mod_jk2-server-apache2-Makefile.in.patch...
* Failed Patch: mod_jk2-server-apache2-Makefile.in.patch!
*
* Include in your bugreport the contents of:
*
* /var/tmp/portage/mod_jk2-2.0.2/temp/mod_jk2-server-apache2-Makefile.in.patch-18382.out
!!! ERROR: net-www/mod_jk2-2.0.2 failed.
!!! Function epatch, Line 354, Exitcode 0
!!! Failed Patch: mod_jk2-server-apache2-Makefile.in.patch!
------------------------------------------------------------------------------
The content of /var/tmp/portage/mod_jk2-2.0.2/temp/mod_jk2-server-apache2-Makefile.in.patch-18382.out is this:
------------------------------------------------------------------------------
***** mod_jk2-server-apache2-Makefile.in.patch *****
====================================================
PATCH COMMAND: patch -p0 < /usr/local/portage/net-www/mod_jk2/files/mod_jk2-server-apache2-Makefile.in.patch
====================================================
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Naur jakarta-tomcat-connectors-jk2-2.0.2-src.orig/jk/native2/server/apache2/Makefile.in jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2/server/apache2/Makefile.in
|--- jakarta-tomcat-connectors-jk2-2.0.2-src.orig/jk/native2/server/apache2/Makefile.in 2002-10-25 16:00:00.000000000 -0600
|+++ jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2/server/apache2/Makefile.in 2003-04-24 10:47:46.000000000 -0600
--------------------------
No file to patch. Skipping patch.
patch: **** malformed patch at line 12: INCLUDES= -I${JK_DIR}/include \
The SRC_URI in the latest ebuild seems to have gone 404. The following one should work, though: http://www.apache.org/dist/jakarta/tomcat-connectors/jk2/source/jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz I found two more problems in the last ebuild provided, before I was able to make everything compile and install properly: 1. There seems to be additional spaces after \ on a couple of lines. This break the build with various error messages: sh configure --with-apxs2=`which apxs2` \ --with-tomcat41=$CATALINA_HOME \ --with-java-home=$JAVA_HOME \ --with-jni --with-pcre || die 2. The "userpriv" feature breaks the build, as /opt/tomcat is not readable by normal users. It must be turned off. Apart from this, everything worked perfectly. Even the configuration was much easier than expected (although I spent several hours reading docs just to find that I already had it working...) Thanks to everyone involved! I have tested this ebuild and it works fine. I would propose to remove the dependency on tomcat. mod_jk2 builds perfectly without tomcat installed and tomcat does not need to be installed on the same machine for mod_jk2 to work afaik. To add to comment#13 above: Tomcat is definitely /not/ going to be on the same machine as httpd/mod-jk2 in my setup, so the dependency is bogus. Installing on another machine today I had the ebuild failing while attempting to link with libpcre (Perl-compatible RE:s). Seems like metalog includes that dependency on my normal machine, but not on this one. Adding dev-libs/libpcre to the DEPENDS in the ebuild solved this, however: DEPEND=">=virtual/jdk-1.4 >=net-www/tomcat-4.1 >=net-www/apache-2.0.45 dev-libs/libpcre" This is a very nice ebuild. I just had to change the patch to: -LIBTOOL=${APACHE2_HOME}/build/libtool +LIBTOOL=${APACHE2_LIBEXEC}/../build/libtool instead of: -LIBTOOL=${APACHE2_HOME}/build/libtool +LIBTOOL=${APACHE2_LIBEXEC}/build/libtool I also had to download the source manually cause the URL in the ebuild is a little out-of-date. Other than that this worked right out of the box with Tomcat 5.0.16 :-D Gentoo-Java team: please get your act together and get Tomcat 5 and mod_jk2 into Portage! Created attachment 24596 [details]
working version of ebuild - applied changes from comments #13 and #16
i'd like to see this in portage as well; so i'm doing the only thing i can -
posting a version of ebuild with fixes from comments #13 and #16 (and removed
tomcat dependency)
i have tested it on a freshly installed machine and it seems to work well
Created attachment 25514 [details] cleaned up code and packaged Packaged files so it could be put into the portage tree. ebuild cleanup and changes 1) use ${PV} instead of 2.0.2 2) moved einfo contents to pkg_postinst() 3) emake instead of make 4) applied comment #16 to mod_jk2-server-apache2-Makefile.in.patch 5) indentation I just ran into the libpcre dependency as well... latest tar file (dated 2004-02-12) is missing comment #15. I had to reverse the patch in #16 to get mod_jk2 to build Created attachment 27124 [details] Added libpcre dep and modified postinst message I ran into the same libpcre linking error as in <a href="http://bugs.gentoo.org/show_bug.cgi?id=18353#c15">Comment #15</a>. I modified the DEPEND variable. I also modified the postinst message. Being that /etc/apache2/conf/workers2.properties isn't part of a default install of mod_jk2, I saw that it might be a security hazard in not letting the user know about it. A user might have loaded the module with the *jsp forwarded by default which could give access to some pretty nice pages for hackers :D. Created attachment 28339 [details]
mod_jk2-2.0.4 ebuild
New ebuild for 2.0.4 plus various other fixes:
* apache version checking
* tomcat 4 version checking
1) line >>> apache2? ( >=net-www/apache-2 ) : ( =net-www/apache-1.* ) should be >>> apache2? ( >=net-www/apache-2 ) : ( net-www/apache-1* ) from ERROR emerge: there are no masked or unmasked ebuilds to satisfy "=net-www/apache-1.*". 2) IUSE should have apache2 Can we expect to see this taken into portage anytime soon? I mean, the ebuild looks like it's already built; it just needs to go through the testing spin cycles a few times I imagine. I don't think I'm in a minority as I wait for this ebuild... It would be a big help to have the /tomcat-docs directory set up and working automagically with this ebuild. The IUSE part sounds reasonable. Maybe even a INEED :) It apparently does all the checking and compiling for either version 1 or 2 of Apache, but it only seems to be installing it into a Apache2 directory. On the other hand, it seems to work like a charm for Apache2. Right now the ebuild for mod_jk2 depends on >=net-www/tomcat-4.1 This needs to be changed because jboss comes bundled with Tomcat. In addition, different application servers come with their own servlet container that can use mod_jk2 as a connector to apache. This ebuild should instead depend on something like virtual/servlet-container and the jboss, tomcat, resin, etc. ebuilds be updated to provide this virtual package. Re-assigning to java. I agree with comment #24. This ebuild has been over a year in the making and it seems to be working without problems for normal setups. There have been no error reports for months. Sure, it could use some improvements, but so could many ebuilds already in the portage tree. So pretty please, with sugar on top, could someone include mod_jk2 2.0.4 in portage? Agreed as well. I think it's high time this goes into portage. Without it, gentoo is losing out on its usefulness as a server. I just used it and it works flawlessly. Let's go! I've been using this ebuild for 6 months to serve a mission critical application without any problems. To add to the chorus, I'd love to see this in portage. The changes suggested in comment #23 should be encorporated. Also, if you want to make tomcat optional, depend should be like so: DEPEND=" >=virtual/jdk-1.4 tomcat? >=net-www/tomcat-4.1 apache2? ( >=net-www/apache-2 ) : ( net-www/apache-1* ) dev-libs/libpcre" and IUSE should be like this: IUSE="apache2 tomcat" And then finally, in the main part of the ebuild, wrap the has_version tomcat stuff in a `use tomcat`: if [ "`use tomcat`" ]; then has_version '=net-www/tomcat-4.0*' && TOMCAT4="--with-tomcat40=/opt/tomcat" has_version '=net-www/tomcat-4.1*' && TOMCAT4="--with-tomcat41=/opt/tomcat" fi ... and that takes care of comment #27 AFAIK. Need to change depend net-www/tomcat to www-servers/tomcat I was having problems until I manually editing the ebuild to depend on 'www-servers'. Does this ebuild force the user to have Tomcat installed, or is it left as optional? For one of the applications I am working on, we want ONLY the Apache2 server and mod_jk2 and we will be connecting to a JBoss/Tomcat server installed remotely. It would be inconvenient (and introduce unneeded bloat) if we need Tomcat installed on the web server as well. The ebuild worked fine for me. Rgds Veurits. Created attachment 41924 [details]
mod_jk2 ebuild
This ebuild only works with apache2 and is tested with sockets and SSL
- apache 2.0.51
- tomcat 5.0.28
Tomcat is not required to be installed on the system.
Is this ebuild going into Portage any time soon? Can the ~amd64 keyword be added to this ebuild? I have been testing the 2004-10-15 ebuild on amd64 and it seems to build and work without errors. Thanks, Jason I have also used the ebuild from Comment #38 by adding the ~amd64 command and it works fine. Fixed. Available for testing on x86 and amd64 as www-apache/mod_jk2-2.0.4 |