Blog

    Mirth Connect Docker Setup for Local Development: One Engine and a Sample Channel

    By GauravAugust 2, 20269 mins read
    On this page

    A Mirth Connect Docker setup for local development gives each engineer one engine on one machine for building and reading channels. It is one container, a volume for its data, and a sample channel you can start and stop. It is not a second production node, and it never shares a database with the hospital.

    Digital health founders and hospital CTOs planning interface work get the layout, the startup steps, the mistakes that break a local container, and the path from laptop to production.

    What is a Mirth Connect Docker setup for local development?

    A Mirth Connect Docker setup for local development is one Connect container, a volume for its configuration and database files, the administrator ports the image documents, and a sample channel that reads a file or a port you control. Agnotic Technologies uses that loop to edit a channel before anyone points it at a hospital feed.

    Need a local Mirth loop before a hospital feed?

    We set up one engine, a sample channel and a volume, and we keep that layout off the production pair.

    NextGen publishes a Docker image, nextgenhealthcare/connect, for running Connect. Its Docker Hub listing documents the tags, the ports and the volume the local engine expects.

    • One container: a single engine. Do not add a second container and call it high availability.
    • One volume: the path the image uses for application data, so a restart keeps the channel.
    • Ports: publish the administrator ports the image page lists, and only those, on localhost.
    • A sample channel: one source you can trigger, one destination you can read, no production address.

    Read the tag you pulled. A local loop that tracks 'latest' will change under you. Pin the tag in the compose file and write it next to the channel export.

    Where do config and the database live?

    Config and the local database live on the volume you mount, not in the container layer. Agnotic names that volume in the compose file and treats a deleted volume as a deleted engine.

    • Channel exports: also copy the channel XML out of the engine into the repository, so the volume is not the only copy.
    • Restart: stop the container, start it, and confirm the sample channel is still there.
    • Wipe: removing the volume is how you get a clean engine. Do that on purpose, and say so in the commit.
    • Secrets: administrator passwords and any keystore stay in local configuration, not in the image tag.

    A production engine keeps its database where the failover design says it lives, shared by the nodes that are allowed to use it. The laptop volume is a different database. Do not point a local container at the hospital database to 'save a step'.

    What belongs in the sample channel?

    The sample channel has a source you can fire without a partner, a transformer that sets one field you can see, and a destination that writes a file or a port on the same machine. Agnotic checks that loop before importing a channel from a site.

    • Source: a file reader or a channel reader, with one sample message in the repository.
    • Transformer: one assignment you can search for in the output, so you know this container ran your code.
    • Destination: a file writer on the volume, or a port that a local listener owns.
    • Name: the channel name says local, so nobody deploys it by matching the production name.

    When the sample message appears in the destination with that marker field, the loop is up. Message volume, thread counts and clustering settings are tuned on the production engine, not in this container.

    How is this different from production failover?

    Production failover is two engines and one shared database, with one sender address that either node can answer. The local loop is one engine and a private volume. Agnotic does not reuse the compose file from the laptop as the production unit.

    • Count: one container locally. Two nodes only in the failover design.
    • Database: a volume on the developer machine locally. A shared database in production, reached by both nodes.
    • Address: localhost locally. A sender address that a live node answers in production.
    • Change: edit and export locally. Promote the channel XML through the test you already run, not by copying the volume.

    If the local engine stops, only that developer stops. If you pointed it at a shared production database, a local experiment can lock or edit the channels the hospital is running. That is the failure this split is meant to prevent.

    Which folder must survive a container restart?

    The appdata folder must survive a restart, because it carries the engine's configuration, its keystore and its server id. Mount it on a named volume so removing the container does not remove the engine's identity.

    The Connect Docker README says the appdata folder holds configuration files and temporary data, usually including the keystore and the server.id file, and suggests mounting a volume at /opt/connect/appdata to preserve it. Its quick start runs an embedded Derby database and publishes port 8443 for the Administrator GUI.

    Docker documents that a volume's contents exist outside the lifecycle of a given container, so the data persists even if the container using it is removed.

    A container that starts without that volume comes up as a new engine with a new server id and a fresh keystore. The Administrator will connect, the channels you built yesterday will be missing, and the certificate warning will look new. That is the symptom of a lost appdata mount.

    How do you bring the loop up, step by step?

    Bring the loop up from a compose file that pins the image tag, binds the administrator port to localhost and mounts the appdata volume. Then import the sample channel and fire one message.

    • Step 1, compose: write the service with the pinned tag and a named volume for appdata.
    • Step 2, port: bind 8443 to 127.0.0.1 so the Administrator is not reachable from the office network.
    • Step 3, start: bring the service up and wait until the log says the server has started.
    • Step 4, sign in: open the Administrator, change the default credentials, and record where you stored them.
    • Step 5, import: load the sample channel XML from the repository and deploy it.
    • Step 6, fire: drop the sample message into the source folder and read the marker field in the output.

    Should the local engine use Derby or the production database type?

    Use the embedded Derby default when you are only editing transformers and filters, and match the production database type when the channel reads or writes a database or when you are testing an engine upgrade. The README documents a DATABASE variable for choosing the type.

    • Derby: nothing else to run, and a wipe is one volume delete.
    • Production type locally: a second container for the database, with its own volume, still private to the laptop.
    • Never: the hospital's database, even read only, even for one afternoon.

    Write the choice into the compose file comments. A teammate who pulls the repository should not have to guess why a database container is there.

    How do several developers work on one channel?

    Several developers work on one channel by each running a private engine and sharing the channel XML through source control. The repository is the shared copy. No engine is.

    • Branch: each change to the channel is a branch with the exported XML.
    • Review: a reviewer reads the XML diff, then imports it into their own engine and fires the sample.
    • Code templates and global scripts: export them alongside the channel, or the import will fail on a missing function.
    • Conflicts: two people editing one transformer is a merge, resolved in the XML, not by overwriting a volume.

    What are the common mistakes with a local Mirth Connect Docker setup?

    The common mistakes are a version mismatch, a lost volume, a busy port and a channel that depends on something the export left behind. Each has a quick check.

    • Version: a channel exported from a newer engine may not open in an older one. Compare the tag to the hospital's version first.
    • Volume: an empty channel list after a restart means appdata was not mounted where the image expects it.
    • Port: another service already holds 8443. Change the host side of the mapping, not the container side.
    • Dependencies: a missing code template or configuration map entry shows up as a script error on the first message.

    What should never enter the local loop?

    Patient data, production credentials and network routes to the hospital should never enter the local loop. The sample message is synthetic, the passwords are local, and the destinations point at the same machine.

    • Messages: no copied production message, even with names blanked out by hand.
    • Secrets: no production keystore, database password or partner certificate on the laptop.
    • Routes: no VPN profile that lets a local destination reach a hospital listener.

    If a developer needs to reproduce a production failure, rebuild the failing message shape with invented values. The structure is what matters for the bug.

    How do you move a channel from the laptop toward production?

    Move a channel by promoting the reviewed XML through the shared test engine and the channel tests, never by copying a laptop volume. The volume holds one developer's engine state, not a release.

    • Export: the reviewed channel, its code templates and any configuration map keys it reads.
    • Test engine: import there, run the channel tests, and keep the result with the change.
    • Production: deploy the same XML the test engine ran, with production settings supplied by that environment.

    How do you know the local engine matches the hospital's?

    The local engine matches the hospital's when the Connect version, the installed extensions and the code templates are the same. Check those three before trusting a local result.

    Write the hospital's version and extension list into the repository next to the compose file. When the hospital upgrades, change the pinned tag in the same commit and rerun every sample channel.

    What does a local Docker engine mean for your build plan?

    A local Docker engine moves channel editing off the shared test server, so the build plan needs a repository for channel exports, a pinned tag that matches the hospital, and a promotion step through the test engine. Plan those before the first channel is written.

    • Repository: one folder per channel with the XML, its code templates and its sample messages.
    • Version record: the hospital's Connect version and extensions, updated with every upgrade.
    • Promotion: the test engine and the channel tests that sit between a laptop and production.

    How does Agnotic set up the local loop?

    Agnotic writes the compose file, pins the image tag, mounts the volume, and leaves you a sample channel plus the export in source control. You keep the production nodes and the shared database on the failover design.

    Tell us the Connect version the hospital runs. We will pin the local image to a tag that can open that channel, and we will not invent a second node on the laptop.

    Set up the local engine

    One container, one volume, one sample channel. Production failover stays a separate design.

    Sources

    Frequently Asked Questions

    Integration engineers who build or change channels, and the founders or CTOs who want that work kept off the shared test and production engines. Anyone who edits a transformer benefits from a private engine.

    Talk to an engineer about your project

    Tell us the Connect version at the hospital. We will pin a local image and a sample channel, and leave the production pair alone.