User Tools

Site Tools


oak:tutorials:localserver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
oak:tutorials:localserver [2016/10/25 18:35]
digistump
oak:tutorials:localserver [2016/12/08 21:38]
pfeerick mis-numbered steps
Line 21: Line 21:
 ==== Windows ==== ==== Windows ====
  
-  * Download pre-built windows zip file here:+  * Download pre-built windows zip file here: http://​digistump.com/​spark-server.zip
   * Unzip the download and open a command line window in that folder and then run the following command:   * Unzip the download and open a command line window in that folder and then run the following command:
 <​code>​node main.js</​code>​ <​code>​node main.js</​code>​
-  * If this doesn'​t work try the OSX/Linux procedure above, installing git from here: https://​git-scm.com/​downloads or any where else - git version doesn'​t matter too much. You will also need to install C++ compiling tools - see windows instructions on this page for more: https://​github.com/​nodejs/​node-gyp+  * If this doesn'​t work try the OSX/Linux procedure above, installing git from here: https://​git-scm.com/​downloads or any where else - git version doesn'​t matter too much. You will also need to install C++ compiling tools - see windows instructions on this page for more: https://​github.com/​nodejs/​node-gyp ​(for OpenSSL - in our experience - you'll want this version: http://​code.x2go.org/​releases/​binary-win32/​3rd-party/​Win32OpenSSL/​Win32OpenSSL-1_0_1j.exe)
  
 The Particle local server should now be running! The Particle local server should now be running!
Line 30: Line 30:
 ===== Installing the Particle CLI Tool ===== ===== Installing the Particle CLI Tool =====
  
-  * With node installed in the last step you can install the Particle CLI tool with this command: +  * With node installed in the last step you can install the Particle CLI tool with this command: ​<​code>​npm install -g particle-cli</​code>​ 
-<​code>​npm install -g particle-cli</​code>​+ 
 +  * If you are on the Raspberry Pi, you will need to use the following command so that the serialport dependency is successfully compiled as there are no pre-compiled binaries for the Raspberry Pi/ARM platform: ​<​code>​sudo npm install -g particle-cli ​--unsafe-perm --build-from-source</​code>​ 
  
 ===== Setting up an Oak to use the Local Server ===== ===== Setting up an Oak to use the Local Server =====
Line 49: Line 51:
 Run (from the same folder as the server): Run (from the same folder as the server):
 <​code>​ <​code>​
-openssl rsa -in  default_key.pem -pubin -pubout -outform DER -out default_key.der+openssl rsa -in  default_key.pub.pem -pubin -pubout -outform DER -out default_key.pub.der
 </​code>​ </​code>​
 and then use a base64 encoder (locally for best safety) or here for convenience:​ http://​bin-hex-converter.online-domain-tools.com/​ and then use a base64 encoder (locally for best safety) or here for convenience:​ http://​bin-hex-converter.online-domain-tools.com/​
  
-Upload the default_key.der and get the encoded output, save this somewhere, you will need it in the next step.+Upload the default_key.pub.der and get the hex encoded output, save this somewhere, you will need it in the next step.
  
 ==== 2. Set the Server Address and Server Public Key for the Oak ==== ==== 2. Set the Server Address and Server Public Key for the Oak ====
Line 70: Line 72:
  
  
-==== 3. Set the Particle CLI tool to allow it to talk to the local server ====+==== 3. Copy the device Public Key to the Server ​ ==== 
 + 
 +In the server folder create a core_keys folder if it does not exist. 
 + 
 +While still connected to the Oak that is in config mode go to http://​192.168.0.1/​device-id - you should get a response like this: 
 + 
 +<​code>​ 
 +{ "​id":"​ABCDEFGHJK","​c":"​1"​ } 
 +</​code>​ 
 + 
 +Where "​ABCDEFGHJK"​ is the device ID for this device - copy this without the quotes, you will need it to complete the rest of this step. 
 + 
 +Now go to http://​192.168.0.1/​public-key - you should get a response like this: 
 +<​code>​ 
 +{ "​r":​ 0, "​b":"​AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ"​ } 
 +</​code>​ 
 + 
 +Where "​AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ"​ is a string of numbers and letters that make up the hex encoded public key for the device. Copy this string without the quotes into a text editor and save as DEVICE_ID.pub.der - where DEVICE_ID is the device id you got above. 
 + 
 +Upload it here (or use another hex decoder): http://​bin-hex-converter.online-domain-tools.com/​ and hit decode, then click download as binary file. Rename that download to DEVICE_ID.pub.pem and place in the core_keys directory you created above. 
 + 
 + 
 +==== 4. Set the Particle CLI tool to allow it to talk to the local server ====
  
 Source: https://​docs.particle.io/​support/​troubleshooting/​cloud-solutions/​photon/​ Source: https://​docs.particle.io/​support/​troubleshooting/​cloud-solutions/​photon/​
Line 85: Line 109:
 This adds the local server ip to the cli tool, switches to using it, and creates an account on the local cloud. This adds the local server ip to the cli tool, switches to using it, and creates an account on the local cloud.
  
-==== 4. Restart Oak so it connects ====+==== 5. Restart Oak so it connects ==== 
 + 
 +Stop and restart the server.
  
 Repeat steps #2 and #3 for other Oaks you want on the same cloud. Repeat steps #2 and #3 for other Oaks you want on the same cloud.
oak/tutorials/localserver.txt · Last modified: 2017/03/05 01:48 by malaire