2021-04-04 18:56:44 +00:00
|
|
|
# Background
|
2021-04-04 11:51:11 +00:00
|
|
|
|
|
|
|
This component serves allowed list of keyfob UID hashes from MongoDB and
|
|
|
|
pushes open door commands to door controllers.
|
2021-04-04 18:56:44 +00:00
|
|
|
We run three instances `replica{1..3}.doorboy.infra.k-space.ee` for high availability.
|
|
|
|
To connect from door controllers use round robin record `doorboy.infra.k-space.ee`
|
|
|
|
|
2021-04-04 11:51:11 +00:00
|
|
|
|
|
|
|
# Testing endpoints
|
|
|
|
|
2021-04-04 12:03:22 +00:00
|
|
|
For manually testing something like this might help:
|
|
|
|
|
2021-04-04 11:51:11 +00:00
|
|
|
```
|
|
|
|
source .env
|
|
|
|
curl -f http://doorboy.infra.k-space.ee:5000/allowed -H "KEY: $DOORBOY_SECRET" | md5sum
|
|
|
|
```
|
|
|
|
|
2021-04-04 12:03:22 +00:00
|
|
|
# Test scenarios
|
|
|
|
|
2021-04-04 18:56:44 +00:00
|
|
|
When updating doorboy proxy, members site or kdoorpi verify follwing:
|
2021-04-04 12:03:22 +00:00
|
|
|
|
|
|
|
* Swiping unknown card shows up as unknown, it can be claimed on members site and it immediately can be used after claiming
|
|
|
|
* Card enable/disable on members site works and has effect
|
|
|
|
* Opening door via buttons at https://members.k-space.ee/m/doorboy works and has effect
|
|
|
|
* Opening door via `/open-ground-door`, `/open-front-door` and `/open-back-door` commands in Slack channel #members works
|
|
|
|
* TODO: Keep door open via members site works and has effect
|
|
|
|
|
|
|
|
When testing changes prefer using the *back* door and
|
|
|
|
use a brick or something to keep it open to prevent
|
|
|
|
interfering with other members entering and exiting.
|
2021-04-04 11:51:11 +00:00
|
|
|
|
2021-04-04 18:56:44 +00:00
|
|
|
# Development
|
|
|
|
|
|
|
|
The easiest is to obtain VM from Proxmox cluster with public IP address.
|
|
|
|
To run development instance:
|
|
|
|
|
|
|
|
```
|
|
|
|
docker-compose -f docker-compose.dev.yml up --build
|
|
|
|
```
|
|
|
|
|
|
|
|
On kdoorpi override `KDOORPI_API_ALLOWED`, `KDOORPI_API_LONGPOLL` environment variables
|
|
|
|
to redirect requests to your dev instance.
|
|
|
|
|
2021-04-04 08:58:45 +00:00
|
|
|
# Deploying
|
|
|
|
|
2021-06-12 20:52:19 +00:00
|
|
|
Images are built and pushed to Docker Hub by Jenkins.
|
2021-04-04 18:56:44 +00:00
|
|
|
To deploy in prod adjust `DOORBOY_SECRET`, `MONGO_URI` in `.env` and proceed to launch:
|
|
|
|
|
2021-04-04 08:58:45 +00:00
|
|
|
```
|
|
|
|
overnode pull
|
|
|
|
overnode up
|
|
|
|
```
|
|
|
|
|