Maintainer Manual - Software Engineering I

advertisement
Maintainer’s Manual
Mobile-Controlled Lighting
Team 13
Saumil Kasbekar
Sayali Sakhalkar
Anuradha Saini
Priyank Mishra
Sagar Sarda
Ashutosh Kale
Corey Stall
Feasibility Analyst
Software Architect
Life Cycle Planner
Project Manager
Requirements Engineer
Prototyper
Requirements Engineer/Shaper
1. Installation Instructions
●
Install putty and winscp
For installing winscp please refer here:
http://winscp.net/eng/docs/installation
For installing putty please refer here:
http://rcc.its.psu.edu/user_guides/remote_connectivity/putty/
1
Mobile-Controlled Lighting
04/30/2014
Before doing there steps please log into putty and winscp using the server credentials
●
Install Node.js
1. Download the package lists from the repositories and "updates" them to get information
on the newest versions of packages and their dependencies
sudo apt-get update
2. Install nodejs
sudo apt-get install nodejs
3. Install node package manager (npm)
sudo apt-get install npm
●
Install and run Mongo DB
1. Download the package lists from the repositories and "updates" them to get information
on the newest versions of packages and their dependencies
sudo apt-get update
2. Install mongodb latest stable version
sudo apt-get install –y mongodb-org

Install redis client
npm install redis
2
Mobile-Controlled Lighting
2. Deploy Instructions
1. Copy and paste the server code in the home directory of the server. The root level of the
directory looks like this
In order to keep the server running forever we need to install the forever library
To install nodejs forever library: sudo npm install forever

Install all the dependent packages and modules
Go to the root of the directory. Root directory is where package.json file exists.
Run npm install.

Run the server
forever start app.js

Stop the server
forever stop 0
3
Mobile-Controlled Lighting
3. Ports
All the ports for various different applications are maintained in the server code
The server runs on port 3000
The MQTT server runs on port 4000
Mongo DB runs on local host and port is 27017
The ports for the applications are specified in the following files
Database local host URL:
config/database.js
Application Port: 3000
Specified in app.js in the home directory
MQTT server Port: 4000
Specified in mqtt/mqttserver_aes.js
All the ports are specified in the source code.
4. Database Scripts
To connect to the database run the following command in putty
mongo localhost:27017/brave-backend
To clean up the database run the following scripts after connecting to the database
1. Delete the entire contents of the database
db.gateways.remove({})
db.users.remove({})
db.accesstokens.remove({})
db.refreshtokens.remove({})
db.gates.remove({})
db.groups.remove({})
2. Remove a particular user from the database
db.users.remove({email:"xxxxxxxxx"})
Specify the email of the user you want to remove
4
Mobile-Controlled Lighting
3. Remove a particular gateway from the database
db.gateways.remove({serialNumber:”xxxxxxxxx”})
*This will permanently remove the data from the database.
4. View contents of the database
Data stored in the database can be viewed through putty. After you connect to the database
using mongo localhost:27017/brave-backend command, you can view the data stored in
different files using the following commands




For users : db.users.find()
For gateways: db.users.find()
For accesstokens: db.accesstokens.find()
For groups: db.groups.find()
5. To see data of a particular user : db.users.find({email:”xxxxxxxxx”})
6. To see data of a particular gateway : db.gateways.find({serialNumber:”xxxxxxxxxxx”})
7.
5. Backup Server
Backing up the server code can be done through WinSCP. In order to back up the server
codes please follow the following steps




Log into the WinSCP with the server credentials
From the root level select all the files and right click
Choose download and select the directory you want to download
Click ok and all the server code will be saved to the directory you choose
*WinSCP gives the option to “download and delete” & “download”. Choose download.
6. Future Development







MQTT and updation of “all switch status” in the server through MQTT.
AES authentication between the gateway and the server during the gateway
configuration.
If multiple devices are logged in the same gateway with the same user id and if one
device logs out, right now all the devices get logged out. This needs to be fixed in
future.
Add switch to a particular room/floor.
Add User management feature to the app.
Add authentication in the android app with AES or MD5.
Replace input gateway id screen with the new Drop down list for add gateway. The dropdown list for add gateway is wonderfully done. Change it to input the gateway id. I think
in the future, the drop-down list should only show the gateway IDs that are connected in
5
Mobile-Controlled Lighting

the same network (SSID) as the mobile device instead of the server, but I don’t know if this
is possible to do.
If I have 2 switches, one has image, one doesn’t. If I deleted the switch with image, that
image will automatically assign to the one without image.
6
Mobile-Controlled Lighting
Download