TrueNAS Apps: Tutorials
Application maintenance is independent from TrueNAS version release cycles.
App versions, features, options, and installation behavior at time of access might vary from documented tutorials and UI reference.
Elastic Search
17 minute read.
Elastic Search is the distributed, RESTful search and analytics engine at the heart of the Elastic Stack. The TrueNAS Elastic Search app allows you to configure and deploy a single Elasticsearch node. You can install multiple instances to deploy additional nodes, however you must configure a Custom App with the Install via YAML option to deploy a multi-node cluster.
This tutorial covers installing the TrueNAS Elastic Search app to deploy a node. It does not detail management of the node or integrating it with other containers. Elastic provides a basic primer, What is Elasticsearch, with further information about the app and its place within the Elastic Stack.
Prepare TrueNAS before installing the app by:
Set a pool for applications to use if not already assigned.
You can use either an existing pool or create a new one. TrueNAS creates the ix-apps (hidden) dataset in the pool set as the application pool. This dataset is internally managed, so you cannot use this as the parent when you create required application datasets.
After setting the pool, the Installed Applications screen displays Apps Service Running on the top screen banner.
Locate the run-as user for the app.
Take note of the run-as user for the app, shown on the app information screen in the Run As Context widget and in the Application Metadata widget on the Installed applications screen after the app fully deploys. The run-as user(s) get added to the ACL permissions for each dataset used as a host path storage volume.
Create datasets for the storage volumes for the app.
Do not create encrypted datasets for apps if not required! Using an encrypted dataset can result in undesired behaviors after upgrading TrueNAS when pools and datasets are locked. When datasets for the containers are locked, the container does not mount, and the apps do not start. To resolve issues, unlock the dataset(s) by entering the passphrase/key to allow datasets to mount and apps to start.Go to Datasets and select the pool or dataset where you want to place the dataset(s) for the app. For example, /tank/apps/appName.
Create a storage dataset for Elastic Search Data Storage with a name such as data). Select apps as the Dataset Preset for this dataset. You can modify the dataset ACLs at the time of creation, or modify them later when adding them in the app.
Create a self-signed certificate for the app (if required).
Adding a certificate is optional but if you want to use a certificate for this application, either create a new self-signed CA and certificate or import an existing CA and create the certificate for Elastic Search. A certificate is not required to deploy the application.
This basic procedure covers the required Elastic Search app settings. For optional settings, see Understanding App Installation Wizard Settings.
You can have multiple deployments of the same app (for example, two or more from the stable or enterprise trains, or a combination of the stable and enterprise trains).
Go to Apps, click on Discover Apps, and locate the app widget by either scrolling down to it or begin typing the name into the search field. For example, to locate the MinIO app widget, begin typing minIO into the search field to show app widgets matching the search input.
If this is the first application installed, TrueNAS displays a dialog about configuring apps.
If not the first time installing apps the dialog does not show, click on the widget to open the app information screen.
Click Install to open the app installation wizard.
Application configuration settings are grouped into several sections, each explained below in Understanding App Installation Wizard Settings. To find specific fields begin typing in the Search Input Fields search field to show the section or field, scroll down to a particular section, or click on the section heading in the list of sections on the upper-right of the wizard screen.
Accept the default value or enter a name in Application Name field. In most cases use the default name, but if adding a second deployment of the application you must change this name.
Accept the default version number in Version. When a new version becomes available, the application shows an update badge and the Application Info widget on the Installed applications screen shows the Update button.
Enter the Elastic Search Configuration settings.
Enter a password to use for the built-in elastic user. Passwords must be at least six characters long.
Accept the default or enter a value in Heap Size. Elastic documentation recommends setting the heap size to no more than 50% of the total memory visible to the container.
Accept the default value in Node Name.
The TrueNAS app is configured with all the required environment variables, but if you want to further customize the container, click Add to the right of Additional Environment Variables for each to enter the variable(s) and values(s).
Accept the default values in Network Configuration. See Network Configuration for more details.
Do not select Host Network.
Add your Storage Configuration settings.
Set Host Path (Path that already exists on the system) in Type for Elastic Search Data Storage. Select Enable ACL, and then enter or browse to and select the data dataset created above to populate the Host Path field.
Click Add to the right of ACL Entries for each user or group entry you want to add. Enter the user and group ID 1000 and give each FULL_CONTROL Access.
Select Force Flag.
Repeat the storage steps above each additional storage volume. See Storage Configuration Settings below for more information.
Accept the defaults in Resources Configuration.
Click Install. A progress dialog displays before switching to the Installed applications screen. The Installed screen displays with the elastic-search app in the Deploying state. Status changes to Running when ready to use.
Click Web UI on the Application Info widget to open the Elastic Search web portal screen, which displays information about the configured node.
This is the equivalent of running a curl
check on the app port.
The following section provides more detailed explanations of the settings in each section of the Install Elastic Search installation wizard.
Accept the default value or enter a name in Application Name field. In most cases use the default name, but if adding a second deployment of the application you must change this name.
Accept the default version number in Version. When a new version becomes available, the application shows an update badge and the Application Info widget on the Installed applications screen shows the Update button.
Elastic Search configuration settings include setting up credentials, naming the node, and setting the heap size, networking configuration, storage configuration, configuring labels and setting resource limits for the container.
If you have an existing Elastic Search account, add the credentials for that account in the Admin User and Admin Password fields. If you do not have an existing account, enter the name and password you want to use to create the Elastic Search login credentials.
The app wizard is configured with all settings required to deploy the container, but you can add additional settings if you want to further customize the app in TrueNAS.
Click Add to the right of Environmental Variables to show a set of fields to configure the application with additional variables.
You can add environment variables to the app configuration after deploying it. Click Edit on the Application Info widget for the app found on the Installed Application screen to open the edit screen.
Enter variables using Elastic Search with Docker syntax.
- Change the setting name to uppercase
- Prefix it with
ES_SETTING_
- Escape any underscores (
_
) by duplicating them - Convert all periods (
.
) to underscores (_
)
For example, to set bootstrap.memory_lock=true
, enter ES_SETTING_BOOTSTRAP_MEMORY__LOCK for Name and true for Value.
The default web port for Elastic Search is 30003.
We do not recommend selecting Host Network unless required for the specific application or workload. When required or strongly recommended for an application, TrueNAS typically enables host networking by default.
When host networking is disabled, specific ports from the container are exposed on the local network and mapped to a host port. This is the default Docker networking behavior. This approach provides better isolation, flexibility in port assignments, and improved security compared to enabling host networking.
Select Host Network to bypass port mapping, granting the container direct access network interfaces on the host. This can improve performance, especially in deployments with many users, and simplify network configuration, but compromises isolation and introduces the risk of port conflicts, limiting the ability to run multiple instances of the same app. For most deployments, default port mapping is more secure and versatile.
All TrueNAS apps are assigned default port numbers. Accept the default port numbers, but if changing port number assignments, enter a number within the range 1-65535, however, 0-1024 might require the application to have elevated privileges. Before changing default ports, refer to the TrueNAS default port list for a list of assigned and available port numbers.
To use a certificate, best practice is to create the self-signed certificate before you begin using the app installation wizard. If you did not create a certificate before starting the installation wizard you can select the default TrueNAS certificate and edit the app to change the certificate after deploying the application.
Select the certificate created in TrueNAS for the app from the Certificate dropdown list.
TrueNAS provides two options for storage volumes: ixVolumes and host paths.
Elastic Search needs one dataset for host path storage volume configuration, with a name such as data, to use as the Elastic Search Data Storage volume. Create this dataset before beginning the app installation wizard, as described in Before You Begin.
If needed, you can add extra storage volumes at the time of installation or edit the application after it deploys. Stop the app before editing settings.
You can configure ACL permissions for the required dataset in the Install Elastic Search wizard, or from the Datasets screen any time after adding the datasets.
Select Enable ACL to show the ACL and ACE Entries options. Configure ACE entries for each UID and/or GID you recorded from the Run As Context widget in Before You Begin.
Select Force Flag to apply the ACL even if the path has existing data. This allows you to update the app when an update is available.
TrueNAS Additional Storage options include the ability to mount an SMB share inside the container pod.
Set Type an SMB/CIFS Share (Mounts a volume to a SMB share) to add an SMB share storage volume.
Select Read Only to make the storage volume read only.
Enter the path inside the container to mount the storage for the share volume in Mount Path.
Enter the server address for the SMB share in Server, the path to mount the SMB share in Path, and the share authentication user credentials in User and Password. (Optional) enter the share domain name in domain.
Permissions are currently limited to the permissions of the user that mounted the share.
Use the SMB option for data synchronization between a share and the app if the option shows on the screen. A present, only the Syncthing app includes this option.
The Labels Configuration settings allow users to configure Docker object labels to add metadata to containers. Docker object labels attach key-value metadata to various Docker objects, such as containers, images, volumes, and networks. Labels are useful for organization, automation, and providing additional context for Docker resources. They can store information such as environment details, ownership, service role, or custom tags for automation tools.
Click Add to display a set of label configuration fields.
Use Key to define the identifier that categorizes and filters resources, for example com.example.owner. Use Value to enter the associated data for the container, for example team-a.
Select the target container from the Containers dropdown list to apply the label(s). Apps with multiple containers list each container as an option on the dropdown.
Click Add again to configure additional labels.
Tips for Labels:
- Docker recommends using reverse-DNS notation to prevent conflicts with other objects.
- Use a consistent naming convention for labels applied across all containers, for example, com.example.owner=team-a, com.example.owner=team-b, com.example.env=production, com.example.env=testing.
- Use in groupings, for example, when applying configuration changes where labels define or group related database resources (com.example.role=db).
- Use reverse-DNS notation to prevent conflicts with other objects, as recommended by Docker.
- Use a consistent naming convention for labels applied across all containers, for example, com.example.owner=team-a, com.example.owner=team-b, com.example.env=production, com.example.env=testing.
- Use in groupings, for example, when applying configuration changes where labels define or group related database resources (com.example.role=db).
- Combine labels for more granular control, for example, using com.example.env=prod and com.example.tier=frontend to distinguish frontend from backend services in production environments.
Accept the default values in Resources Configuration or enter new CPU and memory values. By default, this application is limited to use no more than 2 CPU cores and 4096 megabytes available memory. The application might use considerably less system resources.
To customize the CPU and memory allocated to the container the app uses, enter new CPU values as a plain integer value (letter suffix is not required). The default is 4096.
Accept the default value (4 Gb) allocated memory or enter a new limit in bytes. Enter a plain integer without the measurement suffix, for example, 129 not 129M or 123MiB.