Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 212f4a1f6ce8
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6b8252d3673e
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Oct 29, 2018

  1. nixos/tomcat: add purifyOnStart option

    With this option enabled, before creating file/directories/symlinks in baseDir
    according to configuration, old occurences of them are removed.
    
    This prevents remainders of an old configuration (libraries, webapps, you name
    it) from persisting after activating a new configuration.
    pvgoran committed Oct 29, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    elevenfive Matthew Zavislak
    Copy the full SHA
    a57bbf4 View commit details

Commits on Nov 4, 2018

  1. Merge pull request #44303 from pvgoran/tomcat-clean-basedir

    nixos/tomcat: add purifyOnStart option
    7c6f434c authored Nov 4, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6b8252d View commit details
Showing with 26 additions and 1 deletion.
  1. +26 −1 nixos/modules/services/web-servers/tomcat.nix
27 changes: 26 additions & 1 deletion nixos/modules/services/web-servers/tomcat.nix
Original file line number Diff line number Diff line change
@@ -31,10 +31,26 @@ in
'';
};

purifyOnStart = mkOption {
type = types.bool;
default = false;
description = ''
On startup, the `baseDir` directory is populated with various files,
subdirectories and symlinks. If this option is enabled, these items
(except for the `logs` and `work` subdirectories) are first removed.
This prevents interference from remainders of an old configuration
(libraries, webapps, etc.), so it's recommended to enable this option.
'';
};

baseDir = mkOption {
type = lib.types.path;
default = "/var/tomcat";
description = "Location where Tomcat stores configuration files, webapplications and logfiles";
description = ''
Location where Tomcat stores configuration files, web applications
and logfiles. Note that it is partially cleared on each service startup
if `purifyOnStart` is enabled.
'';
};

logDirs = mkOption {
@@ -197,6 +213,15 @@ in
after = [ "network.target" ];

preStart = ''
${lib.optionalString cfg.purifyOnStart ''
# Delete most directories/symlinks we create from the existing base directory,
# to get rid of remainders of an old configuration.
# The list of directories to delete is taken from the "mkdir" command below,
# excluding "logs" (because logs are valuable) and "work" (because normally
# session files are there), and additionally including "bin".
rm -rf ${cfg.baseDir}/{conf,virtualhosts,temp,lib,shared/lib,webapps,bin}
''}
# Create the base directory
mkdir -p \
${cfg.baseDir}/{conf,virtualhosts,logs,temp,lib,shared/lib,webapps,work}