Simplify and clean up
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1,2 @@ | |||||||
| .env | .env | ||||||
|  | .overnodebundle | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								.overnodebundle
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.overnodebundle
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,7 +1,10 @@ | |||||||
| # Backgruond | # Background | ||||||
|  |  | ||||||
| This component serves allowed list of keyfob UID hashes from MongoDB and | This component serves allowed list of keyfob UID hashes from MongoDB and | ||||||
| pushes open door commands to door controllers. | 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 | # Testing endpoints | ||||||
|  |  | ||||||
| @@ -14,8 +17,7 @@ curl -f http://doorboy.infra.k-space.ee:5000/allowed -H "KEY: $DOORBOY_SECRET" | | |||||||
|  |  | ||||||
| # Test scenarios | # Test scenarios | ||||||
|  |  | ||||||
| When updating doorboy proxy, members site or kdoorpi. | When updating doorboy proxy, members site or kdoorpi verify follwing: | ||||||
| Verify follwing: |  | ||||||
|  |  | ||||||
| * Swiping unknown card shows up as unknown, it can be claimed on members site and it immediately can be used after claiming | * 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 | * 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 | use a brick or something to keep it open to prevent | ||||||
| interfering with other members entering and exiting. | 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 | # 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 build -t 172.20.40.1:5000/doorboy:latest . | ||||||
| docker push 172.20.40.1:5000/doorboy:latest | docker push 172.20.40.1:5000/doorboy:latest | ||||||
|   | |||||||
| @@ -9,18 +9,15 @@ services: | |||||||
|       - ME_CONFIG_MONGODB_SERVER=127.0.0.1 |       - ME_CONFIG_MONGODB_SERVER=127.0.0.1 | ||||||
|       - ME_CONFIG_MONGODB_PORT=27017 |       - ME_CONFIG_MONGODB_PORT=27017 | ||||||
|       - ME_CONFIG_MONGODB_AUTH_DATABASE=admin |       - ME_CONFIG_MONGODB_AUTH_DATABASE=admin | ||||||
|  | 
 | ||||||
|   mongo: |   mongo: | ||||||
|     network_mode: host |     network_mode: host | ||||||
|     restart: unless-stopped |  | ||||||
|     image: mongo:latest |     image: mongo:latest | ||||||
|     environment: | 
 | ||||||
|       - MONGODB_INITDB_ROOT_USERNAME=doorboy |  | ||||||
|       - MONGODB_INITDB_ROOT_PASSWORD=password |  | ||||||
|       - MONGODB_INITDB_DATABASE=kspace_accounting |  | ||||||
|   doorboy_proxy: |   doorboy_proxy: | ||||||
|     hostname: doorboy.infra.k-space.ee |  | ||||||
|     restart: unless-stopped |  | ||||||
|     network_mode: host |     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: |     build: | ||||||
|       context: . |       context: . | ||||||
		Reference in New Issue
	
	Block a user