# firmware_server - firmware OTA service for IoT devices

- [Installation](#installation)
- [Test](#test)


## Installation
Hosting settings in plesk:
```   
   CGI-Unterstützung  enable
   Dokumentenstamm /httpdocs
   KEINE Dauerhafte SSL umleitung
```

Apache settings in Plesk:
```
   LogLevel info
   ServerName firmware.mawi42.de
   
   WSGIDaemonProcess firmware user=firmware.mawi42.de group=psacln threads=5 python-home=/var/www/vhosts/firmware.mawi42.de/venv
   
   <Directory /var/www/vhosts/firmware.mawi42.de/httpdocs/cgi-bin>
   	   WSGIProcessGroup firmware.mawi42.de
	   WSGIApplicationGroup %{GLOBAL}
	   Order deny,allow
	   Allow from all
   </Directory>
```

Install packages on the server 
```
   sudo apt-get install python3-venv
   sudo apt-get install python-requests
   sudo apt-get install python3-pip
   sudo pip3 install requests
```

Install source
```
   git clone https://gitlab.mawi42.de/iot-group/firmware_server.git
```

Create virtual env for Python and activate:
```
   python3 -m venv venv
   . ./venv/bin/activate
   cd httpdocs
   python3 setup.py install

```


## Test
Start test server for debugging
```
    cd httpdocs
    python3 -m http.server
```    
Open browser: http://firmware.mawi42.de:8000?project=test&hw_major=0&hw_minor=1&fw_major=1&fw_minor=0&fw_patch=0
