Docker Management

When it comes to the use of Docker as an integrated part of the Sandfly application, it is largely "hands-off" administratively ... only requiring the most recent production release of Docker or Podman in connection to the associated Sandfly distribution.

However, some default Docker settings are not always the best for the hosts. Thus, we provide this section of documentation for optional ways to improve or modify how Docker is used on your Sandfly systems.

Log Rolling

By default Docker does not roll container logs. Thus, a long running Sandfly container could potentially generate huge container log files. This, in turn, could affect the operational functionality of both the application and the underlying host should the logs fill up the filesystem.

Our Docker containers are configured to automatically roll all of their log files. No actions are needed on your part.

On top of that, as some containers commonly produce more log output than others, we provide the option to customize the size of those files to fit your needs.

Default maximum log size per container type:

  • Sandfly Server (sandfly-server) = 100m
  • Postgres (sandfly-postgres) = 20m
  • Sandfly Node = 100m / instance

In all cases log rolling is set to maintain a maximum of 5 log files per container (the active log plus the 4 most recently rolled logs). Should you need more or less files maintained, please contact Sandfly support for assistance.

In order to determine the largest amount of disk space that would be consumed by the logs of any single container, multiply the configured maximum log file size by the quantity of maintained files.

🚧

CAUTION: Docker container logs start anew when using Sandfly start scripts

The use of the start scripts always creates a new container, in turn this will create a new log file. If the clean_docker.sh script is used to shutdown Sandfly, the old containers (and the logs within) will be deleted.

Customized Log File Size

The start scripts provide the ability to set a customized maximum Docker log size for the Sandfly Server and/or Node container logs, which are set to 100m by default. To set your own log size, create a permanent environment variable for SANDFLY_LOG_MAX_SIZE on the user account that runs the containers on the Server and/or Node and set the value to the desired size.

In order for the value of the environment variable to be accepted by the start scripts, it must be in a Docker log "max-size" format. For use by Sandfly, this value must consist of a positive integer followed by the lower-case letter m or g, which represents the unit of measure. If the value does not match the expected format, the log size will automatically fall back to default size.

For example, if the account uses bash for its shell, one method would be to edit .bashrc and add a line like the following:

export SANDFLY_LOG_MAX_SIZE=50m

Then reload the rc file with a command like this (change the path to the rc file as appropriate):

source .bashrc

Finally, every Sandfly Server and/or Node container that intends to use that environment variable will need to be properly stopped, cleaned, and then started in order to pick up the new (or changed) setting. This is akin to the stop and start steps taken when performing an upgrade.

The end result for the above example, should that environment variable be applied to both the server and all nodes, is that those hosts would roll their sandfly server / host container logs at approximately 50m per log instead of the default 100m.

EXTERNAL REFERENCES: