Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivarprudnikov/rpi-speedtest
Network speedtest for Raspberry Pi with Lambda API and simple data preview
https://github.com/ivarprudnikov/rpi-speedtest
apex-up aws-lambda nodejs raspberry-pi speedtest
Last synced: 14 days ago
JSON representation
Network speedtest for Raspberry Pi with Lambda API and simple data preview
- Host: GitHub
- URL: https://github.com/ivarprudnikov/rpi-speedtest
- Owner: ivarprudnikov
- License: gpl-3.0
- Created: 2019-10-11T12:31:52.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T00:42:50.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T14:49:30.951Z (9 months ago)
- Topics: apex-up, aws-lambda, nodejs, raspberry-pi, speedtest
- Language: JavaScript
- Homepage: https://speed-test.lila.io/
- Size: 449 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rpi-speedtest
[![Actions Status](https://github.com/ivarprudnikov/rpi-speedtest/workflows/Node%20CI/badge.svg)](https://github.com/ivarprudnikov/rpi-speedtest/actions)
Network speedtest script to be run on Raspberry Pi
## On Raspberry
### Installation
**Assumes you have API server deployed already.**
- Connect to network ([WiFi setup docs](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md))
- Install NodeJS for correct ARM version (`uname -m`)
- [Select node version binary hat supports ARM version](https://nodejs.org/en/download/)
- `$ git clone $url/rpi-speedtest.git`
- `$ cd rpi-speedtest`
- `$ npm i`
- Modify [config file](./config.json)*Verify it works*
```shell script
$ node bin/index.js
91.40834570638205
ok 200
```[*Setup CRON*](https://www.raspberrypi.org/documentation/linux/usage/cron.md)
- Open editor mode `crontab -e`
- Add something like `15 * * * * /usr/local/bin/node /home/pi/rpi-speedtest/bin/index.js` to run the script every 15th minute. Safest way is to puth full path to node installation.*Caveats*
- I was testing on _Raspbian_ which has cron logs disabled by default, make your call, for me it is not necessary.
- I did have `node` and `npm` preinstalled on _Raspbian_, make sure you have those installed and available in `PATH`.## API server
### Running locally
*AWS credentials*
Export AWS credentials for DynamoDB queries/inserts to work locally:
- Use profile:
```
$ export AWS_PROFILE=myprofilename
```
- or use key/secret
```
$ export AWS_ACCESS_KEY_ID=xxx
$ export AWS_SECRET_ACCESS_KEY=yyy
```
- or whatever else AWS tells you to use with its SDKs*API server*
To start locally `$ npm start`
### Testing
To test `$ npm test` which will run eslint and any tests present
### Deployment
- Modify [config file](./up.json)
- To deploy to production run `$ up production`Uses `up` to set up AWS Lambda, config lives in `up.json`. Refer to their docs for further usage info in docs [apex.sh/docs/up/](https://apex.sh/docs/up/) or in their repo [github.com/apex/up](https://github.com/apex/up)
## DynamoDB
Expecting simple table holding `deviceId` as a main partition key combined with a sort key `timestamp` and actual data sitting in `payload` column which expects Map structure.
```
Primary partition key
deviceId (String)
Primary sort key
timestamp (Number)
Read/write capacity mode
On-Demand
```