fog-controller
Version:
Fog Controller project @ iotracks.com
191 lines (113 loc) • 5.44 kB
Markdown
**Fog Controller Setup**
1. Install fog-controller
npm install -g --unsafe-perm fog-controller
2. Create user
fog-controller user -add <email> <firstName> <lastName> <password>
3. Start fog-controller
fog-controller start
4. Open your browser and hit following endpoints to setup IOFog, provision key and fog access token.
- Create Fog
   [http://localhost:3000/api/v2/instance/create/type/:type?t=:userAccessToken](http://localhost:3000/api/v2/instance/create/type/:type?t=:userAccessToken)
   where ':type' is FogType which can be 1 for Standard Linux (x86) OR 2 for ARM Linux
   and ':userAccessToken' is obtained by creating user
- Fog provisioning
   [http://localhost:3000/api/v2/authoring/fabric/provisioningkey/instanceid/:instanceId](http://localhost:3000/api/v2/authoring/fabric/provisionkey/instanceid/:instanceId)
   where ':instanceId' is obtained by creating fog.
   The provision key generated by this endpoint will be used by ioFog for provisioning.
- Create fog access token
   [http://localhost:3000/api/v2/instance/provision/key/:provisionKey/fabrictype/:fabricType](http://localhost:3000/api/v2/instance/provision/key/:provisionKey/fabrictype/:fabricType)
   where ':provisionKey' is obtained by provisioning fog
   and ':fabricType' is a FogType
**Usage**
1. To view help menu
fog-controller help
2. To view current status
fog-controller status
3. To view version and license
fog-controller version
**Logs**
- Log files are located at './node_modules/fog-controller-logs/'
- Log files are rotated on daily basis
- If number of log files exceeds 90, oldest log file will be swapped with the newest file
**System Requirements (Recommended)**
- Processor: 64 bit Dual Core or better
- RAM: 2 GB
- Hard Disk: 10 GB
**Platforms Supported**
- Ubuntu
- macOS Sierra
- Windows
**Configuration Management**
1. To list configurations
fog-controller config -list
2. To add a configuration
fog-controller config -add <key> <value>
Note: Configuration keys can be one of following
- port
- ssl\_key
- intermediate\_cert
- ssl\_cert
- email\_address
- email\_password
- email\_service
- ioauthoring\_port
- ioauthoring\_ip\_address
- ioauthoring\_protocol
To setup ioauthoring configurations, do following steps:
fog-controller config -add ioauthoring_port 4000
fog-controller config -add ioauthoring_ip_address 127.0.0.1
fog-controller config -add ioauthoring_protocol http
To setup HTTPS for fog controller, do following steps:
fog-controller config -add port 4443
fog-controller config -add ssl_key 'path_to_your_sertificates/key.pem'
fog-controller config -add intermediate_cert 'path_to_your_sertificates/gs_intermediate_ca.crt'
fog-controller config -add ssl_cert 'path_to_your_sertificates/certificate.pem'
fog-controller config -add ioauthoring_port 5443
fog-controller config -add ioauthoring_ip_address 127.0.0.1
fog-controller config -add ioauthoring_protocol https
Do not forget to update ioAuthoring configs and add certificates under /etc/iofog/ on the machine where fog agent is running!
To setup email sender, do following steps:
fog-controller config -add email_address abc@xyz.com
fog-controller config -add email_password abc123
fog-controller config -add email_service xyz
3. To remove a configuration
fog-controller config -remove <key>
**User Managment**
1. To list users
fog-controller user -list
2. To add a user
fog-controller user -add <email> <firstName> <lastName> <password>
3. To remove a user
fog-controller user -remove <email>
4. To reset password
fog-controller user -generateToken <email>
**ComSat Managment**
1. To list all ComSat(s)
fog-controller comsat -list
2. To add a ComSat
fog-controller comsat -add <name> <domain> <publicIP>
3. To remove a ComSat
fog-controller comsat -remove <ID>
**Execute Fog-Controller on startup**
 For Windows, do following steps:
   - Open a new text document
   - Insert following line in it:
fog-controller start
   - Save text document with extension as ‘.bat’
   - Put the .bat file in
“C:\Users\username\AppData\Roaming\Microsoft\Windows\StartMenu\Programs\Startup\”
(replacing ‘username’ with the name of your user).
 For Ubuntu, do following steps:
   - Create a file as ‘fog-controller.conf’ in /etc/init/ directory with following command:
sudo gedit /etc/init/fog-controller.conf
   - Save following text in the file:
# fog-controller.conf
description "Fog Controller project @ iotracks.com"
start on startup
stop on shutdown
post-start script
mkdir -p /usr/local/lib/node_modules/fog-controller
cd /usr/local/lib/node_modules/fog-controller
sudo fog-controller start
end script
respawn