Opened 9 years ago

Last modified 7 years ago

#48302 new submission

tomcat8 @ 8.0.24 looking for review/feedback/help

Reported by: raupachz (Björn Raupach) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: neverpanic (Clemens Lang)
Port:

Description

MacPorts is missing a current Apache Tomcat 8 port. Unlike tomcat5 and tomcat6 this does not build tomcat. It downloads and extracts a binary from one of the Apache mirror sites.

I am totally new to creating ports files. This is my first attempt and it would be nice if someone is willing to help/work with me on this port. I do have experiences with running Apache Tomcat on *nix servers.

This port is plain and simple it just downloads, extracts and copies files to ${prefix}/share/java. You can start and stop tomcat via the provided scripts in /bin. This is probably not how a server should act.

  • Should I create a custom system account and group e.g. tomcat:tomcat?
  • Start and stop via launched?
  • How should I deal with updates? Lets say I change my server.xml and the port updates? Is it possible to keep files around?

Attachments (2)

Portfile (3.0 KB) - added by raupachz (Björn Raupach) 8 years ago.
setenv.sh (116 bytes) - added by raupachz (Björn Raupach) 8 years ago.
files/setenv.sh

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by neverpanic (Clemens Lang)

  • openmaintainer is meaningless without a real maintainer associated with it. So either add yourself in the domain.tld:localpart obfuscated format, or just use nomaintainer.
  • We prefer sha256 and rmd160 checksums nowadays. If you delete the checksums line and run port -v checksum, the correct line will be printed.
  • You're mixing tabs and spaces in the depends_lib line
  • MacPorts has a delete command that wraps file delete that you could use instead of file delete in the pre-destroot block. I think it doesn't make a difference in this case, but it's still shorter.
  • If you're overriding the destroot phase anyway, there's little point in splitting out parts of it into pre- or post-destroot.
  • don't set destroot.keepdirs in a phase; do it at the top level of the Portfile
  • If you want, you can create a custom account for tomcat using the add_users directive. You could also use OS X' builtin _www user.
  • Please provide a launchd control interface so port load tomcat8 will start and port unload tomcat8 will stop the server. Search other Portfiles for startupitem to see how it's done -- if you need help, please feel free to ask here or on -dev.
  • If your port installs configuration files that should stay around after a user uninstalls the port and should not be overwritten by updates, move the configuration file by appending ".sample" and add a note (notes your-text-here) to tell the user that he needs to configure tomcat by creating the file before starting it.

comment:2 Changed 9 years ago by neverpanic (Clemens Lang)

Cc: cal@… added

Cc Me!

comment:3 Changed 9 years ago by raupachz (Björn Raupach)

I am still working on the custom account for Tomcat and moving files so that they don't get replaced upon an upgrade.

Here are the security considerations from Apache Tomcat Team. I used to run it like this in production unless the distro provided a custom Tomcat installation. So it probably makes sense to set this port up like the developers recommend.

Starting and stopping works now via the startupitem. It is not perfect yet. I am still missing a PID file but that should be easy once I figure out how to deal with /files in a port.

comment:4 Changed 9 years ago by raupachz (Björn Raupach)

Apache Tomcat does not distribute setenv.sh . I created a custom one and made sure it is not overridden on updates. We need this file to tell Tomcat to create a PID file.

However there is the conf directory. Basically all the files in that directory can and will be edited during Tomcat installation. Should I copy them and make .default or .sample files?

Still figuring out how to deal with custom accounts and setting permissions.

Changed 8 years ago by raupachz (Björn Raupach)

Attachment: Portfile added

Changed 8 years ago by raupachz (Björn Raupach)

Attachment: setenv.sh added

files/setenv.sh

comment:5 Changed 8 years ago by raupachz (Björn Raupach)

Oh wow. 16 months ago.

I updated the portfile to Apache Tomcat 8.5.8. The ports loads und loads and I set the permission to tomcat:tomcat.

Anyone else looking for Tomcat port?

comment:6 Changed 7 years ago by kencu (Ken)

Hi. I downloaded the files and installed this just now. I don't know a great deal about tomcat, though. It installed without any errors on 10.6, and then I did sudo port load to launch it. It seemed to be continually restarting though:

17-05-24 10:17:16 PM	org.macports.tomcat8[57243]	Tomcat started.
17-05-24 10:17:16 PM	com.apple.launchd[1]	(org.macports.tomcat8) Throttling respawn: Will start in 10 seconds
17-05-24 10:17:26 PM	org.macports.tomcat8[57254]	Tomcat started.
17-05-24 10:17:26 PM	com.apple.launchd[1]	(org.macports.tomcat8) Throttling respawn: Will start in 10 seconds
17-05-24 10:17:36 PM	org.macports.tomcat8[57265]	Tomcat started.
17-05-24 10:17:36 PM	com.apple.launchd[1]	(org.macports.tomcat8) Throttling respawn: Will start in 10 seconds
17-05-24 10:17:46 PM	org.macports.tomcat8[57276]	Tomcat started.
17-05-24 10:17:47 PM	com.apple.launchd[1]	(org.macports.tomcat8) Throttling respawn: Will start in 10 seconds}}}

running the start script manually says it starts:
{{{
$ sudo /opt/local/share/java/tomcat8/bin/catalina.sh start
Using CATALINA_BASE:   /opt/local/share/java/tomcat8
Using CATALINA_HOME:   /opt/local/share/java/tomcat8
Using CATALINA_TMPDIR: /opt/local/share/java/tomcat8/temp
Using JRE_HOME:        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH:       /opt/local/share/java/tomcat8/bin/bootstrap.jar:/opt/local/share/java/tomcat8/bin/tomcat-juli.jar
Using CATALINA_PID:    /opt/local/var/run/tomcat8.pid
Existing PID file found during start.
Removing/clearing stale PID file.
Tomcat started.
}}}

but I can't connect to it with http://localhost:8080/, and the activity monitor shows no process named tomcat running.

Sorry if it's just my ignorance about how to see it work. Otherwise everything went smoothly for the installation.
Version 0, edited 7 years ago by kencu (Ken) (next)

comment:7 Changed 7 years ago by kencu (Ken)

I did notice that tomcat6 seems to have a load of dependencies when I tried to install that:

$ sudo port -v install tomcat6
--->  Computing dependencies for tomcat6............................
The following dependencies will be installed: 
 apache-ant
 commons-beanutils
 commons-codec
 commons-collections
 commons-daemon
 commons-dbcp
 commons-digester
 commons-el
 commons-fileupload
 commons-httpclient
 commons-io
 commons-launcher
 commons-logging
 commons-modeler
 commons-pool
 hamcrest-core
 jakarta-bcel
 jakarta-log4j
 jakarta-regexp
 jakarta-taglibs-standard-11
 junit
 mx4j
 saxpath
 servlet23-api
 servlet24-api
 xalanj
 xercesj

could some of those be needed for tomcat8 as well?

comment:8 Changed 7 years ago by raupachz (Björn Raupach)

Hi Ken,

Tomcat 8 needs Java 7. Your JRE_HOME points to Java 6.

Tomcat is pretty self contained. You don't need any additional dependencies other than the ones provided. No clue why the ports of tomcat6 is different.

Note: See TracTickets for help on using tickets.