Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

2.5. Filesystem Paths

JBoss EAP 6 uses logical names for filesystem paths. The domain.xml, host.xml, and standalone.xml configuration files each include a section for declaring paths.
Other sections of each file can then reference the paths using their logical name, avoiding the need to use absolute paths for each instance and allowing specific host configurations to resolve to universal logical names.
The default logging subsystem configuration, for example, declares jboss.server.log.dir as the logical name for the server’s log directory.

Example 2.16. Relative path example for the logging directory

<file relative-to="jboss.server.log.dir" path="server.log"/>
JBoss EAP 6 automatically provides a number of standard paths without any need for the user to configure them in a configuration file.

Table 2.4. Standard Paths

Value Description
java.ext.dirs The Java development kit extension directory paths.
jboss.home.dir The root directory of the JBoss EAP 6 distribution.
user.home The user home directory.
user.dir The user's current working directory.
java.home The Java installation directory
jboss.server.base.dir The root directory for an individual server instance.
jboss.server.data.dir The directory the server will use for persistent data file storage.
jboss.server.config.dir The directory that contains the server configuration.
jboss.server.log.dir The directory the server will use for log file storage.
jboss.server.temp.dir The directory the server will use for temporary file storage.
jboss.server.deploy.dir The directory that the server will use for storing deployed content.
jboss.controller.temp.dir The directory the host controller will use for temporary file storage.
jboss.domain.base.dir The base directory for domain content.
jboss.domain.config.dir The directory that contains the domain configuration.
jboss.domain.data.dir The directory that the domain will use for persistent data file storage.
jboss.domain.log.dir The directory that the domain will use for persistent log file storage.
jboss.domain.temp.dir The directory that the domain will use for temporary file storage.
jboss.domain.deployment.dir The directory that the domain will use for storing deployed content.
jboss.domain.servers.dir The directory that the domain will use for storing outputs of the managed domain instances.
Override a Path

If you are running a standalone server, you can override all the jboss.server.* paths in one of the two ways.

  • You can pass command line arguments when you start the server. For example:
    bin/standalone.sh -Djboss.server.log.dir=/var/log
  • You can modify the JAVA_OPTS variable in the server configuration file. Open the EAP_HOME/bin/standalone.conf file and add the following line at the end of the file:
    JAVA_OPTS="$JAVA_OPTS -Djboss.server.log.dir=/var/log"
Path overrides is supported for servers running in a managed domain. For example, the jboss.domain.servers.dir can be used to change the base directories of servers in a managed domain.
Add a Custom Path

You can also create your own custom path. For example, you may want to define a relative path to use for logging. You can then change the log handler to use my.relative.path,

Example 2.17. A custom logging path

my.relative.path=/var/log

2.5.1. Directory Grouping

In domain mode, each server's files are stored in the EAP_HOME/domain/ directory. Subdirectories are named according to the directory-grouping attribute, either by server or file type.
Directory Grouping by Server

The default directory grouping is by server. If your administration is server-centric, this configuration is recommended. For example, it allows backups and log file handling to be configured per server instance.

Example 2.18.  Directory Grouping by Server

If JBoss EAP is installed using the Zip method and all default options apply, the directory structure in domain mode will be as follows.
EAP_HOME/domain
             └─ servers
                  ├── server-one
                  │   ├── data
                  │   ├── tmp
                  │   └── log
                  └── server-two
                      ├── data
                      ├── tmp
                      └── log
If the directory-grouping attribute has been changed from the default, and you want to reset it, enter the following management CLI command.
/host=master:write-attribute(name="directory-grouping",value="by-server")
This will update the controller's host.xml configuration file:
<servers directory-grouping="by-server">
  <server name="server-one" group="main-server-group" >
  </server>
  <server name="server-two" group="main-server-group" auto-start="true">
  </server>
</servers>
Directory Grouping by Type

Instead of grouping each servers' directories by server, you can instead group them by file type. If your administration is file type-centric, this configuration is recommended. For example, backup configuration is simpler if you want to include only data files.

To group domain data directories by type, enter the following management CLI command:
/host=master:write-attribute(name="directory-grouping",value="by-type")
This will update the controller's host.xml configuration file:
<servers directory-grouping="by-type">
  <server name="server-one" group="main-server-group" >
  </server>
  <server name="server-two" group="main-server-group" auto-start="true">
  </server>
</servers>

Example 2.19.  Directory Grouping by Type

If JBoss EAP is installed using the Zip method and the domain's files are grouped by type, the directory structure in domain mode will be as follows.
EAP_HOME/domain
            ├── data
            │   └── servers
            │       ├── server-one
            │       └── server-two
            ├── log
            │   └── servers
            │       ├── server-one
            │       └── server-two
            └── tmp
                └── servers
                    ├── server-one
                    └── server-two

2.5.2. Use Case: Overriding Directories

In this example, the objective is to store domain files in the /opt/jboss_eap/data/domain_data directory, and give each top-level directory a custom name. The directory grouping used is the default: by-server.
  • Log files stored in the subdirectory all_logs
  • Data files stored in the subdirectory all_data
  • Temporary files stored in the subdirectory all_temp
  • Servers' files stored in the subdirectory all_servers
To achieve this configuration, you would override several system properties when starting JBoss EAP.
./domain.sh \
      -Djboss.domain.temp.dir=/opt/jboss_eap/data/domain_data/all_temp \
      -Djboss.domain.log.dir=/opt/jboss_eap/data/domain_data/all_logs \
      -Djboss.domain.data.dir=/opt/jboss_eap/data/domain_data/all_data\
      -Djboss.domain.servers.dir=/opt/jboss_eap/data/domain_data/all_servers
The resulting path structure will be as follows:
/opt/jboss_eap/data/domain_data/
├── all_data
│   └── content
├── all_logs
│   ├── host-controller.log
│   └── process-controller.log
├── all_servers
│   ├── server-one
│   │   ├── data
│   │   │   ├── content
│   │   │   ├── logging.properties
│   │   ├── log
│   │   │   └── server.log
│   │   └── tmp
│   │       ├── vfs
│   │       │   └── temp
│   │       └── work
│   │           └── jboss.web
│   │               └── default-host
│   └── server-two
│       ├── data
│       │   ├── content
│       │   ├── logging.properties
│       ├── log
│       │   └── server.log
│       └── tmp
│           ├── vfs
│           │   └── temp
│           └── work
│               └── jboss.web
│                   └── default-host
└── all_temp
    └── auth
          ...