Mirth Connect - Source Control, CI/CD, deployment #4689
Replies: 8 comments 10 replies
-
This came up in reference to the last discussion: https://www.saga-it.com/tech-talk/2019/03/15/mirthsync+installation+and+basic+usage Seems to use an older version of java, but maybe it could be wrapped in a docker container for re-use? I was also thinking that a script that uses the mirth api's and publish YAML/JSON to them, could be stored in git repository. |
Beta Was this translation helpful? Give feedback.
-
I've been working on a fork of @kayyagari's git-ext to add a remote repository capability and a GUI component to control it. On channel deploy the plugin would also try to push to a specified remote repository. My vision and need is the following: Here is the initial effort of the script I'm using to deploy the channel to production. #!/bin/bash
# Try to log in
USERNAME=username
PASSWORD=password
TARGET_URL=https://your-ip-here:8443
COOKIE_FILENAME="cookies.txt"
eat_the_cookies() {
echo "Eating cookies.."
if [ -f "$COOKIE_FILENAME" ]; then
rm -f "$COOKIE_FILENAME"
if [ -f "$COOKIE_FILENAME" ]; then
echo "Cookies still there..."
else
echo "All cookies eaten!"
fi
else
echo "No cookies to eat! >:("
fi
}
CONNECT_TIMEOUT=10
LOGIN_RESPONSE=$(
curl\
--connect-timeout $CONNECT_TIMEOUT\
-ks\
--cookie-jar "$COOKIE_FILENAME"\
-X POST "$TARGET_URL/api/users/_login"\
-H "accept: application/xml"\
-H "Content-Type: application/x-www-form-urlencoded"\
-d "username=$USERNAME&password=$PASSWORD")
if [ -z "$LOGIN_RESPONSE" ]; then
echo "Login request timed out"
echo "exiting..."
eat_the_cookies
exit 1
fi
LOGIN_SUCCESS=$(xmllint --xpath "string(//status)" - <<< "$LOGIN_RESPONSE")
# Make sure login works
if [ "$LOGIN_SUCCESS" != "SUCCESS" ]; then
echo "Login unsuccessful!"
eat_the_cookies
echo "exiting..."
exit 1
fi
# Get changed files
MODIFIED_FILES=$(git diff staging origin/live --name-only)
for channel_id in $MODIFIED_FILES
do
if [ ! -f "$channel_id" ]; then
continue
fi
channel_data=$(<$channel_id)
# Update channel code
PUT_RESPONSE=$(
curl\
-ks\
--connect-timeout $CONNECT_TIMEOUT\
--cookie "$COOKIE_FILENAME"\
-X PUT "$TARGET_URL/api/channels/$channel_id?override=true"\
-H "accept: text/plain"\
-H "Content-Type: application/xml"\
-d "$channel_data")
if [ "$PUT_RESPONSE" != "true" ]; then
echo "Updating channel failed for $channel_id"
continue
fi
# Deploy channel
DEPLOY_RESPONSE=$(
curl\
-ks\
--cookie "$COOKIE_FILENAME"\
--connect-timeout $CONNECT_TIMEOUT\
-X POST "$TARGET_URL/api/channels/$channel_id/_deploy?returnErrors=true&debug=false"\
-H "accept: application/xml")
done
eat_the_cookies |
Beta Was this translation helpful? Give feedback.
-
I got a project approval today to add some sort of version control to our Mirth Connect Servers. Being a long time web app developer Git was the first tool of choice with maybe some fancy import/export scripts on change. This should be an interesting project to tackle but very much worth the time to save headaches later when someone thinks they are on test and make changes on production that lose the original configuration if the channels are not backed up anywhere. Here are some tutorials I found on the matter: |
Beta Was this translation helpful? Give feedback.
-
I put together this document a while back for discussion about testing approaches: https://docs.google.com/document/d/1L2ErvbzSgR58g7hE8Betxy0gEgg7bo0avleOu66FmYM/edit |
Beta Was this translation helpful? Give feedback.
-
https://www.saga-it.com/tech-talk covers the MirthSync tool which recently shipped a new release https://github.com/SagaHealthcareIT/mirthsync/releases/tag/2.1.0 |
Beta Was this translation helpful? Give feedback.
-
Very interested in this topic. We currently use Mirth with around 1000 channels. In house, we have developed python scripts/library to push and pull code from a repository utilizing Mirth’s APIs. It requires some manipulation of the XML (ignoring revision number, sort channelids in certain sections, etc …) but we get a pretty reliable diff. In addition we are exploring automated testing/CI. For templates/functions, I have taken the approach of direction 3 from the above mentioned google doc. Submit a function name, parameters and the expected result. I have a working mockup but needs more development For channels/CI, we are looking to utilize python’s unittest. It would submit a message depending on the source connector (copy a file to a directory, send a message to TCP/IP port ..) and then lookup the result using the Mirth’s API and check for the appropriate response/transformation. Would love to hear what has worked well, what hasn’t, and also maybe a way we all could move forward to help the Mirth community as a whole. While we have a platinum license, this (source control/ automated testing/ CI) is a major gap in its offering for enterprise customers. |
Beta Was this translation helpful? Give feedback.
-
Probably an offline topic, we do lots of practice management systems (20 or so) for hundreds of clients. That means a handful of channels for each EHR type regardless of number of clients. You probably need a fundamental architecture change. Not being critical here, track me down on LinkedIn if you want to chat about it. LOL that does not change the importance of this topic on GH of course. |
Beta Was this translation helpful? Give feedback.
-
This is a summary of how we have been building out CI (but not CD) It's not final, but it's just how far we've gotten. Deployment Structure
Dev Workflow:
Goals
Challenges
In closing, it kind of works, and all the pieces are there to make it work, but it does feel like you are going against the grain of the tool. |
Beta Was this translation helpful? Give feedback.
-
This has been a popular topic in Slack. It also came up on the MC dev call in August.
Slack only keeps about a month of history so we're losing a lot of chatter on the issue.
I am creating this discussion as a reference to capture the questions or ideas from Slack for how to integrate MC with:
My take - the tools and parts are all there but they haven't been stitched together in a way that works and makes sense. In my experience it's driven by human processes with some helping tools, but not fully automated yet.
Quick resources from Slack that I could find in Slack history:
Beta Was this translation helpful? Give feedback.
All reactions