mirthSync is an open source DevOps tool for Mirth Connect and Open Integration Engine (OIE) version control and CI/CD automation. This command line tool enables healthcare integration DevOps workflows by synchronizing code between servers - allowing you to push or pull channels, code templates, configuration maps, and global scripts. The tool includes built-in Git integration for channel versioning and version control best practices, automatic orphaned file detection and cleanup, and supports GitOps and infrastructure as code methodologies for healthcare interface engines including HL7 v2, FHIR, and DICOM integration deployments.
The only requirements are having credentials for the server that is being synced and the server also needs to support and allow access to Mirth Connect's REST API.
mirthSync now supports Open Integration Engine (OIE), an open-source fork of Mirth Connect that continues to provide the powerful integration capabilities of the original platform. This support allows you to use mirthSync with both traditional Mirth Connect servers and OIE instances seamlessly.
We extend our sincere gratitude to the maintainers and contributors of the Open Integration Engine project for their dedication to keeping this powerful integration platform alive and open-source. Their work ensures that the community continues to have access to a robust, actively maintained integration engine.
A companion VS Code extension is available for a graphical interface to mirthSync operations. See VS Code Extension Documentation for details.
Install from the VS Code Marketplace.
- Set up Mirth Connect version control with Git using mirthSync's built-in integration to automatically track your healthcare integration configurations
- Implement Mirth Connect channel versioning best practices using Git branches for dev, test, and prod environments
- Enable automated channel promotion between Mirth Connect servers for multi-environment deployments
- Build Mirth Connect CI/CD pipelines with automated deployments:
- GitLab CI example deployments for interface engine version control
- Jenkins integration for automated channel deployments
- GitHub Actions workflows - see our mirthsync-ci repository for a complete CI/CD pipeline example
- Implement GitOps for healthcare integration engines with infrastructure as code workflows
- Support continuous integration and continuous deployment in healthcare environments
- Work on Mirth JavaScript locally with your favorite editor without editing XML
- Version control HL7 v2, FHIR, and DICOM routing configurations
The latest version of mirthSync is "3.10.0". Note the changes below. Version 3 of mirthSync changed the layout of the target directory structure. Javascript is extracted into separate files and top level channels are now placed in a default group directory.
Recent Improvements:
- Token-based Authentication: New
--tokenflag for authentication using existing HTTP session tokens (alternative to username/password) - Simplified Git Operations: Git commands no longer require server credentials or authentication flags
- Bulk Channel Deployment: New
--deploy-allflag for efficient bulk deployment of multiple channels - Selective Deployment: New
--deploy-changedand--deploy-newflags deploy only channels with pending changes or new channels after a push - Enhanced Orphaned File Detection: Always detects orphaned files during pull operations with clear user warnings and optional automatic deletion
- Improved User Experience: Better code organization and elimination of duplicate orphan detection logic
- Enhanced Git Integration: Comprehensive subcommand support (init, status, add, commit, diff, log, branch, checkout, remote, pull, push, reset)
- Improved JGit API: Better reliability and performance with fixed reflection warnings
- Security: Path validation and safety features for file operations
Version 3.9.0 changes how item names map to file and directory names, so that a target directory works on Windows as well as on macOS and Linux.
Item names are the names of channels, channel groups, code templates, code template libraries, alerts, and the transformer and filter steps that become .js files.
- Control characters,
%and" * : < > ? |are percent encoded, as/and\already were. For example,Accept message if "msg['MSH']" equals "X"becomesAccept message if %22msg['MSH']%22 equals %22X%22, and50% offbecomes50%25 off. Because%is encoded too, a name no longer shares a file with the encoded form of another name. - Trailing dots and spaces are percent encoded, because Windows silently drops them.
- Windows reserved device names (
CON,PRN,AUX,NUL,COM0-COM9,COM¹-COM³,LPT0-LPT9andLPT¹-LPT³, in any case, with or without an extension, and with or without spaces before the extension) have their last character percent encoded. For example,AUXbecomesAU%58andNUL .txtbecomesNU%4C .txt. - Names longer than 240 UTF-8 bytes are cut to 200 bytes and end with
-plus an 8-character hash of the full name.
Names without these characters are unchanged.
- The next pull writes affected items under their new names. Files with the old names stay in place and are reported as orphans.
- Those old files may hold local edits that were never pushed.
--delete-orphaneddeletes them, so push any local changes before upgrading. - A pull without
-fkeeps your existing XML files. For an item whose own name did not change, its XML still names the old script files, and push keeps reading the files the XML names, so edits to the old files are still pushed. - If the name of a channel, channel group, code template, library or alert itself changed, a pull without
-fwrites a second XML file for the same item next to the old one. Push would then upload both, and the one pushed last wins, so local edits can be overwritten by the server's copy. Resolve this with the suggested steps below before pushing. - A
--restrict-to-pathvalue that names an affected item no longer names it, because its directory and file names changed. A value that names no item matches every item whose path starts with it, so an old value can match nothing or a different item. For example,-r "Channels/G/AUX"can take a channel namedAUX Resultsinstead ofAU%58. mirthsync warns when a value matches nothing, but not when it matches a different item.
- Push any local changes with your current version.
- Have everyone who works on the same target directory upgrade together.
- Run
pull -f --delete-orphanedonce, without-ror--skip-disabled, review the result, and commit it. A plainpull -fwrites the new files but leaves the old ones in place. Without-f, existing XML files are kept, so a renamed item gets a second XML file and the next push uploads both. With-ror--skip-disabled, the orphan cleanup still deletes the old files of the items the pull skipped, but does not write their new ones. - Update any
-r/--restrict-to-pathvalues in scripts and CI jobs to the new names. In a.bator.cmdfile, cmd treats%specially: write each%as%%, for example-r "Channels/G/AU%%58", or as%%%%when the command is run withcall, as the npmmirthsynccommand must be from a batch file. Otherwise cmd reads%5as the fifth argument to the batch file. PowerShell and other shells need no change.
- Paths inside a target directory can exceed 260 characters.
On Windows, Java handles long paths, but Git needs
git config core.longpaths true.
--deploy-alldeploys only the pushed channels (PR #111, thanks @enricogasparini): since 3.5.0,--deploy-allsent the server an empty list of channels, which the server takes to mean every channel. A push limited with-rtherefore deployed the whole server. It now deploys only the channels that the push sent.- Verbose output no longer shows the password or token (issue #110, PR #112): with
-vor higher, the log printed the configuration with the password and the session token in plain text. Both are now masked. Treat logs captured at those levels by earlier versions as holding credentials. - Shorter messages for failed requests (issue #48, PR #113): a wrong password, a wrong server URL or an expired token printed a long stack trace. mirthSync now prints which request failed, the HTTP status, a hint for the common causes and the start of the server's answer. Add
-vto see the stack trace. Other failures, such as a refused connection, still print it. - Database Reader and Writer scripts become
.jsfiles (issue #65, PR #114): when a Database Reader or Database Writer is set to use JavaScript, its script is now extracted to its own.jsfile, as JavaScript Reader and Writer scripts already are. Connectors that hold SQL are unchanged.- A Database Reader gives
sourceConnector-sourceConnector-select.jsandsourceConnector-sourceConnector-update.js. A Database Writer namedWritergivesdestinationConnector-Writer.js. - After you upgrade, pull once with
-f. Without-f, the pull writes the new.jsfiles but keeps the existing channel XML, which still holds the script, so a push does not read the new files.
- A Database Reader gives
- Scripts with control characters can be pulled and pushed (issue #76, PR #115): a script that held a control character such as U+0017 made the whole pull fail with an XML parsing error. Such characters are now kept. In XML files they are written as character references, for example
, the way the server writes them. In.jsfiles they are the characters themselves.- A document that holds one of these control characters together with a Unicode noncharacter between U+FDD0 and U+FDEF is refused with an error.
- Emoji are no longer changed by a push (PR #116): a character above U+FFFF, such as an emoji, anywhere in a pushed item was replaced by a different character on the server. This included scripts, because a push sends each script inside its item's XML.
- XML files written by a pull now hold such a character as itself where they held a reference such as
😀. Expect a one-time change in version control for files that contain one.
- XML files written by a pull now hold such a character as itself where they held a reference such as
This release changes the names of some files in a target directory. Read Upgrading to 3.9.0 before you upgrade.
- Windows-safe file names (PR #101, thanks @dbelinsky-accureference): item names are now encoded so that a target directory works on Windows as well as on macOS and Linux. Names without the characters below are unchanged.
- Control characters,
%and" * : < > ? |are percent encoded, as/and\already were. Trailing dots and spaces are encoded too. - Windows reserved names such as
AUX,CONandNUL.txthave their last character encoded, for exampleAU%58. - Names longer than 240 bytes are shortened and end in a short hash. A pull no longer stops with "File name too long" on a long transformer or filter step name.
- Push reads each script from the file name stored in the item's XML, so a target directory pulled by an earlier version can still be pushed before you convert it.
- Control characters,
--restrict-to-pathtakes only the item it names (PR #102):-r "Channels/G/ADT"no longer also takesADT Inbound, and a group or library path no longer takes another group or library whose name starts the same way. A path that names no item keeps the prefix match, so a partial name still selects every item that starts with it.- A warning when
--restrict-to-pathmatches nothing (PR #103): a push or pull whose-rmatched no item finished without saying so. It now logs a warning. The exit code does not change.
- Faster orphan detection on pull (PR #97, thanks @dave-InTheCloud): after a pull, the orphan check walked the rest of the server response once for every item, so its run time grew with the square of the channel count. It now runs in linear time. On a server with about 300 channels, a pull dropped from about 9 minutes to about 20 seconds.
- The old check also expected files that did not exist, which hid some stale
.jsfiles. Pulls may now report orphaned script files that they missed before, and--delete-orphanedwill delete them. Add--interactiveto confirm each deletion.
- The old check also expected files that did not exist, which hid some stale
--deploy-allfailures fail the command: a failed bulk deployment was logged but still exited 0, and--auto-commitstill committed. It now exits 1 and skips the automatic Git commit, as--deploy-changeddoes.- Java 11 is required: mirthSync has needed Java 11 or newer since 3.5.1, the first stable release with Git integration, because the bundled JGit 6.8 is built for Java 11. The README, the npm package README and the npm launcher's install hint said Java 8 and now say Java 11. Nothing changes at run time.
- Removed
mirthsync.actions/capture-expected-paths(PR #98): this unused function is gone. It only matters if you call mirthSync as a library from the Clojars jar.
- Stable ordering for unordered collections (issue #66, thanks @daniel-ls-howard): a pull now sorts the collections that Mirth stores in no fixed order, so pulling unchanged code no longer shows them reordered in version control. This covers code template context types, library enabled/disabled channel IDs, channel dependency and tag IDs, connector plugin properties, alert channels and error event types, the configuration map, global scripts, and the set-backed parts of a backup-mode server configuration, including its alert list, whose order depends on the order the alerts were created in. Lists whose order matters, such as destination connectors and transformer steps, are left untouched, and no values are changed. Pushes are unaffected because the server stores these as unordered sets and maps.
- Expect a one-time commit that only reorders these elements the first time you pull over your existing files with
-fafter upgrading. Without-f, a pull does not overwrite existing files. - Use
--no-sort-unorderedto keep the server's order.
- Expect a one-time commit that only reorders these elements the first time you pull over your existing files with
- Smaller release archives: the
.tar.gzand.zipno longer bundle a leftover npm jar from a previous release, which roughly doubled their size.
- Registry metadata (PR #91, thanks @morgan-saga): the Clojars project
:urland the npmhomepagenow point at the mirthSync product page, https://saga-it.com/products/mirthsync, instead of a redirecting blog URL and the GitHub repo. No code changes.
- Selective deployment (PR #78, thanks @gibson9583): new
--deploy-changedflag deploys only channels that Mirth reports as changed after a push (non-zerodeployedRevisionDelta, orcodeTemplatesChangedwhen this push saved code templates). Pair it with--deploy-newto also deploy pushed channels that are not currently deployed. Errors while checking or deploying return a nonzero exit code and skip the automatic Git commit.- Mirth only tracks template changes for FUNCTION and COMPILED_CODE templates; drag-and-drop templates never trigger a deployment.
- Deploy flags have no effect with
--disk-mode backup, because a configuration restore leaves every channel undeployed.
--versionflag: New-V/--versionflag prints the installed mirthsync version and exits (no server/credentials required).- Windows
--restrict-to-pathwith spaces and forward slashes (issues #82, #83): the npm launcher no longer word-splits arguments through a shell, and restrict paths supplied with forward slashes are normalized to the platform separator — so scoping a pull/push to a single channel or group (e.g.-r "Channels/Default Group/Sample Channel") now works on Windows. Pulling a single channel with-r Channels/<group>/<channel>writes the channel file as expected. - Launcher quoting:
mirthsync.sh/mirthsync.batquote the jar path and arguments so install paths or arguments containing spaces are handled correctly. - Windows
--delete-orphanedfix: orphan detection no longer captures unmanaged files (e.g..git) under the target root on Windows, preventing accidental deletion.
- Reduced Log Noise: Filtering messages (for
--restrict-to-pathand--skip-disabled) now log at DEBUG level instead of INFO, making normal operations quieter. Use-vflag to see filtering details. - Token-based Authentication: New
--tokenflag for authentication using existing HTTP session tokens- Alternative to username/password authentication
- Useful for automation and CI/CD pipelines with pre-authenticated sessions
- Mutually exclusive with username/password flags
- Simplified Git Operations: Git commands no longer require server or authentication flags
- Run git operations directly on target directory without Mirth server credentials
- Streamlined workflow for version control operations
- Bulk Channel Deployment: New
--deploy-allflag for efficient bulk deployment of multiple channels- Deploys all channels in a single operation instead of one-by-one
- Significantly faster when pushing multiple channels
- Allows Mirth's dependency logic to control deployment order
- Enhanced Orphaned File Detection: Always detects orphaned files during pull operations with clear user warnings
- Improved User Experience: Better code organization and elimination of duplicate orphan detection logic
- Safe Deletion Options: Optional automatic deletion of orphaned files with interactive confirmation mode
- Better Documentation: Comprehensive user guides and development best practices
- Code Quality: Refactored orphan detection logic for better maintainability
⚠️ SNAPSHOT Release: This version contains new features that are still being tested. Use with caution in production environments.
-
NOTE that this version respects the --include-configuration-map (false by default) parameter during both a "push" and a "pull". Previous versions would always "pull" the configuration map even if the parameter was not set or was false. If you want to include the configuration map now during a "pull" please ensure that you set the flag.
-
New "--skip-disabled" flag to indicate whether the item (only channels currently) being pushed or pulled should be included based on its status. The flag defaults to 'false' and all items are pushed or pulled no matter what the 'enabled' setting is. NOTE - this feature only works on mirth versions >= 3.9.
-
New "--disk-mode" setting that alters behavior around how granular the resulting files are in the target directory.
- Mode "backup" pushes and pulls a full backup XML file and doesn't produce any other disk artifacts.
- Mode "groups" pushes and pulls code at the next most granular level which means that channel groups and code template library XML actually contains the assocated channels and javascript
- Mode "items" extracts code templates and channels from the respective library or group XML.
- Mode "code" extracts even further pulling all code from XML files into individual language specific files.
- Support for getting the password from the MIRTHSYNC_PASSWORD environment variable if --password is not specified
- Prompt for password on console if no password is set, the console is available and the interactive "-I" flag is set
- Fix bug preventing local modifications from being pushed even with --force flag specified
- New feature to enable optional deployment of channel(s) during a push
- Major feature - javascript in channels, code templates, and global scripts is now extracted into its own file
- Breaking change - place top level channels beneath a 'Default Group' directory
- restrict-to-path now filters pulls (previously only pushes were filtered)
- code refactoring to use multimethods instead of passing around functions
- code clarity work
- more tests
- support for Mirth Connect 3.12
- Support for pushing/pulling Alerts
- Fix bug related to directory/xml ordering and zip/remove
- Selective push
- Testing against mirth 3.11
"2.1.x" versions of mirthSync support selectively pushing/pulling arbitrary paths in the target directory to Mirth. This allows, for instance, the ability to push/pull only the ConfigurationMap or a single channel or channel group by specifying a base path within the target directory to use as a starting point for find the files to push/pull.
NOTE 2.1.x versions include new features that break compatibility in minor ways from the 2.0.x versions.
- There are new command line options and new defaults for the ConfigurationMap. You must now add a flag to your command line to allow for pushing the ConfigurationMap - without the flag, it will not get included in the push.
- Resources are now properly included in a push.
- Alerts are supported
If you're trying out 2.1.x after using 2.0.x, be careful to test thoroughly in a dev environment first.
Small change that shouldn't impact the current directory layout. This change allows for forward and backward slashes in channel group names by encoding the slashes using an HTTP URL encode syntax.
Support for syncing Resources and a more comprehensive test suite for validating functionality across multiple versions of Mirth.
Bi-directional groups support.
You can check out the 2.0.3-SNAPSHOT release here - https://github.com/SagaHealthcareIT/mirthsync/releases/tag/2.0.3-SNAPSHOT
Changed the local directory structure to nest channels within their respective group.
- Support Mirth > version 3.12 and latest Open Integration Engine versions
- Enhanced Open Integration Engine CI/CD tooling and testing
- Advanced interface engine channel deployment best practices and strategies
- Enhanced filtering capabilities for selective channel deployments
- Additional CI/CD pipeline examples (Jenkins, GitLab CI, Azure DevOps)
- Addressing reported issues
- Implement more tests
- Performance optimizations for large healthcare integration configurations
MirthSync installation is straightforward - this DevOps tool for Mirth Connect can be installed and configured for your version control and CI/CD workflows:
$ git clone https://github.com/SagaHealthcareIT/mirthsync.git
For detailed installation guides and integration with your specific CI/CD platform, see the documentation below.
Requires Java JRE or JDK version 11 or higher (Java 11, 17, 21, and other LTS versions are supported)
To be able to run the script on MacOS, you need to install the following tools:
- coreutils
- gnu-sed
like this:
- brew install coreutils
- brew install gnu-sed
Put this line in your shell config file (.zshrc or .bashrc) to use commands from coreutils as standard MacOS commands
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
How to generate help dialogue:
$ java -jar mirthsync.jar -h
Usage: mirthsync [options] action
Options:
-s, --server SERVER_URL Full HTTP(s) url of the Mirth Connect server
-u, --username USERNAME Username used for authentication
-p, --password PASSWORD <computed> Password used for authentication
--token TOKEN Authentication token (HTTP session token) for Mirth API.
Mutually exclusive with username and password.
-i, --ignore-cert-warnings Ignore certificate warnings
-v Verbosity level
May be specified multiple times to increase level.
-f, --force
Overwrite existing local files during a pull and overwrite remote items
without regard for revisions during a push.
-t, --target TARGET_DIR Base directory used for pushing or pulling files
-m, --disk-mode DISK_MODE code Use this flag to specify the target directory
disk format.
- backup : Equivalent to Mirth Administrator backup and restore.
- groups : All items expanded to "Group" or "Library" level.
- items : Expand items one level deeper than 'groups' to the individual XML level.
In other words - Channels and Code Templates are in their own individual
XML files.
- code : Default behavior. Expands everything to the most granular level
(Javascript, Sql, etc).
-r, --restrict-to-path RESTRICT_TO_PATH
A path within the target directory to limit the scope of the push. This
path may refer to a filename specifically or a directory. If the path
refers to a file - only that file will be pushed. If the path refers to
a directory - the push will be limited to resources contained within
that directory. A channel may be named without its extension. If the
path names no file or directory exactly, it is used as a prefix and
takes every path that starts with it. The RESTRICT_TO_PATH must be
specified relative to the target directory.
--include-configuration-map A boolean flag to include the
configuration map in a push or pull. Default: false
--skip-disabled A boolean flag that indicates whether
disabled channels should be pushed or pulled. Default: false
-d, --deploy Deploy channels on push
During a push, deploy each included channel immediately
after saving the channel to Mirth.
--deploy-all Deploy all channels in bulk after push
During a push, collect all channel IDs and deploy them
in a single bulk operation after all channels are saved.
Allows Mirth's dependency logic to control deployment order.
More efficient than individual deployment for multiple channels.
--deploy-changed Deploy only changed channels after push
After all channels are saved, query the server for channel statuses
and deploy only those with a non-zero deployedRevisionDelta or
where codeTemplatesChanged is true and this push saved code templates.
--deploy-new Deploy channels that are not currently deployed
Use with --deploy-changed. During push, tracks which channels were
saved. After push, any saved channel not found in the dashboard
statuses (i.e. not currently deployed) will also be deployed.
-I, --interactive
Allow for console prompts for user input
--commit-message MESSAGE mirthsync commit Commit message for git operations
--git-author NAME <computed> Git author name for commits
--git-email EMAIL Git author email for commits
--auto-commit Automatically commit changes after pull/push operations
--git-init Initialize git repository in target directory if not present
--delete-orphaned Delete orphaned local files during pull operations.
When pulling from remote, compare local files with remote files and
delete any local files that no longer exist on the remote server.
Use with --interactive to confirm deletions before they occur.
--[no-]sort-unordered Sort unordered collections during a pull.
Mirth stores some collections (code template context types,
library and alert channel IDs, the configuration map, etc.) in
no fixed order, which creates noisy diffs between pulls. These
are sorted by default; use --no-sort-unordered to write them
in the order the server returns them.
-V, --version Print version and exit
-h, --help
Actions:
push Push filesystem code to server
pull Pull server code to filesystem
git Git operations (init, status, add, commit, diff, log, branch, checkout, remote, pull, push, reset)
git diff [--staged|--cached] [<revision-spec>]
Examples: git diff, git diff --staged, git diff HEAD~1..HEAD, git diff main..feature-branch
git reset [--soft|--mixed|--hard] [<commit>]
Examples: git reset, git reset --soft HEAD~1, git reset --hard origin/main
Environment variables:
MIRTHSYNC_PASSWORD Alternative to --password command line option
NOTE - The "-p" or "--password" option may be omitted from the the commands below if the environment variable MIRTHSYNC_PASSWORD is set. When interactive input is allowed (-I) and no password can be found, you will be prompted to enter the password at the terminal.
mirthSync supports two authentication methods:
Username and Password Authentication (traditional):
How to pull Mirth Connect code from a Mirth Connect instance:
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin pull -t ./mirth-configToken-based Authentication:
Use an existing HTTP session token (JSESSIONID) for authentication, useful in automation scenarios:
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api --token "your-session-token-here" pull -t ./mirth-configNote about authentication:
- Username/password and token authentication are mutually exclusive - use one or the other
- Token authentication is useful for CI/CD pipelines where you already have an authenticated session
- Git operations do not require any authentication flags (see Git Integration section below)
Note that the -t parameter accepts absolute and relative paths. Always use a dedicated directory for mirthsync operations, never use your home directory or other system directories.
Pulling code from a Mirth Connect instance allowing for overwriting existing files:
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin -f pull -t ./mirth-configPull with orphaned file detection and cleanup:
# Pull and show warnings about orphaned files (default behavior)
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin pull -t ./mirth-config
# Pull and automatically delete orphaned files
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --delete-orphaned pull -t ./mirth-config
# Pull with interactive confirmation before deleting orphaned files
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --delete-orphaned --interactive pull -t ./mirth-configPushing code to a Mirth Connect instance (doesn't have to be the same instance that the code was originally pulled from):
$ java -jar mirthsync-<version>-standalone.jar -s https://otherserver.localhost/api -u admin -p admin push -t ./mirth-configPushing a channel group and its channels to a Mirth Connect instance:
$ java -jar mirthsync-<version>-standalone.jar -s https://otherserver.localhost/api -u admin -p admin push -t ./mirth-config -r "Channels/This is a group"mirthSync supports both individual and bulk channel deployment during push operations:
Individual channel deployment:
# Deploy each channel immediately after it's saved (slower for multiple channels)
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --deploy push -t ./mirth-configBulk channel deployment (recommended for multiple channels):
# Collect all channel IDs during push, then deploy them all in one operation (faster)
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --deploy-all push -t ./mirth-configDeploy specific channels in bulk:
# Push and bulk deploy only channels in a specific group
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --deploy-all push -t ./mirth-config -r "Channels/Production Group"Selective deployment (deploy only changed channels):
# Deploy only channels that have pending changes (non-zero revision delta or code template changes)
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --deploy-changed push -t ./mirth-config
# Deploy changed channels AND any newly pushed channels that aren't currently deployed
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --deploy-changed --deploy-new push -t ./mirth-configTemplate-only changes trigger deployment only when this push successfully saves code templates, template libraries, or a backup with a template section. Errors while checking or deploying changed channels return a nonzero exit code and skip automatic Git commits.
With --deploy, a channel that is saved but fails to deploy counts as a
failed push: the remaining channels are still pushed and deployed, and the
command returns a nonzero exit code.
Performance comparison:
--deploy: Each channel is deployed immediately after being saved (N API calls for N channels)--deploy-all: All channels are collected during push, then deployed in a single bulk operation (1 API call for all channels)
Benefits of bulk deployment:
- Performance: Significantly faster when pushing multiple channels
- Dependency Management: Allows Mirth's dependency logic to control deployment order
- Recommended: The preferred approach for production deployments with multiple channels
mirthSync includes comprehensive orphaned file detection and management capabilities to help keep your local filesystem synchronized with your Mirth Connect server.
What are orphaned files? Orphaned files are local files that no longer exist on the remote Mirth Connect server. This can happen when:
- Channels, code templates, or other resources are deleted from the server
- Items are moved or renamed on the server
- Server configurations are reset or restored from backup
Automatic Detection:
mirthSync automatically detects orphaned files during every pull operation, regardless of whether you use the --delete-orphaned flag. When orphaned files are found, you'll see clear warnings like:
WARNING: Found 3 orphaned local files that no longer exist on the remote server:
- Channels/Default Group/Old Channel.xml
- Code Templates/Unused Template.js
- Global Scripts/Deprecated Script.js
To automatically delete these files, use the --delete-orphaned flag.
To see this warning again, run the same command without --delete-orphaned.
Safe Deletion Options:
# Show warnings but don't delete (default behavior)
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin pull -t ./mirth-config
# Automatically delete orphaned files without confirmation
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --delete-orphaned pull -t ./mirth-config
# Interactive mode - confirm each deletion
$ java -jar mirthsync-<version>-standalone.jar -s https://localhost:8443/api -u admin -p admin --delete-orphaned --interactive pull -t ./mirth-configBest Practices:
- Always review the orphaned file warnings before using
--delete-orphaned - Use
--interactivemode in production environments for safety - Consider backing up your target directory before running with
--delete-orphaned - Orphaned file detection works with all disk modes (backup, groups, items, code)
- Important: Always use a dedicated directory for mirthsync operations (e.g.,
./mirth-config,/opt/mirthsync/config) - never use your home directory or other system directories
mirthsync includes comprehensive built-in git integration for version control of your Mirth Connect configurations.
Key Benefits:
- No Server Credentials Required: Git operations work directly with your local target directory - no need to specify
-s,-u,-p, or--tokenflags - Simplified Workflow: Perform version control operations without connecting to your Mirth server
- Complete Git Functionality: Full support for init, status, add, commit, diff, log, branch, checkout, remote operations, and more
Initialize a git repository:
$ java -jar mirthsync.jar -t ./mirth-config git initCheck repository status:
$ java -jar mirthsync.jar -t ./mirth-config git statusStage all changes:
$ java -jar mirthsync.jar -t ./mirth-config git addCommit changes:
$ java -jar mirthsync.jar -t ./mirth-config --commit-message "Updated channel configurations" git commitCommit with custom author information:
$ java -jar mirthsync.jar -t ./mirth-config --commit-message "Updated configurations" --git-author "John Doe" --git-email "john@example.com" git commitView differences:
# Show unstaged changes (working directory vs index)
$ java -jar mirthsync.jar -t ./mirth-config git diff
# Show staged changes (index vs HEAD)
$ java -jar mirthsync.jar -t ./mirth-config git diff --staged
$ java -jar mirthsync.jar -t ./mirth-config git diff --cached
# Show changes between commits/branches
$ java -jar mirthsync.jar -t ./mirth-config git diff HEAD~1..HEAD
$ java -jar mirthsync.jar -t ./mirth-config git diff main..feature-branchView commit history:
$ java -jar mirthsync.jar -t ./mirth-config git log
$ java -jar mirthsync.jar -t ./mirth-config git log 5 # Show last 5 commitsList branches:
$ java -jar mirthsync.jar -t ./mirth-config git branchSwitch branches:
$ java -jar mirthsync.jar -t ./mirth-config git checkout developList remotes:
$ java -jar mirthsync.jar -t ./mirth-config git remotePull from remote:
$ java -jar mirthsync.jar -t ./mirth-config git pullPush to remote:
$ java -jar mirthsync.jar -t ./mirth-config git pushReset changes:
# Reset staged changes (mixed mode - default)
$ java -jar mirthsync.jar -t ./mirth-config git reset
# Soft reset - move HEAD but keep changes staged
$ java -jar mirthsync.jar -t ./mirth-config git reset --soft HEAD~1
# Hard reset - discard all changes and reset to specific commit
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard HEAD~1
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard origin/mainmirthsync provides comprehensive diff capabilities to help you understand changes at different stages of your git workflow:
Show unstaged changes (working directory vs index):
# Default behavior - shows files you've modified but not yet staged
$ java -jar mirthsync.jar -t ./mirth-config git diffShow staged changes (index vs HEAD):
# Shows changes that are staged and ready to commit
$ java -jar mirthsync.jar -t ./mirth-config git diff --staged
$ java -jar mirthsync.jar -t ./mirth-config git diff --cached # Same as --stagedShow changes between commits/branches:
# Compare two commits
$ java -jar mirthsync.jar -t ./mirth-config git diff HEAD~1..HEAD
# Compare current branch with another branch
$ java -jar mirthsync.jar -t ./mirth-config git diff main..feature-branch
# Compare any two commits (using commit hashes)
$ java -jar mirthsync.jar -t ./mirth-config git diff abc123..def456
# Show what changed from 3 commits ago to 1 commit ago
$ java -jar mirthsync.jar -t ./mirth-config git diff HEAD~3..HEAD~1This enhanced diff functionality helps you:
- Review what you've changed before staging
- Verify staged changes before committing
- Compare different versions of your configuration
- Understand changes between development branches
- Track configuration evolution over time
mirthsync provides comprehensive git reset capabilities to help you undo changes and move between different states in your git history:
Reset staged changes (mixed mode - default):
# Unstage all staged changes, keeping working directory unchanged
$ java -jar mirthsync.jar -t ./mirth-config git resetSoft reset (move HEAD only):
# Move HEAD to previous commit, keep index and working directory unchanged
$ java -jar mirthsync.jar -t ./mirth-config git reset --soft HEAD~1
# Undo last commit but keep changes staged for recommit
$ java -jar mirthsync.jar -t ./mirth-config git reset --soft HEAD~1Hard reset (reset everything):
# Reset HEAD, index, and working directory to match the commit
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard
# Reset to a specific commit, discarding all changes
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard HEAD~2
# Reset to remote branch state
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard origin/mainReset to specific commits:
# Reset to a specific commit hash
$ java -jar mirthsync.jar -t ./mirth-config git reset --mixed abc1234
# Reset to a tag
$ java -jar mirthsync.jar -t ./mirth-config git reset --hard v1.0.0This git reset functionality helps you:
- Unstage files that were accidentally added to the index
- Undo commits while preserving your work (soft reset)
- Completely revert to a previous state (hard reset)
- Clean up commit history before pushing to remote
- Recover from mistakes in your local development
Complete workflow - pull from server, commit changes, and push to remote:
# Pull latest from Mirth server (requires authentication)
$ java -jar mirthsync.jar -s https://localhost:8443/api -u admin -p admin -t ./mirth-config pull
# Check what changed (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config git status
# View unstaged differences (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config git diff
# Stage changes for commit (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config git add
# Review staged changes before commit (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config git diff --staged
# Commit the changes (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config --commit-message "Updated from production server" git commit
# Push to remote repository (no authentication needed)
$ java -jar mirthsync.jar -t ./mirth-config git pushComplete workflow using token authentication:
# Pull latest from Mirth server using token authentication
$ java -jar mirthsync.jar -s https://localhost:8443/api --token "your-session-token" -t ./mirth-config pull
# All git operations remain the same - no credentials needed
$ java -jar mirthsync.jar -t ./mirth-config git status
$ java -jar mirthsync.jar -t ./mirth-config git add
$ java -jar mirthsync.jar -t ./mirth-config --commit-message "Updated from production server" git commit
$ java -jar mirthsync.jar -t ./mirth-config git pushBranch-based development workflow:
# Create and switch to development branch
$ java -jar mirthsync.jar -t ./mirth-config git checkout -b feature/new-channel
# Make changes and commit
$ java -jar mirthsync.jar -t ./mirth-config --commit-message "Added new channel configuration" git commit
# Switch back to main branch
$ java -jar mirthsync.jar -t ./mirth-config git checkout main
# Merge feature branch (requires actual git command for merge)
$ cd ./mirth-config && git merge feature/new-channelmirthSync is designed for Mirth Connect CI/CD pipelines and automated deployments. The tool enables continuous integration and continuous deployment workflows for healthcare integration engines.
Key CI/CD Capabilities:
- Automated channel promotion between dev, test, and prod environments
- Multi-environment deployment strategies for interface engines
- Integration with Jenkins, GitLab CI, GitHub Actions, and other CI/CD platforms
- Support for automated testing and validation of channel configurations
- Infrastructure as code and GitOps workflows for HL7, FHIR, and DICOM integrations
CI/CD Example Projects:
- See our mirthsync-ci repository for a complete GitHub Actions CI/CD pipeline example
- Jenkins integration examples for automated Mirth Connect channel deployments
- GitLab CI pipeline configurations for multi-environment healthcare integration deployments
mirthsync can automatically commit changes after pull or push operations, perfect for CI/CD automation:
Automatically commit changes after pulling from server:
$ java -jar mirthsync.jar -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit pullInitialize git repository and auto-commit in one command:
$ java -jar mirthsync.jar -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --git-init --auto-commit --commit-message "Initial pull from production" pullAuto-commit with custom message and author (ideal for CI/CD systems):
$ java -jar mirthsync.jar -s https://localhost:8443/api -u admin -p admin -t ./mirth-config --auto-commit --commit-message "Sync from dev server" --git-author "CI System" --git-email "ci@company.com" pullThere is a sample script (git-cron-sample.sh) packaged that can be customized and utilized from a cron job and/or the command line. The script can take an optional commit message in cases where it is desirable to immediately pull and commit changes to git with meaningful commit messages.
Sample crontab...
# At 02:24 on every day-of-week from Sunday through Saturday
24 2 * * 0-6 /opt/mirthsync/git-cron-sample.sh >/dev/null 2>&1Pull/Push from a REPL.
The following pulls code to a dedicated mirthsync directory (relative to the execution environment), overwriting existing files ("-f") and ignoring the validity of the server certificate ("-i"), and then pushes back to the local server from the same directory.
(mirthsync.core/main-func "-s" "https://localhost:8443/api" "-u" "admin" "-p" "admin" "-t" "./mirth-config" "-f" "-i" "pull")
(mirthsync.core/main-func "-s" "https://localhost:8443/api" "-u" "admin" "-p" "admin" "-t" "./mirth-config" "-f" "-i" "push")Requires Leiningen
$ lein uberjar
- Gracefully handle renames and deletions
mirthSync is built and maintained by Saga IT, LLC, a healthcare integration consultancy. If you need help beyond the tool:
- Mirth Connect consulting & development: channel development, AWS/Azure HA clustering, and commercial-license migration
- Open Integration Engine (OIE) services
- Getting started with mirthSync: step-by-step CLI walkthrough
- MirthSync for VS Code: the companion GUI extension
Copyright © 2017-2022 Saga IT LLC
Distributed under the Eclipse Public License either version 1.0 or any later version.
This tool is still under development. Use at your own discretion.