Intro — MAGE on a local macOS server

We spent a few hours testing and getting MAGE up and running. Here are some notes on what it takes to get a local server up and running with macOS & iOS.

Our lead use case is field surveys for back country areas such as trails & wilderness areas.

mage-server

The MAGE team has iOS and Android apps in the public app stores, but you first need to stand up a mage-server. We were quite successful following the notes for macOS with brew in the readme.

This serves off our local macOS at http://localhost:4242 or http://10.1.2.3:4242. Since we are runnning in a local network, we can get away with http.

There is also a Docker container built sofwerx/docker-mage-server. If you put the MAGE server out in the public, then you will need to ensure your httpS certificates are in order. We have used https://letsencrypt.org for our certificates.

Custom Settings

  • <mage>/environment/local/env.js — We wanted the media files to be quickly accessible in our macOS Finder window. We also wanted to test what the tokenExpiration values did.
    • You can easily see the PNG & MP4 media files that went along with our observation trials. They are also extracted via the Export feature in mage-server.
environment.userBaseDirectory = '/Users/roblabs/mage/users';
environment.iconBaseDirectory = '/Users/roblabs/mage/icons';
environment.attachmentBaseDirectory = '/Users/roblabs/mage/attachments';

environment.tokenExpiration = 60 * 60 * 24 * 10; // 10 days


  • <mage>/config.js — When we initially provisioned our first user, there was no clue to what the password requirements were…. Until we read the source code…. Set accordingly.
"authenticationStrategies": {
  "local": {
    "passwordMinLength": 14
  }

iOS

Our mage-server is running local on macOS and without httpS. This meant we could not use the MAGE iOS app in the Apple Appstore. Until we get this sorted out, thankfully MAGE for iOS is open source and we make any tweaks we wanted.

  • Since we are running on a local macOS, we can save our field surveyors a step, by including the URL to our mage-server in the iOS app.


<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <false/>
  <key>NSExceptionDomains</key>
  <dict>
    <key>10.0.1.25</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>