From fb1914b0cf6cf3b8e6cae163c43ddeca35fe6a97 Mon Sep 17 00:00:00 2001 From: kev Date: Fri, 31 May 2024 16:32:52 +0800 Subject: [PATCH] add barcode-server --- README.md | 1 + barcode-server/README.md | 15 ++++++ barcode-server/data/barcode_server.yaml | 63 +++++++++++++++++++++++++ barcode-server/docker-compose.yml | 16 +++++++ 4 files changed, 95 insertions(+) create mode 100644 barcode-server/README.md create mode 100644 barcode-server/data/barcode_server.yaml create mode 100644 barcode-server/docker-compose.yml diff --git a/README.md b/README.md index c80c10d..83895b7 100644 --- a/README.md +++ b/README.md @@ -329,6 +329,7 @@ A collection of delicious docker recipes. - [x] actor-node-puppeteer-chrome - [x] archivebox/archivebox - [x] docker.bintray.io/jfrog/artifactory-oss +- [x] markusressel/barcode-server - [x] jeffail/benthos - [x] tutum/builder - [x] calendso/calendso diff --git a/barcode-server/README.md b/barcode-server/README.md new file mode 100644 index 0000000..e7f55d6 --- /dev/null +++ b/barcode-server/README.md @@ -0,0 +1,15 @@ +barcode-server +============== + +[barcode-server][1] is a simple daemon to read barcodes from USB Barcode +Scanners and expose them to other service using HTTP calls, a websocket API or +MQTT. + +```bash +$ mkdir -p data +$ wget -P data https://github.com/markusressel/barcode-server/raw/master/barcode_server.yaml +$ vim data/barcode_server.yaml +$ docker compose up -d +``` + +[1]: https://github.com/markusressel/barcode-server diff --git a/barcode-server/data/barcode_server.yaml b/barcode-server/data/barcode_server.yaml new file mode 100644 index 0000000..f81566b --- /dev/null +++ b/barcode-server/data/barcode_server.yaml @@ -0,0 +1,63 @@ +barcode_server: + + # (optional) the verbosity level of log output + log_level: DEBUG + + # (optional) an identifier for this barcode-server instance + # if omitted, this will be a UUIDv4 + id: cash-register-1 + + # (optional) server configuration + server: + # (optional) the IP address to listen on for incoming connections + host: "0.0.0.0" + # (optional) the Port to listen on + port: 9654 + # (optional) API-Token which has to be provided by connecting clients + api_token: "EmUSqjXGfnQwn5wn6CpzJRZgoazMTRbMNgH7CXwkQG7Ph7stex" + + # (optional) Time period to retry delivering failed queued events before giving up and dropping the event + drop_event_queue_after: 2h + # (optional) Time to wait between retries + retry_interval: 2s + + # (optional) HTTP push configuration + http: + # URL to send events to using a request + url: "http://dummy.restapiexample.com/api/v1/create" + # The request method to use + method: POST + # Headers to set on each request + headers: + - "X-Auth-Token: MY_HEADERS" + + # (optional) MQTT push configuration + mqtt: + # MQTT server host address + host: "mqtt.mydomain.com" + # (optional) MQTT server port + port: 1883 + # (optional) Client ID of this barcode-server instance to provide to the MQTT server + client_id: "barcode-server" + # MQTT topic to push events to + topic: "barcode-server/barcode" + # Username to use when connecting to the MQTT server + user: "myuser" + # Password to use when connecting to the MQTT server + password: "mypassword" + # (optional) QoS value of event messages + qos: 2 + # (optional) Whether to instruct the MQTT server to remember event messages between restarts (of the MQTT server) + retain: True + + # A list of regex patterns to match USB device names against + devices: + - ".*Barcode.*" + # A list of absolute file paths to devices + device_paths: + #- "/dev/input/barcode_scanner" + + # (optional) Statistics configuration + stats: + # (optional) port to provide statistics on + port: 8000 diff --git a/barcode-server/docker-compose.yml b/barcode-server/docker-compose.yml new file mode 100644 index 0000000..41d6c19 --- /dev/null +++ b/barcode-server/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.8" +services: + barcode-server: + image: markusressel/barcode-server + ports: + - "8000:8000" + - "9654:9654" + volumes: + - ./data:/app/config + environment: + - PUID=0 + - PGID=0 + devices: + - /dev/input + working_dir: /app/config + restart: unless-stopped