You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BEEP is open source combination of a bee monitoring app + automatic bee hive measurement device. It's key feature is to integrate a user friendly responsive web app for manual inspections with automatically measured sensor data.
Check the website https://beep.nl/index.php/home-english for more information.
The BEEP app is publicly available at: https://app.beep.nl. It has about 5000+ users worldwide and is available in 9 languages (Jan 2022).
BEEP API / Backend
This repository. Serving both app v3 as app v2. Publicly available at https://api.beep.nl
BEEP base
The BEEP base v3 is an open source ultra low power automatic hive monitoring system. Design of the device and PCB (with accompanying firmware) be found at [this repository]](https://github.com/beepnl/measurement-system-v3). It measures weight, temperature and sound. We produce a yearly batch of BEEP bases for the European (868MHz LoRaWAN) market, that are sold via the BEEP webshop. The BEEP base sends it's data through The Things Network LoRaWAN to the BEEP API.
You can also use your own measurement device with the BEEP app by POSTing your measurement data to the BEEP API.
The BEEP base can be configured by Bluetooth using our native BEEP base apps for Android and iOS.
BEEP API Installation
If you would like to install this BEEP API (the code in this) repo on your own server, or contribute; please read on below.
NB: To stick to a certain PHP version (on the server e.g. 7.4.33), use composer install --ignore-platform-reqs or composer update --ignore-platform-reqs
4. Set up your end-points
Laravel Forge
Simply use the default Nginx template and install Let's Encrypt SSL certificate via the interface.
Apache
Install the desired config files from /apache to your apache/sites-available folder and enable them with a2ensite [config file name]
Install SSL certificates to your endpoints with Let's Encrypt
CREATE DATABASE bee_data
> exit">influx > CREATE USER user_influx WITH PASSWORD 'pass_influx' WITH ALL PRIVILEGES > CREATE DATABASE bee_data > exit
NB: Make sure to pass the user and credentials to the .env file that has been created in step 3.NB: If your Influx version was < 1.1.x (no TSI support), when using backups to transfer data: first install the old version that you are currently using on a new server, import the backups, then update to the newest Influx version!
Configuring your own back-end system
1. Set up valid credentials
a. Set up e-mail credentials in the .env config file
b. (Angular JS webapp v2) For the webapp to reach the API, rename the file 'public/webapp/js/constants.js.example' to 'public/webapp/js/constants.js' and edit it to change the 'api_url' to your own back-end API end-point
c. To enable schedules (e.g. for loading weather data), install a crontab with sudo crontab -e and add: * * * * * cd /home/bitnami/apps/appdir && /opt/bitnami/php/bin/php artisan schedule:run >> /dev/null 2>&1
2. Register new user
a. Go to api.[your_domain]/webapp#!/login/create
b. Create a new user
c. Promote the user to 'superadmin'
Open your database (with a database viewer like PhpMyadmin, Sequel Pro, MySQL Workbench, etc.), or just do a command line query:
Define a relation in table role_user with (1,1) (linking user_id 1 to role_id 1).
Your user has just been promoted to the super administrator of the system, so you can use the back-end management interface to configure the complete system.
d. Go to api.[your_domain]/admin to log in with the same credentials that you created your app user with in step 3b.
e. You should see the back-end dashboard, looking like this:
Management interface
Installation using docker compose
A simple setup for small installations can be achived with docker-compose. The tool will spin up a webserver and initialize the beep mysql and influxdb database.
Fill in your mailtrap username & password in your .env file for MAIL_USERNAME and MAIL_PASSWORD (find it in your mailtrap account via Email Testing -> My inbox -> Integration)
If everything is running smoothly, create a login via the frontend webapp BEEP VUE (v3) app.
To connect the BEEP VUE app with the BEEP backend, make sure to specify the following .env variables in your local BEEP VUE app installation:
VUE_APP_API_URL = http://localhost:8087/api/
VUE_APP_BASE_API_URL = http://localhost:8087/
(Psssst there is a shortcut for creating a login: just use the old BEEP Angular JS (v2) app app directly, via http://localhost:8087/webapp#!/login/create
but beware to only use it to create your login, as the rest of the app is deprecated! (The v3 app replaced the v2 app in 2021))
With your newly created login, login to the backend. N.B. verification email from the previous step will be send to your mailtrap inbox
Give your newly created user the superadmin role, via phpmyadmin (server: mysql, user: root, password: secret):
Go to bee_data db, users table, check your user id. Then in the role_user table, edit the role_id for that user_id to '1 - superadmin' and save.
Now setup Influxdb for the measurements data. Create a login via the Influxdb onboarding UI (choose your username and password, organization: beep, database: bee_data). Then copy and store the API token.
Add your Influxdb credentials to your .env file for INFLUXDB_USER and INFLUXDB_PASSWORD and the influx-configs file at storage/influxdb2/config like so:
[yourusername]
url = "http://localhost:8086"
token = "your API token from step 15"
org = "beep"
active = true
Run docker-compose run --rm artisan config:clear to clear the config cache
Make your bee_data database writable inside the influxdb docker container
docker exec -t influxdb bash influx bucket list (-> copy bee_data bucket id (or obtain it via the UI at http://localhost:8086 instead)) influx v1 dbrp create --db bee_data --rp autogen --bucket-id [your bucket id] --default
Optional: test write to your influxdb via the docker container:
docker exec -t influxdb bash (skip if moving on from previous step directly) influx write --bucket bee_data --host http://localhost:8086 "m,host=host1 field1=1.2"
Check the data you posted via the Influxdb UI at http://localhost:8086
17. Test posting a measurement via your dockerized BEEP backend:
- Create a new device in the BEEP VUE app (see step 9) in the /devices page, copy the 'Device unique identifier', this is your 'key'. (Hive is not required, but also possible to first create an apiary and hive to attach to your device)
- Create at least 1 measurement type at http://localhost:8087/en/measurement, with 'Influx Database' as the Data Source type. For example Abbreviation 't_i', Physical Quantity Id: Temperature (C)
- Post a measurement via Postman or curl, see API documentation. For example:
POST http://localhost:8087/api/sensors?key=[your device key]&t_i=34.5 (where 't_i' is your newly created measurement abbreviation from above, the value can be anything).
- Response should be 'saved'. Datapoint should be visible in the Influxdb bee_data.
- In order to view your datapoint in the BEEP VUE app /data tab, first run docker-compose run --rm artisan cache:clear to clear the cache. Then hard refresh the app in order to load your newly created measurement type, otherwise the datapoint will not be visible in the frontend.
As the setup is based on docker containers, code changes inside the repository will not have an effect until the underlying docker image is updated.
Start/Stop the project
docker-compose stop `docker-compose start` OR `docker-compose up -d`
Clear/Clean the project
docker-compose stop docker-compose down -v docker-compose up -d --build
docker-compose run --rm artisan clear:data docker-compose run --rm artisan cache:clear docker-compose run --rm artisan config:clear docker-compose run --rm artisan view:clear docker-compose run --rm artisan route:clear docker-compose run --rm artisan clear-compiled docker-compose run --rm artisan config:cache docker-compose run --rm artisan storage:link docker-compose run --rm artisan migrate
Use the native Android / iOS app to configure your BEEP base by Bluetooth.
With the app, connect the BEEP base to the BEEP TTN network (auto configuration), or connect the BEEP base (manually) to your own LoRa network
The native app adds a BEEP base measurement device to your BEEP account
If you are still with a fresh installation, login to your api (```api.[your_domain]/login''') and got to Devices -> Sensor Measurements. Add sensor definitions here.
You can see the measurement data at the Data menu item of the webapp.
Contributing
Thank you for considering contributing to the BEEP framework! If you would like to contribute, please fork this repository, edit on your Github account, and finally send Pull Requests to this repository to include new features.
Please request access to our slack community at https://beep-global.slack.com if you would like to know more, or cooperate.
Here we describe the first steps to setup a programming environment, in case you want to contribute to the app but are not yet a professional laravel developer.
If you setup your own BEEP instance, you might still want to have a local version running, so that you can test changes immedieatly.
Install following additional php extensions: fpm, intl, gd, mysql
Make sure valet uses the correct php version
For Mac: valet use php@8.0
For Linux: valet use 8.0
fill out the .env file
Set APP_URL=beep.test or choose an other url
Set the information for the mysql, influx and redis connections. If you connect to your remote server, make sure the ports are open on your server. You might also need to set a password for redis in this case.
Use php artisan key:generate to generate a key and add it to your env file.
If you get an error like "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0"." you might need to run composer global update
You can also link your local vue app to this url in the .env file. If you do this and you get cors errors, this might be because of one of the following reasons:
The url you set is wrong.
You have to open beep.test first (or your url) and add a security exception for your browser.
In some cases, e.g. in case you made changes to the measurements database, you need to run php artisan cache:clear to make the changes effective in your api calls.
Security Vulnerabilities
If you discover a security vulnerability within BEEP, please send an e-mail to support@beep.nl.
License
The BEEP framework is open-sourced software licensed under the GNU AGPLv3 license.
About
BEEP - Open source bee monitoring - App/API/Measurement system