Express server and React web App to managing and automatically deploy the last version firmware to IoT embedded devices.
This project it is being developed to be a very simple solution to the problem of managing firmware files in IoT projects. In the context of IoT, the Over-The-Air update, called OTA, makes it easier to update devices, as it allows sending firmware and software updates to devices remotely. Click here to see my gist showing how to enable OTA update on one of those devices.
Therefore, there is a simple set of rules that dictate how version numbers are assigned and incremented on build files. For example: consider the version format X.Y.Z. Correction of faults (bug fixes) that do not affect the system, increases the space X, additions / changes compatible with previous versions of the software or firmware increases the Y, and incompatible changes with previous versions increases the Z.
Based on that, at the moment, this is what the system proposes to do:
- Login and Signup
- CRUD (Create, Read, Update and Delete) of a firmware file with the name of the project, version and name of the compatible board;
- Present the list of all firmwares files (.bin) by project and board
- Makes available for donwload all firmware files (without TLS, yet)
- Makes available for donwload in a safe way with TLS
- The name of the firmware is always saved with the format: project_name_v0_0_1.bin
- The system does not accept uploading a file in a format other than .bin
- The file version reflects the Major, Minor and Correction (Patch) version
On the server directory, create the file .env and set the following properties as you need:
# ENV is the enviroment variable to project context, should be 'development' or 'production'
ENV=development
# SERVER_PORT has to be the URL where this server runs
SERVER_PORT=8001
# MAX_SIZE limit the size of firmware in megabytes to a firmware binary deployed
MAX_SIZE=1
Inside the server and app directories, install dependencies:
$ npm install
Start the express server (inside ./server folder)
$ npm start
Start the React app (inside ./app folder)
$ npm start
Build and run the docker compose:
$ docker-compose up -d
- [POST]
- Route: http://localhost:8001/deploy
- Content-Type: multipart/form-data
- Body:
{ "project": "project_name", "board": "esp_01m", "version": "0_0_1" }
- File:
firmware: file.bin
- [GET]
- Route: http://localhost:8001/update/project_name/board_type
- Content-Type: application/json
- Headers:
- x-ESP8266-version: 0_0_1
- x-ESP8266-mode: sketch
- x-ESP8266-chip-size: 1000000