Skip to content

sebhaub/app-server

 
 

Repository files navigation

fablab-server Build Status Docker Repository on Quay

app-server is a REST server based on Dropwizard which is currently used by the following apps:

Deployment with Docker

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 up

The 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.

Two words about Türstatus

  • 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 GET request like: ?data=${time}:${state}&hash=${hmac_hash}
      • $time is the current unix timestamp (date +%s)
      • $state is open or close
      • $hmac_hash is the sha256 hmac hash of the message $time:$state with a key
      • the key is a bit randomness or anything else
  • the script expects a simple OK or 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!

Libraries

fablab-server uses the following libraries and software:

About

Server for the FabLab Apps

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 84.6%
  • HTML 11.2%
  • JavaScript 2.0%
  • CSS 1.3%
  • Shell 0.9%