diff --git a/.gitignore b/.gitignore index 4c49bd7..8c75193 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .env +.overnodebundle diff --git a/.overnodebundle b/.overnodebundle deleted file mode 100644 index 244cdce..0000000 Binary files a/.overnodebundle and /dev/null differ diff --git a/README.md b/README.md index 0e95546..56b996a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -# Backgruond +# Background This component serves allowed list of keyfob UID hashes from MongoDB and pushes open door commands to door controllers. +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` + # Testing endpoints @@ -14,8 +17,7 @@ curl -f http://doorboy.infra.k-space.ee:5000/allowed -H "KEY: $DOORBOY_SECRET" | # Test scenarios -When updating doorboy proxy, members site or kdoorpi. -Verify follwing: +When updating doorboy proxy, members site or kdoorpi verify follwing: * 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 @@ -27,8 +29,22 @@ 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. +# 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. + # Deploying +To deploy in prod adjust `DOORBOY_SECRET`, `MONGO_URI` in `.env` and proceed to launch: + ``` docker build -t 172.20.40.1:5000/doorboy:latest . docker push 172.20.40.1:5000/doorboy:latest diff --git a/dev.yml b/docker-compose.dev.yml similarity index 62% rename from dev.yml rename to docker-compose.dev.yml index 1c3e4c9..07702be 100644 --- a/dev.yml +++ b/docker-compose.dev.yml @@ -9,18 +9,15 @@ services: - ME_CONFIG_MONGODB_SERVER=127.0.0.1 - ME_CONFIG_MONGODB_PORT=27017 - ME_CONFIG_MONGODB_AUTH_DATABASE=admin + mongo: network_mode: host - restart: unless-stopped image: mongo:latest - environment: - - MONGODB_INITDB_ROOT_USERNAME=doorboy - - MONGODB_INITDB_ROOT_PASSWORD=password - - MONGODB_INITDB_DATABASE=kspace_accounting + doorboy_proxy: - hostname: doorboy.infra.k-space.ee - restart: unless-stopped network_mode: host - env_file: .env + environment: + MONGO_URI=mongodb://127.0.0.1:27017/kspace_accounting?replicaSet=kspace-mongo-set + DOORBOY_SECRET=keykeykey build: context: .