From 77b8dc5a215532e1db02226f1275a35cfbc1fc94 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 13:51:03 +0100 Subject: [PATCH 01/16] Docker env - single statement --- Dockerfile | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index b959f501..a54d8131 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,20 +40,17 @@ COPY --from=builder "$APP_DIR/dist" "$APP_DIR/" RUN npm install --production -# This goes into /etc/sane.d/net.conf -ENV SANED_NET_HOSTS="" - -# This gets added to /etc/sane.d/airscan.conf -ENV AIRSCAN_DEVICES="" - -# This directs scanserv not to bother querying `scanimage -L` -ENV SCANIMAGE_LIST_IGNORE="" - -# This gets added to scanservjs/server/config.js:devices -ENV DEVICES="" - -# Override OCR language -ENV OCR_LANG="" +ENV \ + # This goes into /etc/sane.d/net.conf + SANED_NET_HOSTS="" \ + # This gets added to /etc/sane.d/airscan.conf + AIRSCAN_DEVICES="" \ + # This directs scanserv not to bother querying `scanimage -L` + SCANIMAGE_LIST_IGNORE="" \ + # This gets added to scanservjs/server/config.js:devices + DEVICES="" \ + # Override OCR language + OCR_LANG="" # Copy entry point COPY run.sh /run.sh From 3aec894785ca0dd092e0d160b2077672d10f05f4 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 20:49:12 +0100 Subject: [PATCH 02/16] Run docker container as non-privileged user #177 --- Dockerfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a54d8131..e76134f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,9 +36,8 @@ RUN apt-get update \ tesseract-ocr \ && sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"'/ /etc/ImageMagick-6/policy.xml -COPY --from=builder "$APP_DIR/dist" "$APP_DIR/" - -RUN npm install --production +# Create a known user +RUN useradd -u 2001 -ms /bin/bash scanservjs ENV \ # This goes into /etc/sane.d/net.conf @@ -56,4 +55,13 @@ ENV \ COPY run.sh /run.sh RUN ["chmod", "+x", "/run.sh"] ENTRYPOINT [ "/run.sh" ] + +# Copy the code and install +COPY --from=builder "$APP_DIR/dist" "$APP_DIR/" +RUN npm install --production + +# Change the ownership of config and data since we need to write there +RUN chown -R scanservjs:scanservjs config data +USER scanservjs + EXPOSE 8080 From b00599aefda39f4c334cb2e27b3def1ca10e94a4 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 20:50:06 +0100 Subject: [PATCH 03/16] Documentation updates #171 #129 --- README.md | 103 +++--------------------------- docs/docker.md | 163 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/install.md | 1 + docs/sane.md | 2 +- 4 files changed, 174 insertions(+), 95 deletions(-) create mode 100644 docs/docker.md diff --git a/README.md b/README.md index 3d0567e5..a383ab23 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ complicated installation. * Configurable overrides for all defaults as well as filters and formats * Multipage scanning (with collation for double sided scans) * Light and dark mode -* **NEW**: International translations: Czech, German, Italian, Spanish (**help - requested**) +* **NEW**: International translations: Czech, German, Italian, Mandarin, Spanish + (**help requested**) It supports any [SANE compatible devices](http://www.sane-project.org/sane-supported-devices.html). @@ -43,74 +43,18 @@ Copyright 2016-2021 [Sam Strachan](https://github.com/sbs20) * Linux host (or VM with necessary pass-through e.g. USB) * Software sane-utils, ImageMagick, Tesseract (optional) and nodejs -## Installation notes -For an easy docker-based install (assuming that SANE supports your scanner -out-of-the-box on Debian) use the following commands: +## Installation -```console -docker pull sbs20/scanservjs:latest -docker rm --force scanservjs-container 2> /dev/null -docker run -d -p 8080:8080 -v /var/run/dbus:/var/run/dbus --restart unless-stopped --name scanservjs-container --privileged sbs20/scanservjs:latest -``` - -scanservjs will now be accessible from `http://$host:8080/` - -* ⚠ By default, configuration and scanned images are stored within the container - and will be lost if you recreate it. If you want to map your scanned images - then specify the volume mapping option `-v /local/path/:/app/data/output/` -* ⚠ The docker image is amd64 only - and will not work on ARM devices such as - the Raspberry Pi. Please follow the manual installation process in these - cases -* ⚠ `--privileged` is required for the container to access the host's devices, - to allow it to talk to the scanner. The best way to do this is to map the - actual USB ports. Run `sudo sane-find-scanner -q` and you will get a result - like - `found USB scanner (vendor=0x04a9 [Canon], product=0x220d [CanoScan], chip=LM9832/3) at libusb:001:003`. - This translates to `/dev/bus/usb/001/003`. In turn the docker argument would - be `--device=/dev/bus/usb/001/003:/dev/bus/usb/001/003`. However, oftentimes, - there are [reports](#66) that devices change address across reboots which - complicates matters. -* ⚠ Driverless-mode scanning (using airscan over IPP-USB) seems to result in - problems. If anyone has ideas why (perhaps something additional needs sharing - from host to guest) then suggestions are welcome. What seems to work well as - an alternative is - [network-sharing the scanner](https://github.com/sbs20/scanservjs/issues/129#issuecomment-800226184) - on the host and referencing that within the guest. - -If you want to install the latest staging branch (this may contain newer code) - -```console -docker pull sbs20/scanservjs:staging -docker rm --force scanservjs-container 2> /dev/null -docker run -d -p 8080:8080 -v /var/run/dbus:/var/run/dbus --restart unless-stopped --name scanservjs-container --privileged sbs20/scanservjs:staging -``` - -More installation options: - -* [Manual installation notes](docs/install.md) +* [Manual installation](docs/install.md) +* [Docker installation](docs/docker.md) * [Development notes](docs/development.md) * [Configuring the scanner and SANE](docs/sane.md) -## Environment variables - -* `SANED_NET_HOSTS`: If you want to use a - [SaneOverNetwork](https://wiki.debian.org/SaneOverNetwork#Server_Configuration) - scanner then to perform the equivalent of adding hosts to - `/etc/sane.d/net.conf` specify a list of ip addresses separated by semicolons - in the `SANED_NET_HOSTS` environment variable. -* `AIRSCAN_DEVICES`: If you want to specifically add `sane-airscan` devices to - your `/etc/sane.d/airscan.conf` then use the `AIRSCAN_DEVICES` environment - variable (semicolon delimited). -* `DELIMITER`: if you need to inlcude semi-colons (`;`) in your environment - variables, this allows you to choose an alternative delimiter. -* `DEVICES`: Force add devices use `DEVICES` (semicolon delimited) -* `SCANIMAGE_LIST_IGNORE`: To force ignore `scanimage -L` - ## Configuration and device override If you want to override some specific configuration setting then you can do so within `./config/config.local.js`. Take a copy of `./config/config.default.js` and override the sections you want. Using docker you will need to map the volume -using `-v /my/local/path/:/app/config/` then create a file in your directory +using `-v /my/local/path:/app/config` then create a file in your directory called `config.local.js`. See [example source](./server/config/config.local.js) for more options. @@ -155,38 +99,6 @@ module.exports = { }; ``` -## Airscan -[sane-airscan](https://github.com/alexpevzner/sane-airscan) uses Avahi / -Zeroconf / Bonjour to discover devices on the local network. If you are running -docker you will want to share dbus to make it work -(`-v /var/run/dbus:/var/run/dbus`). - -## Example docker run - -### Use airscan and a locally detected scanner -This should support most use cases - -```console -docker run -d -p 8080:8080 \ - -v /var/run/dbus:/var/run/dbus \ - --name scanservjs-container --privileged scanservjs-image -``` - -### Complicated -Add two net hosts to sane, use airscan to connect to two remote scanners, don't -use `scanimage -L`, force a list of devices and override the OCR language - -```console -docker run -d -p 8080:8080 \ - -e SANED_NET_HOSTS="10.0.100.30;10.0.100.31" \ - -e AIRSCAN_DEVICES='"Canon MFD" = "http://192.168.0.10/eSCL";"EPSON MFD" = "http://192.168.0.11/eSCL"' \ - -e SCANIMAGE_LIST_IGNORE=true \ - -e DEVICES="net:10.0.100.30:plustek:libusb:001:003;net:10.0.100.31:plustek:libusb:001:003;airscan:e0:Canon TR8500 series;airscan:e1:EPSON Cool Series" \ - -e OCR_LANG="fra" \ - -v /var/run/dbus:/var/run/dbus \ - --name scanservjs-container --privileged scanservjs-image -``` - ## Why? This is yet another scanimage-web-front-end. Why? It originally started as an adaptation of phpsane - just to make everything a bit newer, give it a refresh @@ -198,6 +110,9 @@ and it's been a labour of love ever since. ## Acknowledgements * This project owes its genesis to [phpsane](http://sourceforge.net/projects/phpsane/) + * [Everyone](https://github.com/sbs20/scanservjs/graphs/contributors) who has + filed issues, tested, fixed issues, added translations and helped over the + years. Thank you! ## More about SANE * http://www.sane-project.org/ \ No newline at end of file diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 00000000..81fc7ead --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,163 @@ +# Running scanservjs under docker + +## Quickstart + +Get the image + +```console +docker pull sbs20/scanservjs:latest +``` + +Run it + +```console +docker rm --force scanservjs-container 2> /dev/null +docker run -d \ + -p 8080:8080 \ + -v /var/run/dbus:/var/run/dbus \ + --restart unless-stopped \ + --name scanservjs-container \ + --privileged sbs20/scanservjs:latest +``` + +## General notes + +* ⚠ By default, configuration and scanned images are stored within the container + and will be lost if you recreate it. If you want to map your scanned images + then see mapping section below +* ⚠ The docker image is amd64 only - and will not work on ARM devices such as + the Raspberry Pi. Please follow the manual installation process in these + cases + +## Accessing hardware + +Docker is great for certain tasks. But it's less ideal for situations where the +container needs to access the host hardware. The "simple" solution is to run +with `--privileged` but that gives your container full root access to the host - +you're putting a lot of trust in the container. In short, best not. + +Depending on your setup you have a number of options. + +* If your scanner is connected by USB to the host then you can map the device. + The best way to do this is to map the actual USB ports. + * Run `sudo sane-find-scanner -q` and you will get a result like + `found USB scanner (vendor=0x04a9 [Canon], product=0x220d [CanoScan], chip=LM9832/3) at libusb:001:003`. + * Or run `lsusb` which gives you + `Bus 001 Device 003: ID 04a9:220d Canon, Inc. CanoScan N670U/N676U/LiDE 20`. + * Both translate to `/dev/bus/usb/001/003`. + * The docker argument would be + `--device=/dev/bus/usb/001/003:/dev/bus/usb/001/003` + +* If your scanner is driverless over the network, then + [sane-airscan](https://github.com/alexpevzner/sane-airscan) should be able to + figure it out - but it uses Avahi / Zeroconf / Bonjour to discover devices on + the local network. You will want to share dbus to make it work + (`-v /var/run/dbus:/var/run/dbus`). + +* If your container is running inside a VM you may find that the USB device id + is [unstable](#66) and changes between boots. In these cases, you will + probably find it easier to share the scanner over the network on the host. + +* Driverless-mode scanning (using airscan over IPP-USB) also seems to result in + problems. If anyone has ideas why (perhaps something additional needs sharing + from host to guest) then suggestions are welcome. + +* You need proprietary drivers for your scanner. Adding more backends to the + docker container feels wrong and will add bloat for many users who don't need + it. The best solution is either to create your own docker image based on the + scanservjs one and add it in that way, or to install the drivers on the host + and share it over the network. + +* The best fallback position for many cases is simply to + [share the host scanner over the network](#129#issuecomment-800226184) and + referencing that within the guest. This means that the docker container is + just running the app. + +## Mapping volumes + +There are two volumes you may wish to map: + +* The scanned images: use `-v /local/path/scans:/app/data/output` +* Configuration overrides: use `-v /local/path/cfg:/app/config` + +## User and group mapping + +The docker image which is created now runs under a non-privileged user account +with a UID of `2001`. If you attempt to run as a user other than `2001` or `0` +(e.g. `-u 1000`) then the process inside the container will no longer have +access to some of the things it needs to and it will fail. Most of the time you +won't care about this, but if you're mapping volumes for either config or data, +then it may matter. + +The solution in most cases is either to +* change the group of the container to a known group on the host e.g. + `-u 2001:1000`. This will keep the user correct (`2001`) but change the group + (`1000`) +* create a corresponding user on the host e.g. + `useradd -u 2001 -ms /bin/bash scanservjs` +* change the host volume permissions e.g. `chmod 777 local-volume` + +## Environment variables + +* `SANED_NET_HOSTS`: If you want to use a + [SaneOverNetwork](https://wiki.debian.org/SaneOverNetwork#Server_Configuration) + scanner then to perform the equivalent of adding hosts to + `/etc/sane.d/net.conf` specify a list of ip addresses separated by semicolons + in the `SANED_NET_HOSTS` environment variable. +* `AIRSCAN_DEVICES`: If you want to specifically add `sane-airscan` devices to + your `/etc/sane.d/airscan.conf` then use the `AIRSCAN_DEVICES` environment + variable (semicolon delimited). +* `DELIMITER`: if you need to inlcude semi-colons (`;`) in your environment + variables, this allows you to choose an alternative delimiter. +* `DEVICES`: Force add devices use `DEVICES` (semicolon delimited) +* `SCANIMAGE_LIST_IGNORE`: To force ignore `scanimage -L` + +## Examples + +### Mapped USB device with mapped volumes + +```console +docker run -d \ + -p 8080:8080 \ + -v $HOME/scan-data:/app/data/output \ + -v $HOME/scan-cfg:/app/config \ + --device /dev/bus/usb/001/003:/dev/bus/usb/001/003 \ + --name scanservjs-container scanservjs-image +``` + +### Use airscan and a locally detected scanner +This should support most use cases + +```console +docker run -d -p 8080:8080 \ + -v /var/run/dbus:/var/run/dbus \ + --name scanservjs-container scanservjs-image +``` + +### A bit of everything +Add two net hosts to sane, use airscan to connect to two remote scanners, don't +use `scanimage -L`, force a list of devices, override the OCR language and run +in privileged mode + +```console +docker run -d -p 8080:8080 \ + -e SANED_NET_HOSTS="10.0.100.30;10.0.100.31" \ + -e AIRSCAN_DEVICES='"Canon MFD" = "http://192.168.0.10/eSCL";"EPSON MFD" = "http://192.168.0.11/eSCL"' \ + -e SCANIMAGE_LIST_IGNORE=true \ + -e DEVICES="net:10.0.100.30:plustek:libusb:001:003;net:10.0.100.31:plustek:libusb:001:003;airscan:e0:Canon TR8500 series;airscan:e1:EPSON Cool Series" \ + -e OCR_LANG="fra" \ + -v /var/run/dbus:/var/run/dbus \ + --name scanservjs-container --privileged scanservjs-image +``` + +## Staging builds + +These may be less stable, but also have upcoming features. + +If you want to install the latest staging branch (this may contain newer code) + +```console +docker pull sbs20/scanservjs:staging +docker rm --force scanservjs-container 2> /dev/null +docker run -d -p 8080:8080 -v /var/run/dbus:/var/run/dbus --restart unless-stopped --name scanservjs-container --privileged sbs20/scanservjs:staging +``` diff --git a/docs/install.md b/docs/install.md index 799f16b7..aa3e6123 100644 --- a/docs/install.md +++ b/docs/install.md @@ -4,6 +4,7 @@ The easiest way to run is with Docker. But it's still possible to setup manually. ## Manual Steps + * Get [SANE installed and working](./sane.md) and check permissions etc. * Get nodejs and npm installed (You will need an up to date version of npm, you may need to run `npm install npm@latest -g`) diff --git a/docs/sane.md b/docs/sane.md index 91fe1c62..27a93eda 100644 --- a/docs/sane.md +++ b/docs/sane.md @@ -64,7 +64,7 @@ net:192.168.0.10:airscan:e0:Canon TR8500 series For more information on configuring the server and client see [SaneOverNetwork](https://wiki.debian.org/SaneOverNetwork#Server_Configuration). -TL;DR; for configuring server: +### TL;DR; configuring server: ```console # Allow access from network From 339b083ac3f6dc77d7e2ac973738fc6ee7c5ce55 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 20:50:41 +0100 Subject: [PATCH 04/16] Version bump --- server/package-lock.json | 2 +- server/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index c944286f..ed19d4c1 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.8.4", + "version": "2.9.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/server/package.json b/server/package.json index 5142df46..5a8df9ac 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.8.4", + "version": "2.9.0", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation. scanserv does not do image conversion or manipulation (beyond the bare minimum necessary for the purposes of browser preview) or OCR.", "scripts": { "serve": "nodemon --exec 'vue-cli-service serve'", From 3aec5406d6544539f69b43b4182f1e7403954659 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 20:54:57 +0100 Subject: [PATCH 05/16] Update docker links --- docs/docker.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 81fc7ead..0f92196b 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -55,8 +55,9 @@ Depending on your setup you have a number of options. (`-v /var/run/dbus:/var/run/dbus`). * If your container is running inside a VM you may find that the USB device id - is [unstable](#66) and changes between boots. In these cases, you will - probably find it easier to share the scanner over the network on the host. + is [unstable](https://github.com/sbs20/scanservjs/issues/66) and changes + between boots. In these cases, you will probably find it easier to share the + scanner over the network on the host. * Driverless-mode scanning (using airscan over IPP-USB) also seems to result in problems. If anyone has ideas why (perhaps something additional needs sharing @@ -69,8 +70,8 @@ Depending on your setup you have a number of options. and share it over the network. * The best fallback position for many cases is simply to - [share the host scanner over the network](#129#issuecomment-800226184) and - referencing that within the guest. This means that the docker container is + [share the host scanner over the network](https://github.com/sbs20/scanservjs/issues/129#issuecomment-800226184) + and referencing that within the guest. This means that the docker container is just running the app. ## Mapping volumes From b595ee89c17fe0bf371a798eed7941368ef9d2a3 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Thu, 8 Apr 2021 20:57:50 +0100 Subject: [PATCH 06/16] docker console to sh --- docs/docker.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 0f92196b..ed0aed78 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -4,13 +4,13 @@ Get the image -```console +```sh docker pull sbs20/scanservjs:latest ``` Run it -```console +```sh docker rm --force scanservjs-container 2> /dev/null docker run -d \ -p 8080:8080 \ @@ -117,7 +117,7 @@ The solution in most cases is either to ### Mapped USB device with mapped volumes -```console +```sh docker run -d \ -p 8080:8080 \ -v $HOME/scan-data:/app/data/output \ @@ -129,7 +129,7 @@ docker run -d \ ### Use airscan and a locally detected scanner This should support most use cases -```console +```sh docker run -d -p 8080:8080 \ -v /var/run/dbus:/var/run/dbus \ --name scanservjs-container scanservjs-image @@ -140,7 +140,7 @@ Add two net hosts to sane, use airscan to connect to two remote scanners, don't use `scanimage -L`, force a list of devices, override the OCR language and run in privileged mode -```console +```sh docker run -d -p 8080:8080 \ -e SANED_NET_HOSTS="10.0.100.30;10.0.100.31" \ -e AIRSCAN_DEVICES='"Canon MFD" = "http://192.168.0.10/eSCL";"EPSON MFD" = "http://192.168.0.11/eSCL"' \ @@ -157,7 +157,7 @@ These may be less stable, but also have upcoming features. If you want to install the latest staging branch (this may contain newer code) -```console +```sh docker pull sbs20/scanservjs:staging docker rm --force scanservjs-container 2> /dev/null docker run -d -p 8080:8080 -v /var/run/dbus:/var/run/dbus --restart unless-stopped --name scanservjs-container --privileged sbs20/scanservjs:staging From 9a28ada4485256c71d5e8c52a02a7e80648fb2d8 Mon Sep 17 00:00:00 2001 From: Sam Strachan Date: Sat, 10 Apr 2021 16:56:25 +0100 Subject: [PATCH 07/16] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e14dc59e..fe9d3514 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: - '.github/**' - 'docs/**' - 'README.md' + - 'install.sh' branches: - development - staging From 7c67095c3942184786bfb2539dbf355f4423ba79 Mon Sep 17 00:00:00 2001 From: Sam Strachan Date: Sat, 10 Apr 2021 16:57:00 +0100 Subject: [PATCH 08/16] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 30574750..a9a40ea4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,6 +12,7 @@ on: - '.github/**' - 'docs/**' - 'README.md' + - 'install.sh' pull_request: # The branches below must be a subset of the branches above branches: [staging] @@ -19,6 +20,7 @@ on: - '.github/**' - 'docs/**' - 'README.md' + - 'install.sh' workflow_dispatch: jobs: From 9ca8bebffe53949a3d09882f10022a83baa6cb49 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 10 Apr 2021 17:05:26 +0100 Subject: [PATCH 09/16] Installation script #178 --- install.sh | 196 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..803fccd0 --- /dev/null +++ b/install.sh @@ -0,0 +1,196 @@ +#!/bin/bash + +# scanservjs installation script for Debian and Ubuntu + +# Usage: + +# curl -s https://github.com/sbs20/scanservjs/blob/master/install.sh | sudo bash -s -i + +# This script will install the bare minimum for scanservjs to work. It will +# install sane-utils but not sane - you may have your sane backend running on +# another server. It will not install sane-airscan either. + +# To do this then run + +# ``` +# apt-get update +# apt-get install -yq curl gpg tee +# echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list +# curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null +# apt-get install -yq \ +# sane \ +# sane-airscan +# ``` + +tmp="/tmp/scanservjs" +location="/var/www/scanservjs" + +assert_root() { + if [ "$(id -u)" -ne "0" ]; then + echo "Error: This script must be executed with root privileges. Try sudo." + exit 1 + fi +} + +install() { + + cat << EOF +This script will install scanservjs from https://github.com/sbs20/scanservjs +with the bare minimum for it to work. It will install sane-utils but not sane, +as you may have your sane backend running on another server. It will not install +sane-airscan either. For more information see the source of this script on +github. + +It will: + +* run apt-get update +* install SANE, node and imagemagick dependencies +* create the web application in /var/www/scanservjs +* create a user and systemd service which is enabled and started + +Do you want to continue? [y/N]: +EOF + read do_install + + if [ "y" != "$do_install" ]; then + echo "Abort." + exit 0 + fi + + # minimum dependencies + apt-get update + apt-get install -yq \ + curl \ + nodejs \ + npm \ + imagemagick \ + sane-utils \ + tesseract-ocr + + npm install npm@latest -g + + if [ -d "$location" ]; then + # keep config and data + mkdir -p $tmp + cp -a -v $location/config $tmp + cp -a -v $location/data $tmp + + # stop the service + if [ "$(systemctl is-active scanservjs 2>&1 | tr -s \\n)" = "active" ]; then + systemctl stop scanservjs + fi + + # wipe previous install + rm -rf $location + fi + + if [ -z "$(grep scanservjs /etc/passwd 2>&1 | tr -s \\n)" ]; then + # Create a user for this service and set primary group to "users" + useradd -m -g users scanservjs + + # Add the new user to the scanner group too (created by SANE) + usermod -aG scanner scanservjs + + # Add the new user to the lp group too (for Ubuntu) + usermod -aG lp scanservjs + fi + + mkdir -p $location + url=$(curl -s https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4) + curl -L $url | tar -zxf - -C $location/ + + # Copy the files back + if [ -d "$tmp" ]; then + cp -a -v $tmp/config $location/ + cp -a -v $tmp/data $location/ + fi + + # Set the file owners + chown -R scanservjs:users $location/config + chown -R scanservjs:users $location/data + + # ... and ensure the server is executable + chmod +x $location/server/server.js + + # Enable PDF + sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"'/ /etc/ImageMagick-6/policy.xml + + # Install all the node dependencies + cd $location && npm install --only=production + + # Now copy the service definition + cp $location/scanservjs.service /etc/systemd/system + + # Reload the deamon info + systemctl daemon-reload + + # Enable and start the new service + systemctl enable scanservjs + systemctl start scanservjs + + echo "scanservjs installed and running" + echo "http://127.0.0.1:8080" + echo + echo "If you have problems, try 'sudo journalctl -e -u scanservjs'" +} + +uninstall() { + # Stop and dsiable service + if [ "$(systemctl is-active scanservjs 2>&1 | tr -s \\n)" = "active" ]; then + systemctl stop scanservjs + fi + + if [ "$(systemctl is-enabled scanservjs 2>&1 | tr -s \\n)" = "active" ]; then + systemctl disable scanservjs + fi + + # Remove service definition and reload + rm -f /etc/systemd/system/scanservjs.service + systemctl daemon-reload + + # Remove user + if [ ! -z "$(grep scanservjs /etc/passwd 2>&1 | tr -s \\n)" ]; then + userdel -r scanservjs + fi + + echo "scanservjs removed" +} + +hard_uninstall() { + # Remove all files + rm -rf $location + + # remove dependencies + apt-get remove -yq \ + curl \ + nodejs \ + npm \ + imagemagick \ + sane-utils \ + tesseract-ocr +} + +# main +assert_root + +case "$1" in + -i|--install) + install + ;; + -u|--uninstall) + uninstall + ;; + --force-uninstall) + uninstall + hard_uninstall + ;; + *) + cat << EOF +Unknown argument +usage: + -i | --install : install scanservjs + -u | --uninstall : uninstall scanservjs (leaves web and data files) + --force-uninstall : uninstall scanservjs (removes all dependencies - dragons here) +EOF + ;; +esac From 02d56b4bbcc1fbdca3354b81b89da00eff39a7b9 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 10 Apr 2021 17:48:48 +0100 Subject: [PATCH 10/16] Installer #178 --- .github/workflows/build.yml | 1 - .github/workflows/codeql-analysis.yml | 2 - server/bin/install.sh | 99 ------------------------ install.sh => server/bin/installer.sh | 104 +++++++++++++------------- server/bin/uninstall.sh | 24 ------ server/gulpfile.js | 3 +- 6 files changed, 54 insertions(+), 179 deletions(-) delete mode 100644 server/bin/install.sh rename install.sh => server/bin/installer.sh (69%) delete mode 100644 server/bin/uninstall.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe9d3514..e14dc59e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,6 @@ on: - '.github/**' - 'docs/**' - 'README.md' - - 'install.sh' branches: - development - staging diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a9a40ea4..30574750 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,7 +12,6 @@ on: - '.github/**' - 'docs/**' - 'README.md' - - 'install.sh' pull_request: # The branches below must be a subset of the branches above branches: [staging] @@ -20,7 +19,6 @@ on: - '.github/**' - 'docs/**' - 'README.md' - - 'install.sh' workflow_dispatch: jobs: diff --git a/server/bin/install.sh b/server/bin/install.sh deleted file mode 100644 index e5c3be8a..00000000 --- a/server/bin/install.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh - -# This script assumes you have already downloaded (or built) a -# *release* version of scanservjs. To download go to -# https://github.com/sbs20/scanservjs/releases/latest and get the latest file - -# Check we have the necessary privileges -ROOTUID="0" -if [ "$(id -u)" -ne "$ROOTUID" ] ; then - echo "Error: This script must be executed with root privileges. Try sudo." - exit 1 -fi - -# Check dependencies -if ! [ -x "$(command -v node)" ]; then - echo 'Error: nodejs is not installed.' >&2 - exit 1 -fi - -if ! [ -x "$(command -v npm)" ]; then - echo 'Error: npm is not installed.' >&2 - exit 1 -fi - -# You may wish to install additional components such as airscan and tesseract. -# apt-get install -yq curl gpg -# echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list -# curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null -# apt-get update -# apt-get install -yq sane sane-utils imagemagick tesseract-ocr sane-airscan - -# Set correct src dir -srcdir="$( cd "$( dirname "$0" )" && pwd )" - -# Set up variables here -scansrvjs_home=/var/www/scanservjs -scanservjs_status=`systemctl is-active scanservjs 2>&1 | tr -s \\n` -scanservjs_user_exists=`grep scanservjs /etc/passwd 2>&1 | tr -s \\n` - -# If this is not the first time you've installed this on a device -# then stop the service first -if [ "$scanservjs_status" = "active" ]; then - systemctl stop scanservjs -fi - -# Completely wipe any previous install -rm -rf $scansrvjs_home - -# You need to install SANE first -# See: https://github.com/sbs20/scanserv/blob/master/install-sane.md -if [ -z "$scanservjs_user_exists" ]; then - # Create a user for this service and set primary group to "users" - useradd -m -g users scanservjs - - # Add the new user to the scanner group too (created by SANE) - usermod -aG scanner scanservjs - - # Add the new user to the lp group too (for Ubuntu) - usermod -aG lp scanservjs -fi - -# Create a target directory for the website -mkdir -p $scansrvjs_home - -# Download and copy to target location -cp -rf $srcdir/* $scansrvjs_home - -# Set the file owners -chown -R scanservjs:users $scansrvjs_home/ - -# Update directory permissions so we can look inside -find . -type d -exec chmod 755 {} + - -# ... and ensure the server is executable -chmod +x $scansrvjs_home/server/server.js - -# Enable PDF -sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"'/ /etc/ImageMagick-6/policy.xml - -# Change to the target location -cd $scansrvjs_home - -# Install all the node dependencies -npm install --only=production - -# Now copy the service definition -cp scanservjs.service /etc/systemd/system - -# Reload the deamon info -systemctl daemon-reload - -# Enable and start the new service -systemctl enable scanservjs -systemctl start scanservjs - -echo "scanservjs starting" -echo "http://127.0.0.1:8080" -echo -echo "If you have problems, try 'sudo journalctl -e -u scanservjs'" diff --git a/install.sh b/server/bin/installer.sh similarity index 69% rename from install.sh rename to server/bin/installer.sh index 803fccd0..c80ced34 100644 --- a/install.sh +++ b/server/bin/installer.sh @@ -1,26 +1,8 @@ #!/bin/bash -# scanservjs installation script for Debian and Ubuntu - +# scanservjs installer script for Debian and Ubuntu # Usage: - -# curl -s https://github.com/sbs20/scanservjs/blob/master/install.sh | sudo bash -s -i - -# This script will install the bare minimum for scanservjs to work. It will -# install sane-utils but not sane - you may have your sane backend running on -# another server. It will not install sane-airscan either. - -# To do this then run - -# ``` -# apt-get update -# apt-get install -yq curl gpg tee -# echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list -# curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null -# apt-get install -yq \ -# sane \ -# sane-airscan -# ``` +# curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- tmp="/tmp/scanservjs" location="/var/www/scanservjs" @@ -33,30 +15,6 @@ assert_root() { } install() { - - cat << EOF -This script will install scanservjs from https://github.com/sbs20/scanservjs -with the bare minimum for it to work. It will install sane-utils but not sane, -as you may have your sane backend running on another server. It will not install -sane-airscan either. For more information see the source of this script on -github. - -It will: - -* run apt-get update -* install SANE, node and imagemagick dependencies -* create the web application in /var/www/scanservjs -* create a user and systemd service which is enabled and started - -Do you want to continue? [y/N]: -EOF - read do_install - - if [ "y" != "$do_install" ]; then - echo "Abort." - exit 0 - fi - # minimum dependencies apt-get update apt-get install -yq \ @@ -170,6 +128,53 @@ hard_uninstall() { tesseract-ocr } +print_help() { + cat << EOF + +scanservjs: https://github.com/sbs20/scanservjs + +# Overview +========== +This script will install or remove scanservjs with the bare minimum for it to +work. If you are installing then it will add sane-utils but not sane, as you may +have your sane backend running on another server. It will not install +sane-airscan either. + +If you want to install sane and airscan then run the following: + + apt-get update + apt-get install -yq curl gpg tee + echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list + curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null + apt-get install -yq \ + sane \ + sane-airscan + +# Install +========= + * run apt-get update + * install SANE, node and imagemagick dependencies + * create the web application in /var/www/scanservjs + * create a user and systemd service which is enabled and started + +# Uninstall +=========== + * Remove the user and systemd service + +# Arguments +=========== + usage: + -i | --install : install scanservjs + -u | --uninstall : uninstall scanservjs (leaves web and data files) + --force-uninstall : uninstall scanservjs (removes all dependencies - dragons here) + +# Running via curl + +If you just ran this from curl and want to install, then just append '-i' to +your previous command +EOF +} + # main assert_root @@ -184,13 +189,10 @@ case "$1" in uninstall hard_uninstall ;; + -h|--help) + print_help + ;; *) - cat << EOF -Unknown argument -usage: - -i | --install : install scanservjs - -u | --uninstall : uninstall scanservjs (leaves web and data files) - --force-uninstall : uninstall scanservjs (removes all dependencies - dragons here) -EOF + print_help ;; esac diff --git a/server/bin/uninstall.sh b/server/bin/uninstall.sh deleted file mode 100644 index e6730423..00000000 --- a/server/bin/uninstall.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Check we have the necessary privileges -ROOTUID="0" -if [ "$(id -u)" -ne "$ROOTUID" ] ; then - echo "Error: This script must be executed with root privileges. Try sudo." - exit 1 -fi - -scansrvjs_home=/var/www/scanservjs - -# Stop and dsiable service -systemctl stop scanservjs -systemctl disable scanservjs - -# Remove service definition and reload -rm /etc/systemd/system/scanservjs.service -systemctl daemon-reload - -# Remove all files -rm -r $scansrvjs_home - -# Remove user -userdel -r scanservjs diff --git a/server/gulpfile.js b/server/gulpfile.js index 338626e9..2d58edce 100644 --- a/server/gulpfile.js +++ b/server/gulpfile.js @@ -36,8 +36,7 @@ gulp.task('server-build', () => { const shellFilter = filter('**/*.sh', {restore: true}); const common = gulp.src([ - './bin/install.sh', - './bin/uninstall.sh', + './bin/installer.sh', './bin/scanservjs.service', './package.json', './package-lock.json', From add7da63fe1b15f4072184d052d5d30c55401573 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sat, 10 Apr 2021 17:57:28 +0100 Subject: [PATCH 11/16] Installer #178 --- server/bin/installer.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/bin/installer.sh b/server/bin/installer.sh index c80ced34..34f3495c 100644 --- a/server/bin/installer.sh +++ b/server/bin/installer.sh @@ -171,7 +171,10 @@ If you want to install sane and airscan then run the following: # Running via curl If you just ran this from curl and want to install, then just append '-i' to -your previous command +your previous command so it looks like: + + curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- -i + EOF } From b6521905ffbeea95bf7224609bbbf2656c20d4b4 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sun, 11 Apr 2021 09:35:38 +0100 Subject: [PATCH 12/16] localisation fr #179 #154 --- webui/src/classes/constants.js | 1 + webui/src/locales/fr.json | 89 ++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 webui/src/locales/fr.json diff --git a/webui/src/classes/constants.js b/webui/src/classes/constants.js index b348e52b..1ed10ec8 100644 --- a/webui/src/classes/constants.js +++ b/webui/src/classes/constants.js @@ -7,6 +7,7 @@ const Constants = { 'de', 'en', 'es', + 'fr', 'it', 'test' ], diff --git a/webui/src/locales/fr.json b/webui/src/locales/fr.json new file mode 100644 index 00000000..b13cfaef --- /dev/null +++ b/webui/src/locales/fr.json @@ -0,0 +1,89 @@ +{ + "global": { + "application-name": "scanservjs" + }, + + "about": { + "main": "scanservjs est une simple interface web pour votre scanner. Cette interface permet de partager un ou plusieurs scanners (utilisant SANE) sur un réseau sans avoir besoin de drivers ou d'installation complexe.Cela permet de sauvegarder les images scannées dans les formats de fichiers TIF, JPG, PNG, PDF et TXT (avec Tesseract OCR) avec des compressions paramétrables. Cela supporte les scans avec plusieurs pages et tout matériel compatible avec SANE.", + "issue": "Signaler un problème ou afficher le code source:" + }, + + "batch-dialog": { + "btn-finish": "Finish", + "btn-rescan": "Rescan page", + "btn-next": "Suivant" + }, + + "files": { + "filename": "Nom de fichier", + "date": "Date", + "size": "Taille", + "message:deleted": "Supprimé" + }, + + "navigation": { + "scan": "Scan", + "files": "Fichier", + "settings": "Paramètres", + "about": "A propos", + "version": "Version" + }, + + "pipeline": { + "high-quality": "Qualité élevée", + "medium-quality": "Qualité moyenne", + "low-quality": "Qualité basse", + "uncompressed": "Décompressé", + "lzw-compressed": "Compression LZW", + "ocr": "OCR", + "text-file": "Fichier texte" + }, + + "scan": { + "device": "Appareil", + "source": "Source", + "resolution": "Résolution", + "mode": "Mode", + "dynamic-lineart": "Dynamic Lineart", + "dynamic-lineart:enabled": "Activé", + "dynamic-lineart:disabled": "Désactivé", + "batch": "Scan groupé", + "batch:none": "Sans", + "batch:manual": "Manuel (avec popup)", + "batch:auto": "Auto (Chargeur de documents)", + "batch:auto-collate-standard": "Assemblage auto (Standard 1, 3... 4, 2)", + "batch:auto-collate-reverse": "Assemblage auto (Inversé 1, 3... 2, 4)", + "filters": "Filtres", + "filters:auto-level": "Automatique", + "filters:threshold": "Seuil", + "filters:blur": "Flou", + "format": "Format", + "btn-preview": "Pré-visualiser", + "btn-clear": "Effacer", + "btn-scan": "Scanner", + "btn-reset": "Réinitialiser", + "top": "Haut", + "left": "Gauche", + "width": "Largeur", + "height": "Hauteur", + "brightness": "Luminosité", + "contrast": "Contraste", + "message:loading-devices": "Chargement des scanners...", + "message:no-devices": "Aucun scanner trouvé", + "message:deleted-preview": "Prévisualisation effacée", + "message:turn-documents": "Tournez votre document", + "message:preview-of-page": "Prévisualisation de la page" + }, + + "settings": { + "title": "@:navigation.settings", + "behaviour-ui": "Comportement et interface utilisateur", + "locale": "Langue", + "locale:description": "Sélection de la langue", + "theme": "Thème", + "theme:description": "Theme. Si vous utilisez le thème de votre système d'exploitation et que vous changez le paramètre, vous devrez recharger l'application", + "theme:system": "Système", + "theme:light": "Clair", + "theme:dark": "Sombre" + } +} From 8ecc8d744423d78ed9c2a6f521b8f8610b6665a9 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sun, 11 Apr 2021 10:27:01 +0100 Subject: [PATCH 13/16] Installer update #178 --- server/bin/installer.sh | 77 ++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/server/bin/installer.sh b/server/bin/installer.sh index 34f3495c..1af128bb 100644 --- a/server/bin/installer.sh +++ b/server/bin/installer.sh @@ -4,7 +4,7 @@ # Usage: # curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- -tmp="/tmp/scanservjs" +tmp="/tmp/scanservjs.bkp" location="/var/www/scanservjs" assert_root() { @@ -54,10 +54,21 @@ install() { fi mkdir -p $location - url=$(curl -s https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4) - curl -L $url | tar -zxf - -C $location/ - # Copy the files back + if [ "1" = "$auto" ]; then + url=$(curl -s https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4) + curl -L $url | tar -zxf - -C $location/ + + else + srcdir="$(cd "$(dirname "$0")" && pwd)" + if [ ! -e $srcdir/scanservjs.service ]; then + echo "Cannot find other package files. Did you mean to run --auto-install?" + exit 1; + fi + cp -rf $srcdir/* $location + fi + + # Restore files if [ -d "$tmp" ]; then cp -a -v $tmp/config $location/ cp -a -v $tmp/data $location/ @@ -135,27 +146,33 @@ scanservjs: https://github.com/sbs20/scanservjs # Overview ========== -This script will install or remove scanservjs with the bare minimum for it to -work. If you are installing then it will add sane-utils but not sane, as you may -have your sane backend running on another server. It will not install -sane-airscan either. + This script will install or remove scanservjs with the bare minimum for it to + work. If you are installing then it will add sane-utils but not sane, as you + may have your sane backend running on another server. It will not install + sane-airscan either. -If you want to install sane and airscan then run the following: + If you want to install sane and airscan then run the following: - apt-get update - apt-get install -yq curl gpg tee - echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list - curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null - apt-get install -yq \ - sane \ - sane-airscan + apt-get update + apt-get install -yq curl gpg tee + echo 'deb http://download.opensuse.org/repositories/home:/pzz/Debian_10/ /' | tee /etc/apt/sources.list.d/home:pzz.list + curl -fsSL https://download.opensuse.org/repositories/home:pzz/Debian_10/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home:pzz.gpg > /dev/null + apt-get install -yq \ + sane \ + sane-airscan + +# Auto-install +============== + Runs install but downloads the latest stable release from GitHub # Install ========= - * run apt-get update - * install SANE, node and imagemagick dependencies - * create the web application in /var/www/scanservjs - * create a user and systemd service which is enabled and started + Install runs through the following steps + + * run apt-get update + * install SANE, node and imagemagick dependencies + * create the web application in /var/www/scanservjs + * create a user and systemd service which is enabled and started # Uninstall =========== @@ -164,16 +181,17 @@ If you want to install sane and airscan then run the following: # Arguments =========== usage: - -i | --install : install scanservjs - -u | --uninstall : uninstall scanservjs (leaves web and data files) - --force-uninstall : uninstall scanservjs (removes all dependencies - dragons here) + -a | --auto-install : install scanservjs from GitHub + -i | --install : install scanservjs from local package + -u | --uninstall : uninstall scanservjs (leaves web and data files) + --force-uninstall : uninstall scanservjs (removes all dependencies - dragons here) # Running via curl +================== + If you just ran this from curl and want to install, then just append '-a' to + your previous command so it looks like: -If you just ran this from curl and want to install, then just append '-i' to -your previous command so it looks like: - - curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- -i + curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- -a EOF } @@ -182,7 +200,12 @@ EOF assert_root case "$1" in + -a|--auto-install) + auto=1 + install + ;; -i|--install) + auto=0 install ;; -u|--uninstall) From 38eee09272828b36b482fb6bf58432af9332e622 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sun, 11 Apr 2021 12:01:38 +0100 Subject: [PATCH 14/16] Documentation updates --- docs/docker.md | 16 ++++++++-------- docs/install.md | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index ed0aed78..c5592839 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -59,15 +59,15 @@ Depending on your setup you have a number of options. between boots. In these cases, you will probably find it easier to share the scanner over the network on the host. -* Driverless-mode scanning (using airscan over IPP-USB) also seems to result in +* Driverless-mode scanning (using airscan over IPP-USB) seems to result in problems. If anyone has ideas why (perhaps something additional needs sharing from host to guest) then suggestions are welcome. -* You need proprietary drivers for your scanner. Adding more backends to the - docker container feels wrong and will add bloat for many users who don't need - it. The best solution is either to create your own docker image based on the - scanservjs one and add it in that way, or to install the drivers on the host - and share it over the network. +* If you need proprietary drivers for your scanner then the best solution is + either to create your own docker image based on the scanservjs one and add it + in that way, or to install the drivers on the host and share it over the + network. Adding more backends to the docker container feels wrong and will add + cruft for many users who don't need it. * The best fallback position for many cases is simply to [share the host scanner over the network](https://github.com/sbs20/scanservjs/issues/129#issuecomment-800226184) @@ -87,8 +87,8 @@ The docker image which is created now runs under a non-privileged user account with a UID of `2001`. If you attempt to run as a user other than `2001` or `0` (e.g. `-u 1000`) then the process inside the container will no longer have access to some of the things it needs to and it will fail. Most of the time you -won't care about this, but if you're mapping volumes for either config or data, -then it may matter. +won't care about the user, but if you're mapping volumes for either config or +data, then it may matter. The solution in most cases is either to * change the group of the container to a known group on the host e.g. diff --git a/docs/install.md b/docs/install.md index aa3e6123..eca815c8 100644 --- a/docs/install.md +++ b/docs/install.md @@ -5,20 +5,28 @@ manually. ## Manual Steps -* Get [SANE installed and working](./sane.md) and check permissions etc. -* Get nodejs and npm installed (You will need an up to date version of npm, you - may need to run `npm install npm@latest -g`) -* Download the latest release of scanserv, extract it and run `install.sh` +* If you don't already have your scanner working, then you need to get + [SANE installed and working](./sane.md) and check permissions etc. Your + scanner can be attached to a different server / device if you're using saned. +* If you're using a debian based distro then you can just use the installer + script. But please note that this will install dependecies and needs to run as + root: + ```sh + curl -s https://raw.githubusercontent.com/sbs20/scanservjs/master/server/bin/installer.sh | sudo bash -s -- -a + ``` +* If you're using another distro, then for the time being you either need to + manually run the steps in the install script or use docker. -## tl;dr; (Debian 10) +## Download and install + +If you don't fancy running a script directly from `curl` then you can manually +download the package and then run the installer inside. ``` -sudo apt install -y nodejs npm sane-utils imagemagick curl -sudo npm install npm@latest -g wget -O ~/scanservjs.tar.gz $(curl -s https://api.github.com/repos/sbs20/scanservjs/releases/latest | grep browser_download_url | cut -d '"' -f 4) mkdir scanservjs tar -xf scanservjs.tar.gz -C ./scanservjs/ -sudo ./scanservjs/install.sh +sudo ./scanservjs/installer.sh -i rm scanservjs.tar.gz rm -r scanservjs ``` From 9de3e7ff58dc24a1283f9091cf6245b650d8d6ad Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sun, 11 Apr 2021 12:05:59 +0100 Subject: [PATCH 15/16] readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a383ab23..eda2f91f 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ complicated installation. * Configurable overrides for all defaults as well as filters and formats * Multipage scanning (with collation for double sided scans) * Light and dark mode -* **NEW**: International translations: Czech, German, Italian, Mandarin, Spanish - (**help requested**) +* **NEW**: International translations: Czech, French, German, Italian, Mandarin, + Spanish (**help requested**) It supports any [SANE compatible devices](http://www.sane-project.org/sane-supported-devices.html). From e4578a8eca36028af32d7e10a74eb65f0b7ee14d Mon Sep 17 00:00:00 2001 From: sbs20 Date: Sun, 11 Apr 2021 18:41:15 +0100 Subject: [PATCH 16/16] Fix docker permissions for appuser --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e76134f4..32ef4c3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,7 +61,7 @@ COPY --from=builder "$APP_DIR/dist" "$APP_DIR/" RUN npm install --production # Change the ownership of config and data since we need to write there -RUN chown -R scanservjs:scanservjs config data +RUN chown -R scanservjs:scanservjs config data /etc/sane.d/net.conf /etc/sane.d/airscan.conf USER scanservjs EXPOSE 8080