app-server is a REST server based on Dropwizard which is currently used by the following apps:
The following files have to be present in order to run the server:
- Apple Push certificate
- Java Keystore with ssl cert inside
- doorstate encryption key
Copy them to ./conf.
After that you have to copy conf/{config.yml.example,minimumVersion.yml.example} to conf/{config.yml,minimumVersion.yml} and adapt them to your needs.
Finally, build and run the server with
sudo ./manage-docker.sh upThe container will listen on port 80 for application requests and port 8081 for administrative requests. These ports are bound to random ports on localhost. You can get them by running sudo ./manage-docker.sh port.
-
FAU FabLab has a serial magnetic sensor on their door
-
it is connected to "ws01" (a linux desktop pc (with some server jobs))
- there is a user called
tuerstatus - he runs the script
/home/tuerstatus/update-status.sh - this script polls the website (https://fablab.fau.de) and the app-server (if configured at top of the script)
- the poll is a
HTTP GETrequest like:?data=${time}:${state}&hash=${hmac_hash}$timeis the current unix timestamp (date +%s)$stateisopenorclose$hmac_hashis thesha256hmac hash of the message$time:$statewith a key- the key is a bit randomness or anything else
- there is a user called
-
the script expects a simple
OKor a json{ "success": true, [...] } -
If you want to receive such hooks, you have to
- verify the given time (with some threshold)
- verify the integrity
- you need the same key as on ws01
- e.g.
key=$(cat keyfile) echo -n "${time}:${status}" | openssl dgst -sha256 -hmac "${key}"
-
Overengineered? No!
fablab-server uses the following libraries and software:
- docker-library/mysql/5.6 License: GNU GPL Version 2
- jsonrpc2-client:1.15 License: Apache 2.0
- ical4j:1.0.5 License: (https://github.com/ical4j/ical4j/blob/master/LICENSE)
- jackson-dataformat-xml:2.5.1 License: Apache 2.0
- jsoup:1.8.2 License: MIT License
- cron4j:2.2.5 License: LGPL
- pushy:0.4.3 License: MIT