Set up environment.
-
npm install -g meteorite
&mrt install
-
Set up two Firebase apps from https://www.firebase.com/account/
-
one for storing company configuration like locations and beacon installtions.
-
one for storing beacon events.
-
Configure initial beacon installation
Two ways: -
Configure
server/configuration.json
in https://github.com/clionelabs/looppulse.web.configurator -
In
looppulse.web.configurator
, runmeteor --settings server/configuration.json
Alternatively,
-
mkdir private/
-
cp looppulse.web.configurator/private/megabox.json private/local.json
-
Start the dashboard
-
Configure
server/settings.json
inhttps://github.com/clionelabs/looppulse.web.manage
to point to the two Firebase apps created in Step 1. -
In
looppulse.web.manage
, runmeteor --settings server/settings.json
-
Configure beacon events
-
Configure
server/simulation.json
in https://github.com/clionelabs/looppulse.web.simulator. Please ensure to match the beacon described inlooppulse.web.configurator/server/configuration.json
-
In
looppulse.web.simulatr
, runmeteor --settings server/simulation.json
Follow the Meteor Style Guide whenever possible.
Here are some few points for reference,
-
Launch AWS EC2 instance, e.g. ami-12356d40
-
Associate it to Elastic IP.
-
Open port 22 for the machine do deployment.
-
Install Meteor Up command line tool
npm install -g mup
. -
Configuration deployment settings
mup.json
by referring tomup.json.sample
. -
Download and put SSH key in
pem
, e.g.~/.ssh/id_rsa
-
Ensure key file permission,
chmod 600 ~/.ssh/id_rsa
-
Update
host
as Elastic IP -
Prepare Meteor settings
settings.json
, -
Symlink the settings by
ln -s server/settings.json settings.json
or copy settings.json to repository root -
Update the settings if necessary for the deployment
-
Run deploy command.
-
Run
mup setup
to setup the server -
Reboot server
-
Run
mup deploy
to deploy code to server
-
View Log
-
ssh -i keys/jenkins.pem [email protected]
-
sudo less /var/log/upstart/looppulse_manage.log
-
sudo tail -f /var/log/upstart/looppulse_manage.log
-
Access Mongo console
-
ssh -i keys/jenkins.pem [email protected]
-
mongo looppulse_manage
-
SSH tunnel for Jenkins
-
ssh -v -i keys/dev.pem -L 8080:localhost:8080 [email protected]
-
Dropping database
-
In mongo shell/console,
db.dropDatabase()
-
Cloning production database into local
-
ssh -v -i keys/dev.pem -L 27018:localhost:27017 [email protected]
-
In mongo shell/console,
db.copyDatabase('looppulse_manage', 'meteor', 'localhost:27018')
-
Force restart
-
sudo service looppulse_manage restart
or simply trigger build in jenkins -
Source code
-
/opt/looppulse_manage
on beta.looppulse.com
- Create test account
- Access the users database in mongo. (There should be an account with eamil [email protected].)
- Enter
[email protected]
in the forget password link - Check console log and get the password reset link in password recovery email.
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.
-
Install jsdoc:
npm install -g jsdoc
-
Generate documentation:
jsdoc -c jsdoc.json
-
Open
.out/index.html
in browser