Bug 65779 - Introduce CATALINA_BASE_DATA
Summary: Introduce CATALINA_BASE_DATA
Status: NEEDINFO
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Mac OS X 10.1
: P2 enhancement (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-01 23:01 UTC by Gael Lalire
Modified: 2022-01-12 18:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gael Lalire 2022-01-01 23:01:21 UTC
The work directory should go in CATALINA_BASE_DATA if defined CATALINA_BASE else.
Also the unpacked war will go in CATALINA_BASE_DATA if it exists.
Comment 1 Mark Thomas 2022-01-11 14:26:24 UTC
Why is this required? The work directory can already be configured per host and per context.
Comment 2 Gael Lalire 2022-01-11 18:26:41 UTC
In Vestige each application instance got 3 directories (I put default location on a Linux below, but is is OS dependent) :
- conf : $HOME/.config/vestige/app/<app-instance-name>
- data : $HOME/.local/share/vestige/app/<app-instance-name>
- cache : $HOME/.cache/vestige/app/<app-instance-name>

To install tomcat, I removed :
- bin (a Runnable or Callable Java class is used to launch it, no need to keep a bat or sh script)
- RUNNING.txt (not relevant since the launching is from the Vestige console)
- lib (the .m2/repository is used)
- logs (using system log [mac or systemd service] or put them in cache directory)
- temp (using system temporary directory)

So in conf dir it remains
- conf (correct location)
- logs (only non static logs localhost_access_log.txt, I would prefer it to be in CATALINA_BASE_CACHE by default)
- pre-resources (a new directory to emulate classpath hack, whose conf is in conf/context.xml)
- webapps (correct location for .war, but unzipped war is not a conf it should be in CATALINA_BASE_DATA by default)
- work (I would like it to be in data by default, if you introduce CATALINA_BASE_DATA, I will set it in the Java class launcher)

I know you can change the directories with some conf but I would like the default location to be modifiable.

I hope I'm clear.
Comment 3 Christopher Schultz 2022-01-12 17:34:30 UTC
Sorry, this is *not* clear. You have now mentioned both CATALINA_BASE_DATA and CATALINA_BASE_CACHE.

What is the purpose of each?

You are demonstrating how you are using them. What we need to understand is *why* you are using them in that way.
Comment 4 Gael Lalire 2022-01-12 18:19:05 UTC
I think there is no point to show generated data to the tomcat user.
The conf directory is what is shown to the user. There is conf he can modified and webapp where he can copy his WARs. 

If you show the generated data, the user will be able to modify it, accidentally or not.
This is why I think generated data should be in another directory.

Freedesktop (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) proposes a way to separate conf from data from state from cache. There are advantages to that, you can share the conf when your session is roaming between PCs. You can automatically delete cache file which are too old on reboot.

conf : XDG_CONFIG_HOME/vestige/app/<app-instance-name> -> map to CATALINA_BASE
data : XDG_DATA_HOME/vestige/app/<app-instance-name> -> map to CATALINA_BASE_DATA
cache : XDG_CACHE_HOME/vestige/app/<app-instance-name> -> map to CATALINA_BASE_CACHE

Logs could also be generated in data instead of cache, in this case we don't need a CATALINA_BASE_CACHE. But I think logs should be automatically zipped and deleted so a cache directory is more appropriate.

According to Freedesktop XDG_STATE_HOME is the right place for logs. You can also introduce CATALINA_BASE_LOGS instead of CATALINA_BASE_CACHE, I will map it to state or cache.

Not sure my answer is the *why* you expected. Why I want these variables : to be able to separate conf from generated files from logs.