Has anybody managed to get the local cloud setup with a Photon with any degree of reliability?


It appears that Particle abandoned updating its local cloud server about three years ago: https://github.com/particle-iot/spark-server

There is a fork that was last updated about a month ago here: https://github.com/Brewskey/spark-server

The code has been cleaned up and organized quite a bit, but it still doesn’t seem to work very well. Has anyone gotten this thing to work? What combination of OS, Node, and spark-server did you use?
I’m running on Raspberrian Jessie, the latest Brewskey spark-server, the latest particle-cli, and the latest spark firmware, origin/release/v0.8.0-rc.8 My symptoms are, no matter what combination of keys doctor, keys server, and setup I use, I never get past the rapid cyan flash.
I can connect to local wifi fine, and the keys I’ve generated show up the spark-servers database, but the Photon will not connect to the local cloud.


Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?


@Jawa We use the Brewskey server in production, around 500 devices deployed. It works great and it is very stable. It gives us full control over our fleet and I am glad I decided to go with own cloud. Sometimes the connection on customer’s side is not reliable and the error logs from cloud helps us to analyze the situation…

We use function calls, events publishing, subscribing, webhooks. All running smooth.


Can you share the details on the brewskey server? @dfarny


The repo is here

and @Brewskey is also a member here


What would you like to know?

Most of the setup instructions are in a readme in the github repo.


Sorry it has taken me so long to reply, I’ve been busy with other projects. I haven’t had a chance to set this up and run a test server yet, but my biggest question from the beginning, for a locally hosted cloud, is how do you direct traffic to your server instead of particles?


How to point your device to your local server is answered in the github repo readme file:

6. Put your core into listening mode, and run
particle identify
to get your core id. You willl need this id later

7. The next steps will generate a bunch of keys for your device. I recommend mkdir ..\temp and cd ..\temp

8. Change server keys to local cloud key + IP Address

particle keys server ..\spark-server\data\default_key.pub.pem --host IP_ADDRESS
Note You can go back to using the particle cloud by downloading the public key here. You will need to run particle config particle, particle keys server cloud_public.der, and particle keys doctor your_core_id while your device is in DFU mode.

9. Create and provision access on your local cloud with the keys doctor:
   particle keys doctor your_core_id

At this point you should be able to run normal cloud commands and flash binaries. You can add any webhooks you need, call functions, or get variable values.


I figured there was a simple explanation, I just hadn’t had the time to go through everything. Thanks @ninjatill


Yeah, if you follow the readme you should be able to get it up and running (at least on your local machine) in 10-20 minutes.

If you are putting this in production, I highly recommend that you use MongoDB instead of the in-memory DB that spark-server ships with.


This would be for production, where would I find the MongoDB?




I didn’t write documentation for it but you basically have to set up a mongo instance and then override the settings. It’s very straight-forward.


You guys are awesome, thank you.


So, I can’t get it to work on a fresh copy of raspbian.
I’ve followed the instructions listed here:

After I login, keys server, keys doctor, and setup, the best I can get is a fast flash cyan. The photon never is acknowledged as being on the local cloud.

Can you go from a completely virgin environment and get something working?

pi@higgs:~ $ uname -a
Linux higgs 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
pi@higgs:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION="9 (stretch)"

pi@higgs:~/spark-server $ npm --version
pi@higgs:~/spark-server $ node --version
pi@higgs:~/spark-server $

(opencv_env)[kujawa@nikola tmp]$ particle list
bob [26002b000247353137323334] (Product -1) is offline

[2019-02-02T20:07:56.372Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)
[2019-02-02T20:08:06.377Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)
[2019-02-02T20:08:16.381Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)
[2019-02-02T20:08:26.390Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)
[2019-02-02T20:08:36.403Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)
[2019-02-02T20:08:46.407Z] INFO: DeviceServer.js/9012 on higgs: Connected Devices (devices=0, sockets=0)

Steps I used to set up the server:

sudo apt-get install nodejs npm
sudo npm install -g npm@latest --unsafe-perms
sudo apt-get install dfu-util
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0
sudo apt-get install git
sudo npm install -g particle-cli --unsafe-perm

git clone https://github.com/Brewskey/spark-server.git
cd spark-server/
npm install oauth2-server
vi spark-server/.env


npm install --verbose
grep -i admin dist/settings.js
vi dist/settings.js

npm run start:prod

particle config higgs apiUrl ""
particle config higgs
particle cloud login

pi@higgs:~ $ particle identify

Your device id is 26002b000247353137323334
Your system firmware version is 0.5.3
pi@higgs:~ $ mkdir temp
pi@higgs:~ $ cd temp

  1. Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.

  2. Release only the RESET/RST button while continuing to hold the MODE/SETUP button.

  3. Release the MODE/SETUP button once the device begins to blink yellow.

pi@higgs:~/temp $ particle keys server …/spark-server/data/default_key.pub.pem
Creating DER format file
Okay! New keys in place, your device will not restart.
pi@higgs:~/temp $

pi@higgs:~/temp $ particle keys doctor 26002b000247353137323334
New Key Created!
attempting to add a new public key for device 26002b000247353137323334
submitting public key succeeded!
Okay! New keys in place, your device should restart.

pi@higgs:~/temp $ particle identify

Your device id is 26002b000247353137323334
Your system firmware version is 0.5.3
pi@higgs:~/temp $ particle setup


Argh. My mistake. Wrong port.

particle keys server …/spark-server/data/default_key.pub.pem --protocol tcp --host --port 5683

Everything is happy now. Thanks, everyone.

Closed bug here: