Skip to content

clionelabs/looppulse.web.manage

Repository files navigation

looppulse.web.manage

Set up environment.

  1. npm install -g meteorite & mrt install

  2. Set up two Firebase apps from https://www.firebase.com/account/

  3. one for storing company configuration like locations and beacon installtions.

  4. one for storing beacon events.

  5. Configure initial beacon installation
    Two ways:

  6. Configure server/configuration.json in https://github.com/clionelabs/looppulse.web.configurator

  7. In looppulse.web.configurator, run meteor --settings server/configuration.json

Alternatively,

  1. mkdir private/

  2. cp looppulse.web.configurator/private/megabox.json private/local.json

  3. Start the dashboard

  4. Configure server/settings.json in https://github.com/clionelabs/looppulse.web.manage to point to the two Firebase apps created in Step 1.

  5. In looppulse.web.manage, run meteor --settings server/settings.json

  6. Configure beacon events

  7. Configure server/simulation.json in https://github.com/clionelabs/looppulse.web.simulator. Please ensure to match the beacon described in looppulse.web.configurator/server/configuration.json

  8. In looppulse.web.simulatr, run meteor --settings server/simulation.json

Coding Style

Follow the Meteor Style Guide whenever possible.

Here are some few points for reference,

  • Use camelCase for template name, Reference 1, 2

Deployment

  1. Launch AWS EC2 instance, e.g. ami-12356d40

  2. Associate it to Elastic IP.

  3. Open port 22 for the machine do deployment.

  4. Install Meteor Up command line tool npm install -g mup.

  5. Configuration deployment settings mup.json by referring to mup.json.sample.

  6. Download and put SSH key in pem, e.g. ~/.ssh/id_rsa

  7. Ensure key file permission, chmod 600 ~/.ssh/id_rsa

  8. Update host as Elastic IP

  9. Prepare Meteor settings settings.json,

  10. Symlink the settings by ln -s server/settings.json settings.json or copy settings.json to repository root

  11. Update the settings if necessary for the deployment

  12. Run deploy command.

  13. Run mup setup to setup the server

  14. Reboot server

  15. Run mup deploy to deploy code to server

Remote Debugging

  1. View Log

  2. ssh -i keys/jenkins.pem [email protected]

  3. sudo less /var/log/upstart/looppulse_manage.log

  4. sudo tail -f /var/log/upstart/looppulse_manage.log

  5. Access Mongo console

  6. ssh -i keys/jenkins.pem [email protected]

  7. mongo looppulse_manage

  8. SSH tunnel for Jenkins

  9. ssh -v -i keys/dev.pem -L 8080:localhost:8080 [email protected]

  10. open http://localhost:8080

  11. Dropping database

  12. In mongo shell/console, db.dropDatabase()

  13. Cloning production database into local

  14. ssh -v -i keys/dev.pem -L 27018:localhost:27017 [email protected]

  15. In mongo shell/console, db.copyDatabase('looppulse_manage', 'meteor', 'localhost:27018')

  16. Force restart

  17. sudo service looppulse_manage restart or simply trigger build in jenkins

  18. Source code

  19. /opt/looppulse_manage on beta.looppulse.com

Local Debugging

  1. Create test account
  2. Access the users database in mongo. (There should be an account with eamil [email protected].)
  3. Enter [email protected] in the forget password link
  4. Check console log and get the password reset link in password recovery email.

Firbase Security

Go to Manage App -> Security Rules in Firebase, set the rules as following,

{
    "rules": {
        ".read": false,
        ".write": false
    }
}

Copy Manage App -> Secrets to corresponding configuration files, here are list of files may need to be updated,

  • looppulse.web.configurator/private/megabox.json:system.firebase.rootSecret
  • looppulse.web.configurator/server/configuration.sample.json:firebase.rootSecret
  • looppulse.web.manage/server/settings.sample.json:firebase.configSecret
  • looppulse.web.simulator/server/settings.continuous.live.sample.json:firebase.configSecret
  • looppulse.web.simulator/server/settings.continuous.debug.sample.json:firebase.rootSecret
  • looppulse.web.simulator/server/settings.fixed.debug.sample.json:firebase.rootSecret

Firebase generated token will be expired in certain period of time, clients observing Firebase should re-authendicate themselves to retrive new valid token. Manage App -> Login & Auth could see Session Length for how long a token should be valid.

Documentation

  1. Install jsdoc: npm install -g jsdoc

  2. Generate documentation: jsdoc -c jsdoc.json

  3. Open .out/index.html in browser

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •