Pusher is a hosted service that enables us to easily push real-time data to our application (using WebSockets). It is needed to get the most out of the "KPI & Alerting" Impac!™ feature, which send sends real-time Alerts to the front-end notifying Users when their KPI's (key performance indicators) have been reached.
For the JavaScript client (Impac!™ Angular) to receive notifications from our server (Impac!™) via the Pusher servers, a "Client Key" must be provided, and it must match the "Client Key" configured. For Impac!™ to send notifications to the client via Pusher, Impac!™ must be configured with an "Api Key", "Api Secret" & "Client Key.
This document will guide you through setting up a Pusher account, and configuring the Maestrano products to enable the use of Pusher.
Table of Contents | ||
---|---|---|
|
1 - Creating a Pusher Account & Generating API Keys
- First go to https://dashboard.pusher.com/accounts/sign_up and sign up
- Once you create an account, this should be the first screen you see. Fill in the fields (5 & 6 not important).
- We recommend the "create apps for multiple environments" option
- Select the "Your Apps" menu icon on the left sidebar, and select the correct application / application environment
- Then on the app top-bar menu, select "App Keys"
- Now you should see all the app keys required
2 - Configuring Impac! API with the Pusher API Keys
Impac!™ API stores the Pusher API Keys as environment variables. Below are the recommended options to configure these variables.
2.1 - Option 1 (Nex!):
- If you are using Nex!™, simply save the following env vars to your UAT and PROD containers for Impac!™ and Connec!™:
Code Block |
---|
nex-cli apps:vars impac-app-name --add PUSHER_APP_ID=app-id-key,PUSHER_KEY=key,PUSHER_SECRET=secret |
2.2 - Option 2 (Ansible):
- To add an ENV variable to Impac!, you need to add it here: https://github.com/maestrano/mno-deploy/blob/develop/ansible/roles/impac/templates/application.yml
- As these are secret keys, it will need to be added to the encrypted using Ansible Vault (https://github.com/maestrano/mno-deploy/blob/develop/ansible/vars/example_secrets.yml)
- If you are deploying the Maestrano Suite using the Ansible scripts, you will need to update the config files to set environment variables for Impac!™ (for example):
Code Block language ruby # config/application.yml PUSHER_APP_ID: your-pusher-id PUSHER_KEY: your-pusher-key PUSHER_SECRET: your-pusher-secret
3 - Configuring the front-end with the Pusher Client Key
The Your Maestrano Enterprise Rails application 's back-end can configured with the pusher client key in it's environment variablesas an environment variable, which then gets provided to the front-end (Impac!™ Angular) during Angular's configuration phasesphase. Otherwise, Impac!™ Angular can be configured directly by following Option 2 below.
3.1 - Option 1 (Nex!):
- Add the
- Pusher Client Key as an environment variable of your app through Nex!™.
Code Block |
---|
nex-cli apps:var app-name --add impac_pusher_key=the-pusher-client-key |
3.2 - Option 2 (manual front-end configuration):
- Add the pusher client key to your Express project's front-end Impac! configuration file (frontend/src/app/impac.config.coffee).
Code Block |
---|
angular.module('mnoEnterpriseAngular').run((ImpacLinking)-> ImpacLinking.linkData({ pusher_key: 'pusher-client-key' }) ) |