Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| services:scanservjs [2024/08/30 12:52] – willy | services:scanservjs [2024/08/30 13:24] (current) – [ScanServJS] willy | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== ScanServJS ====== | ====== ScanServJS ====== | ||
| - | [[https://github.com/sbs20/ | + | At first i tried to make **saned** work, the great network extension to Sane scan tool for Linux. Unfortunately it turns out that the scanner i own (a MFD HP Laser printer/scanner) cannot be shared with saned over the network because the HP provided driver does not allow it. Frankly it seems more an oversight |
| - | emerge -vp app-arch/deb2targz | + | Luckly, [[https:// |
| - | mkdir / | + | ===== Prerequisites ===== |
| - | chown saned: | + | |
| - | as user saned | + | ScanServJs require, of course, sane-backends package to be installed and your scanners to be configured to work locally on the server. I will not cover those steps here, i assume your scanner is already properly configured and can scan with the **saned** user on the server. |
| - | sudo -u saned bash | + | You must install **nodejs** and the **deb2targz** packages, because ScanServJS is deployed as a DEB package and requires NodeJS to run. |
| - | cd / | + | |
| - | wget ... https://github.com/ | + | So, if you don't already have them: |
| + | <code bash> | ||
| + | emerge -vp app-arch/deb2targz nodejs | ||
| + | </code> | ||
| + | Also, you might want to install **tesseract** to enable OCR functionalities. | ||
| - | deb2targz scanservjs_3.0.3-1_all.deb | ||
| - | tar xvf scanservjs_3.0.3-1_all.tar.xz | + | ===== Installation ===== |
| + | You will need to alter a little bit the content of the DEB package, because it's better to install it on **/ | ||
| + | <code bash> | ||
| + | mkdir / | ||
| + | chown saned: | ||
| + | </ | ||
| + | |||
| + | And then now, as user **saned**: | ||
| + | <code bash> | ||
| + | sudo -u saned bash | ||
| + | cd / | ||
| + | wget https:// | ||
| + | deb2targz scanservjs_X.Y.Z-1_all.deb | ||
| + | tar xvf scanservjs_X.Y.Z-1_all.tar.xz | ||
| cd usr/ | cd usr/ | ||
| + | </ | ||
| + | Now, since the DEB package assumes it's installed on **/usr** you need to recreate two symlinks: | ||
| + | <code bash> | ||
| rm config | rm config | ||
| ln -s / | ln -s / | ||
| rm data | rm data | ||
| ln -s / | ln -s / | ||
| + | </ | ||
| - | edit etc/ | + | Now move the default config file from **/ |
| - | fix path on first line | + | <file - config.local.js> |
| const options = { paths: ['/ | const options = { paths: ['/ | ||
| config.host = ' | config.host = ' | ||
| config.port = 7781; | config.port = 7781; | ||
| - | | + | |
| + | config.convert = '/ | ||
| + | ... [ omissis ] ... | ||
| + | </ | ||
| + | |||
| + | And that's it! | ||
| + | |||
| + | ===== NGINX configuration ===== | ||
| + | |||
| + | I choose to install ScanServJS as a sub-path of my **home.mydomain.com**, | ||
| + | <file - scanner.conf> | ||
| + | |||
| + | location = /scanner { | ||
| + | return 301 https:// | ||
| + | } | ||
| + | |||
| + | # Interfaccia Web stmapante HP | ||
| + | location /scanner/ { | ||
| + | proxy_pass http:// | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | For more details, see [[selfhost: | ||
| + | |||
| + | And restart your NGINX service. | ||
| + | |||
| + | |||
| + | ===== Start and Autostart ===== | ||
| + | |||
| + | Since i use OpenRC, just drop the following **/ | ||
| + | <file - scanservjs> | ||
| + | # | ||
| + | # Copyright 1999-2021 Gentoo Authors | ||
| + | # Distributed under the terms of the GNU General Public License v2 | ||
| + | |||
| + | description=" | ||
| + | pidfile="/ | ||
| + | command_background=true | ||
| + | command=" | ||
| + | command_args="" | ||
| + | command_user=" | ||
| + | |||
| + | depend() { | ||
| + | need net | ||
| + | } | ||
| + | |||
| + | start_pre() | ||
| + | { | ||
| + | cd / | ||
| + | export NODE_ENV=production | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | make it executable and add it to the default runlevel: | ||
| + | <code bash> | ||
| + | chmod +x / | ||
| + | rc-update add / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Update ===== | ||
| - | node / | + | Get new DEB, replace files, restart! |