snapfu – A Mirth Connect Autobackup System

In this blog post, I’ll partially demonstrate how the Snapfu app works. Since I’m reviewing my NodeJS and ReactJS skills, I chose a problem to solve using the app. Snapfu is an automated way to create backups of your Mirth configuration and channels. It uses the exportcfg and export commands in the Mirth CLI and the Mirth Connect Client API. This means it’s intended to be used on the same server or on a close network. It’s not currently supposed to be accessible publicly via the internet. Ideally, you should set up and use this to create a minimum daily backup.

There are two repositories that I created:

  • snapfu-web-api – This is the API service of snapfu app, all the CRUD operations in the app’s MongoDB are processed here. This is also responsible for running the cron jobs.
  • snapfu-web-portal – This is the portal of the snapfu app, here you manage the connections (Mirth Connects) and the auto backups (snaps).

How To Use:

After you clone and able to run api and the portal. You can open the app in the browser http://localhost:3000

You can hit “Sign Up” to create an account. Note: You’ll need to link your Google Account to use the GMAIL API that’s responsible to send the verification link via email.

You’ll then receive the email verification:

Once clicked:

You should be able to login now. First thing you’ll see is the Dashboard page. The “W” tab is basically just the “Welcome” page with the description of what snapfu is and the other tabs:

First thing to setup is a “Connection”, this is where the details of your running “Mirth Connect” be added. Under the “Connection” tab, hit the “Add” button and fill out the details.

Notes:

  • The password would need to be encoded to Basic authentication type.
  • Host and port should be pointed to the HTTPS, which is usually 8443 on default Mirth.

Once you hit “Save”, you’ll see it on your tab.

Click the 3rd icon (just after the delete/trash button) of your connection and it will then pull the channels related to that Mirth Connect. It will also allow you to create a snap here (an autobackup instance).

Here is an example entry for this:

Once you hit save, you should see that snap created listed under the Snap tab. You can also see the status of it on the right end, in this case it is currently “stopped”.

Hit the 2nd icon (after the delete button) and it will show you details of the snap and will allow you to start from here.

To enable or start the autobackup process, hit the play button at the far right, it’ll then change the status to “active”.

In the Snap tab, it shows “Starting” if it hasn’t successfully created a backup yet.

Once successful on the first run, it’ll show “Running”.

On the backup folder you set on your Snap, it’ll create two folders:

  • backup – where the backup XML files are created
  • cron – where the cron file with the commands are created and read whenever the autobackup runs.

You can check a quick demo or in action of snapfu here: snapfu video demo.

That’s it! Note that this does not backup the Mirth Connect database. I’ll most likely make enhancements on this, but feel free to give any feedback.

If you want to support this project, you can:

Buy Me A Coffee

Leave a comment

Design a site like this with WordPress.com
Get started