Skip to content

Instantly share code, notes, and snippets.

@bstancil
Last active January 13, 2016 19:58
Show Gist options
  • Save bstancil/650c08f715a00ae175aa to your computer and use it in GitHub Desktop.
Save bstancil/650c08f715a00ae175aa to your computer and use it in GitHub Desktop.

Using Bridge with Multiple-Orgs

Currently Bridge can only act on behalf of a single Organization at a time, however it is possible to run multiple instances of Bridge on a server. To do so, we'll have to make some modifications to the system configuration.

Assumptions:

  • Linux/Ubuntu 14.04
  • Organization #1: RobotOrg
  • Organization #2: HumanOrg

Step 1 - Select RobotOrg in Mode and follow the normal Add-Data flow for a Data Source on a private network.

Step 2 - Next we'll want to make some changes to the system:

  A. sudo stop mode-bridge
  B. sudo mv /opt/mode/bridge/conf/bridge.json /opt/mode/bridge/config/bridge-robot-org.json
  C. sudo mv /etc/init/mode-bridge.conf /etc/init/mode-bridge-robot-org.conf
  D. Edit /etc/init/mode-bridge-robot-org.conf to reflect these changes:
     - from: description "mode-bridge"
         to: description "mode-bridge-robot-org"
                                     ^^^^^^^^^^
     - from: exec line from: exec /opt/mode/bridge/bin/mode-bridge -config /opt/mode/bridge/conf/bridge.json >> /opt/mode/bridge/log/bridge.log 2>&1
         to: exec line from: exec /opt/mode/bridge/bin/mode-bridge -config /opt/mode/bridge/conf/bridge-robot-org.json >> /opt/mode/bridge/log/bridge-robot-org.log 2>&1                                                                                                    ^^^^^^^^^^^^^^^                               ^^^^^^^^^^^^^^                
   E. sudo start mode-bridge-robot-org
   F. The first bridge is now running.

Step 3: - Select HumanOrg in Mode and run just the last command. That's the one with -init.

Step 4: Next we'll want to make some changes to the system similar to in Step 2:

  A. sudo stop mode-bridge
  B. sudo mv /opt/mode/bridge/conf/bridge.json /opt/mode/bridge/config/bridge-human-org.json
  C. sudo mv /etc/init/mode-bridge.conf /etc/init/mode-bridge-human-org.conf
  D. Edit /etc/init/mode-bridge-human-org.conf to reflect these changes:
     - from: description "mode-bridge"
         to: description "mode-bridge-human-org"
                                     ^^^^^^^^^^
     - from: exec line from: exec /opt/mode/bridge/bin/mode-bridge -config /opt/mode/bridge/conf/bridge.json >> /opt/mode/bridge/log/bridge.log 2>&1
         to: exec line from: exec /opt/mode/bridge/bin/mode-bridge -config /opt/mode/bridge/conf/bridge-human-org.json >> /opt/mode/bridge/log/bridge-human-org.log 2>&1                                                                                                   ^^^^^^^^^^^^^^^                               ^^^^^^^^^^^^^^
   E. sudo start mode-bridge-robot-org
   F. The second bridge is now running.

Repeat as needed for additional Orgs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment