This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
|
oak:tutorials:localserver [2016/10/20 19:32] digistump |
oak:tutorials:localserver [2016/12/08 21:38] pfeerick mis-numbered steps |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| ===== Installing the Particle Local Server ===== | ===== Installing the Particle Local Server ===== | ||
| - | * Install Node.JS 4.x or older (anything from v0.10 to 4.x should work) for your platform: https://nodejs.org/en/download/ | + | * Install Node.JS 4.x or older (anything from v0.10 to 4.x should work) for your platform: https://nodejs.org/en/download/ (4.6.1 32bit recommended for windows - https://nodejs.org/download/release/v4.6.1/node-v4.6.1-x86.msi) |
| ==== OSX/Linux ==== | ==== OSX/Linux ==== | ||
| 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 ===== | ||
| - | * Windows Only: Install OpenSSL if you don't have it - http://gnuwin32.sourceforge.net/packages/openssl.htm | + | * With node installed in the last step you can install the Particle CLI tool with this command: <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> | ||
| Line 45: | Line 45: | ||
| ==== 1. Convert the server's public key to the DER format and then Base64 Encode it ==== | ==== 1. Convert the server's public key to the DER format and then Base64 Encode it ==== | ||
| + | |||
| + | |||
| + | * Windows Only: Install OpenSSL if you don't have it - http://gnuwin32.sourceforge.net/packages/openssl.htm | ||
| + | |||
| 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 68: | 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 83: | 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. | ||