MongoDB Update
Starting with Helmut4 v4.12, it is now possible to upgrade the internal MongoDB database from version 3.4 to a current supported version (8.2).
This is a major database upgrade. The procedure modifies the storage layer and must be performed carefully. An incorrect execution may result in an unusable or lost database.
Please read the following instructions completely before starting and ensure you understand every step.
MongoDB update support
Our support team can perform the migration together with you. We strongly recommend scheduling an appointment.
Remote access will be required (SSH access to the server and a Windows or macOS client for coordination).
Step 0 – Maintenance Window
Perform the upgrade during a dedicated maintenance window.
The migration itself typically takes ~30 minutes, however you should reserve at least 1 hour to allow for verification and unexpected delays.
Step 1 – Backups (Required)
Before continuing, create two independent backups and store them outside your normal backup directories.
Create:
A Helmut4 configuration backup via the Preferences tab in the Helmut4 UI
A database backup using the mongodb_backup container
Do not proceed unless both backups were successfully created and verified.
Step 2 – Stop the System
Stop the Helmut4 stack and wait until all containers are fully stopped.

Then open Portainer → Volumes and locate:
helmut4_mcc_mongodb
Delete the volume.
If you are running a cluster environment, repeat this step on every worker node.

Step 3 – Update Container Images
Go to Portainer → Stacks and edit the helmut4 stack.
Locate the following services:
mongodbormongodbrsmongodb_backupmongoadmin(to be replaced by mongo-express)
Update all image versions to the versions listed in the Docker Image Version History under the snapshot tag mongodb_8.
For mongoadmin, follow the instructions on the Mongo Express documentation page.
After updating the image tags, save the stack configuration and click "Update the stack".
If you are running a single-server installation, continue with Step 5. If you are running a cluster installation, proceed with Step 4.
Step 4 – Rebuild the MongoDB Replica Set (Cluster only)
If you are running a cluster environment, the MongoDB replica set must be rebuilt after all mongodbrs containers have started successfully.
Detailed instructions can be found in the Helmut4 Cluster System documentation. However, one important change applies to this upgrade:
MongoDB now uses mongosh instead of the legacy mongo shell.
To connect to the mongodbrs container, run:
After connecting, rebuild the replica set as described in the cluster documentation.
Once the replica set is operating correctly, continue with Step 5.
Step 5 - Configure runtime and system parameters for MongoDB
Recent MongoDB versions require additional runtime, connection, and host-level system settings to ensure stable and reliable operation under normal load.
Step 5.1 - ulimits - Limits for resources, processes, threads, and file handles
nofile defines the maximum number of open file descriptors. File descriptors are used for various resources, including:
network sockets
log files
database files
pipes and other I/O handles
In the context of MongoDB, this is important because MongoDB may open:
many database files
many client connections
replication and network sockets
internal files used by the storage engine
If the nofile limit is set too low, MongoDB may run into issues such as:
“too many open files” errors
failed client connections
inability to open data or index files
nproc defines the maximum number of processes and threads that the user inside the container may create.
Although the name refers to “processes,” on Linux this limit also effectively affects threads. This is important because MongoDB uses multiple threads for:
client handling
background maintenance
replication
storage engine tasks
If the nproc limit is too low, MongoDB may fail to create additional worker threads under load. This can lead to instability or startup/runtime failures.
Step 5.2 - Define connection pool size and idle timeout for database connections
This setting only applies to clustered systems. Single-server systems do not need these parameters.
To manage the connections between the Java containers, especially the Spring Boot services, and MongoDB, it is recommended to define a connection pool together with a dedicated idle timeout.
In a typical three-server cluster environment, each host runs 12 containers, resulting in a total of 36 containers establishing connections to the MongoDB cluster. If connections are not closed properly, the number of occupied connections may steadily increase and eventually lead to connection errors because no free connections remain.
To prevent this, the following containers should have a connection limit and an idle timeout added to them: fx, io, co, hk, users, streams, logging, language, cronjob, preferences and metadata.
Connection parameters
Meaning of the parameters
maxPoolSize=30Defines the maximum number of connections that a container may open to MongoDB.minPoolSize=5Ensures that a minimum number of connections are kept ready in the pool.maxIdleTimeMS=60000Closes idle connections after 60,000 milliseconds (60 seconds), helping to free unused connections and prevent unnecessary resource consumption.
Step 5.3 - Kernel memory settings for MongoDB 8.x
Recent MongoDB versions require additional host-level kernel memory settings to run reliably and without startup warnings. These settings must be configured on every MongoDB host, not inside the container.
Required values
Transparent Huge Pages:
enabled = alwaysTHP defrag:
defer+madvisekhugepaged/max_ptes_none = 0vm.overcommit_memory = 1vm.swappiness = 1
These parameters improve MongoDB memory handling and help avoid performance issues caused by swapping or unsuitable huge page behavior.
Persist THP settings via systemd
The Transparent Huge Page settings under /sys/kernel/mm/... are not persistent after reboot.
To ensure they are applied automatically before MongoDB starts, create the following systemd service on the host:
After creating the service, reload systemd and enable it so it starts automatically on boot:
Persist sysctl settings
The following kernel parameters must be persisted separately via sysctl:
Verify
Run the following commands to verify the active settings:
Expected values:
[always]
[defer+madvise]
0
1
1
Step 6 – Restore the Backup
After the new MongoDB container(s) are running, the database backup must be restored.
Open a terminal session inside the mongodb_backup container.
Instructions on how to open a console session can be found in the documentation section Restore mongodb_backup.
Inside the container, execute the following command and wait until the message “Backup restored” appears:
Do not interrupt this process. Depending on the database size, the restore may take several minutes.
Once the restore has completed, restart the Helmut4 stack. This restart is required so all services reload and correctly initialize using the restored database.
Step 7 – Verify the System
Helmut4 is now running with the MongoDB v8 database.
Before ending the maintenance window, perform functional checks to confirm the system is operating correctly. We recommend verifying at least the following:
User login and panel access
Opening an existing project
Asset visibility in Cosmo
Workflow execution (e.g. a small test job or import)
New assets being created and indexed
If any issues occur, do not resume production work.
Please contact support while the maintenance window is still active so the system can be checked and, if necessary, reverted to its previous state.