-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Michael,
On 6/13/18 12:14 PM, Lemke, Michael ST/HZA-ZIC2 wrote: > On Wednesday, June 13, 2018 3:11 PM Igal Sapir wrote: >> On 6/13/2018 3:58 AM, Lemke, Michael ST/HZA-ZIC2 wrote: >>> I've been struggling to come to grips with Tomcat installation >>> on Windows Server but I couldn't really find a clear answer. >>> This is what I want to achieve: >>> >>> * Have one directory tree with all my webapps * Have a >>> tomcat installation somewhere different, like C:\Program Files >>> * run tomcat as a service * be able to easily >>> replace/update the tomcat installation >>> >>> I could run the supplied installer and it created a working >>> service. Editing server.xml I could make it use my intended >>> webapps directory. So far so good (if I got that server.xml >>> right) but now all lives in something like >>> D:\apache-tomcat-9.0.6. Not good. The Windows service >>> configuration has this path hard coded in its definition, the >>> directory has files with installation specific configuration >>> and some other live working directories also end up there. Any >>> suggestion how to do this right? So that I can easily upgrade >>> this to say, tomcat 9.0.8? >> >> You can use bin/service.bat [1] to install the service with the >> settings that you want. >> >> Set your configuration settings in environment variables, e.g. >> >> set CATALINA_HOME=<path-to-Tomcat-binaries> set >> JRE_HOME=<path-to-JRE> >> > > Can you elaborate on this? Which variables and do they have to be > environment variables? I'd rather much prefer parameters to install > scripts. Further down you refer to CATALINA_BASE. Would I not have > to start with it to achieve the goals stated above? You should read through this: http://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html#Comma nd_line_arguments Command-line arguments for everything. The service.bat is just a wrapper so you don't have to type so many command-line arguments, and it works with environment variables expected by other scripts. Look at the end of service.bat to see how it's invoked. >> Then install the Windows service with >> >> service.bat install >> >> If you want to update a previous installation then first >> uninstall the service with >> >> service.bat uninstall >> >> Be sure to check the changelog for breaking changes first. > > But then I have to manually copy my whole server.xml configuration > and hope it is still compatible? Move all logfiles over? You should really use a split CATALINA_HOME + CATALINA_BASE. Tomcat is installed in one directory and all your configs, logs, etc. are in another. A single copy of Tomcat can host an arbitrary number of running services, and you can mix-and-match (Service A runs Tomcat 9.0.5 while services B and C run Tomcat 9.0.6, etc.). Switching between minor versions should not be risky, and you should be able to use your e.g. server.xml file unmodified. Keeping the log files is up to your preference. > It is that I need to separate the Tomcat installation from my > specific configuration and from the runtime requirements. Is this > not possible? I'm not sure I understand what you're asking, here. > What is a recommended setup on Windows? So far I am still at a loss > and can't find anything anywhere. Regardless of platform, I always recommend a split-install where you have separate CATALINA_HOME (this is where you unpack the Tomcat distribution files) and CATALINA_BASE (this is where you have your own conf/* files private to the particular service you are running). You'll want to to some reading to get up to speed. Check our RUNNING.txt in your Tomcat's distribution (CATALINA_HOME), specifically the section titled "Advanced Configuration - Multiple Tomcat Instances". But read the whole thing, anyway. It's just not that long. Read Tomcat's page on "Windows Service". The "service" is just a procrun wrapper that makes Windows (reasonably) happy and launches the JVM to host Tomcat. Note that once the service is configured, no scripts (e.g. catalina.bat, setenv.bat, etc.) have any effect on runtime operation of that service. Instead, you'll have to either edit the service (through the registry or, much more conveniently, with tomcatXw.exe, where X=Tomcat's major version number) or delete it and re-create it with your new settings. Where have you looked already? The Tomcat documentation is far from perfect, but "can't find anything" seems a little nebulous. Most non-trivial deployments of Tomcat are simply too complicated to give a cookie-cutter template for people to use. The cookie-cutter template we have is: C:> unzip apache-tomcat-x.y.z.zip C:> cd apache-tomcat-x.y.z C:> set CATALINA_HOME=[here] C:> set CATALINA_BASE=[path to custom config] C:> service.bat install If you want to step outside of that cookie-cutter path, then you have to start understanding how all the pieces fit together so you can build-up a deployment that meets your own needs. >>> For now, I'd be happy with a single Tomcat service but to be >>> able to have several (on different ports of course) would be a >>> welcome bonus. >> >> Use a different SERVICE_NAME and a different CATALINA_BASE for >> each installation. e.g. >> >> set CATALINA_BASE=<path-to-Tomcat-config-setup> >> >> [1] >> https://github.com/apache/tomcat/blob/trunk/bin/service.bat#L17 You can do everything you have requested with the tools available. - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlshfIoACgkQHPApP6U8 pFjdPw//T0axVquLc0jBTBGU8bMuFjJgpP1kcVLy/xujWlywDfZEkcyholl3jgyA 5EoqBckZbXHar+hAkGg3EdX14GFAzSfyhtQUz+8q6TU/6ZGM28LeCVw3RJE4JiL4 hLyjYH+bGSgeH9lmjtUxM3TccMbWTBVdK8l1X3EUzCGBNOL6fH9CdGXENvD6vxRO gABFasxRQehuqwXeEXRbQEIsb99idMnxPM3OL5fiHJ7QNTsArRryDARynJfFGI2+ DDjiXm1FYfLFaNclrcVvX9EdCvg3XypAfMX4uzAjsgDPa4XUaB6x/m4iA8woRJ0D LMT9cQfdUSoDLQwqrHkb5AqMPdRZXzqF+nNDuKJr30q9weOIPUkrAMvJVlnLWXrL atRlgwbZa4GEMpDHvC6X/VBbIudrpDkbB4Oxoe7hzZJ2nIu0/XjZuhrlOYmgWhl0 4S3Ylks7ppR6BPxQ+DpVuWgVjJRsrDpcM9UaCPpGCgLcBBNzEFDjSpz6CmsLOAs/ L88uTsTY3VL/leL2JU1dL/TMb+uGkAlkpyvGfZlUrzUYSkw0rxz2q3ijR8w0LoId PBb5DNUbnT2ZTuKE76Wz4aN1rtxKUb0qmxQTrgQLt4B4Q6XmomgH6cpKa+3bHfjc xBjoNJfvL29iSg0U7KtoFy+nn08SAh3vtjGdpQIl3BNp51xBbRY= =7zLt -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org