Sense HAT messaging system for cnav-sense.
- Raspberry Pi 1 or Zero
- Sense HAT
$ git clone https://github.com/konradko/cnav-sense
$ cd cnav-sense
$ mkvirtualenv cnav-sense -a .
$ make
$ make test
-
Create a new Raspberry Pi 1 / Zero application (e.g.
cnavsense) on resin.io- Resin OS => 1.11.0 is required for Sense HAT, newer (but less stable) OS versions are available on resinstaging.io
- You can create an app on both and copy
config.jsonfile from resinstaging.io SD card to resin.io one - that way it will show up on resin.io
-
Add resin remote to the
cnav-senserepository, e.g.:$ git remote add resin username@git.resin.io:username/cnavsense.git -
Decrease GPU memory
| Fleet Configuration variable | Value |
|---|---|
| RESIN_HOST_CONFIG_gpu_mem | 16 |
- Use resin.io application device OS and flash it on an SD card (etcher.io recommended)
- Put the SD card in the Raspberry Pi and wait for it to update (check status on resin.io dashboard)
Application exception tracking and alerting
| Environment variable | Example value | Description |
|---|---|---|
| SENTRY_DSN | https://user:pass@app.getsentry.com/appnum | Sentry DSN address |
System and application logs
| Environment variable | Example value | Description |
|---|---|---|
| PAPERTRAIL_HOST | logs.papertrailapp.com | Papertrail host |
| PAPERTRAIL_PORT | 12345 | Papertrail host port |
| SENSE_LOG_PATH | /data/log/cnavsense | Sense app log path |
System metrics and alerting
| Environment variable | Example value | Description |
|---|---|---|
| SMTP_HOST | smtp.mailgun.org:1234 | SMTP host and port |
| SMTP_ACCOUNT | postmaster@mailgun.com | Email address to send from |
| SMTP_PASSWORD | password123 | Password for the email address |
| THRESHOLD_CPU | 70 | max % of CPU in use |
| THRESHOLD_FS | 40 | min % of filesystem available |
| THRESHOLD_MEM | 300 | min MB of mem available |
| LOCAL_STORAGE_RETENTION | 360h0m0s | Period of data retention |
The metrics dashboard will be available at http://your-device-ip/consoles/node.html (you can make it available on the internet by enabling Public URL in resin.io dashboard).
$ make deploy
-
In resin.io dashboard set
CLIENT_PUBKEYSenvironment variable to '\n' separated list of public keys, on OSX you can copy your public key with:$ cat ~/.ssh/id_rsa.pub | pbcopyEnvironment variable Example value Description CLIENT_PUBKEYS ssh-rsa pubkeyone\nssh-rsa pubkeytwo '\n' separated list of public keys that are allowed access -
SSH into a container using local address (you can get it from resin.io dashboard or using resin-cli), e.g.:
$ ssh root@192.168.1.15