TrueCommand 1.2.2 Installation Enhancements

The command in the TrueCommand Guide:

docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 ixsystems/truecommand:latest

A practical example:

sudo docker run --detach -v "/tc-data:/data" -p 8080:80 -p 8081:443 ixsystems/truecommand:latest

There are a number of issues with this:

  1. The data is lost if the Ubuntu VM is destroyed;
  2. The time in the container does not correspond to local time. The result is incorrect time stamping of alerts in TC.
  3. The command is not persistent. It does not survive a reboot.
  4. Does not facilitate container referencing.

Reboot survival and container referencing

sudo docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 --restart always --name=truecommand ixsystems/truecommand:latest

For example:

sudo docker run --detach -v "/tc-data:/data" -p 7080:80 -p 7081:443 --restart always --name=truecommand ixsystems/truecommand:latest

Time

sudo docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 --restart always --name=truecommand  -e TZ=timezone ixsystems/truecommand:latest

The List of TZ Database Time Zones documentation on Wikipedia contains further information on the different Timezones that can be set.

For example:

sudo docker run --detach -v "/tc-data:/data" -p 7080:80 -p 7081:443 --restart always --name=truecommand -e TZ=Australia/Perth ixsystems/truecommand:latest

FreeNAS storage

Two steps on the FreeNAS server:

  1. Create the dataset
  2. Create the NFS share

Step 1: Create the dataset

screenshot.323.png

Step 2: Create the NFS share

screenshot.324.png

Three steps on the Ubuntu VM:

  1. Install the NFS client
  2. Map the FreeNAS share to the mount point
  3. Start the docker container using the mount point
  4. Set up a persistent mount

Step 1: Install the NFS client

sudo apt-get install nfs-common

Step 2: Map the FreeNAS share to the mount point.

sudo mount 10.1.1.20:/mnt/tank/nfs/truecommand $HOME/truecommand/data

Note: To dismount the share:

sudo umount $HOME/truecommand/data

To list the mounted share:

mount -l

Step 3: Start the docker container using the mount point

For example:

sudo docker run --detach -v "$HOME/truecommand/data:/data" -p 8080:80 -p 8081:443 --restart always --name=truecommand -e TZ=Australia/Perth ixsystems/truecommand:latest

Step 4: Set up a persistent mount

For the mount to survive a reboot, add a line to /etc/fstab. For example:

# <file system> <mount point> <type> <options> <dump> <pass>
10.1.1.20:/mnt/tank/nfs/truecommand /home/administrator/truecommand/data nfs defaults 0 0

Docker Compose

A docker-compose.yml equivalent to the run command.

version: '3.3'
  services:
    truecommand:
    volumes:
      - '/home/administrator/truecommand/data:/data'
    ports:
      - '7080:80'
      - '7081:443'
    restart: always
    container_name: truecommand
    environment:
      - TZ=Australia/Perth
    image: ixsystems/truecommand

References

  1. Mount a TrueNAS or FreeNAS Share to a Docker Host
  2. Network File System (NFS)
  3. TC seems unable to use FreeNAS for storage
  4. 5 ways to change time in Docker container
  5. How to Mount an NFS Share in Linux

Keep Reading

PreviousNext

Comments

Leave a Reply