From owner-svn-ports-all@freebsd.org Thu Sep 17 12:04:41 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FCCE3DE262; Thu, 17 Sep 2020 12:04:41 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BsbHY1TzJz3dtY; Thu, 17 Sep 2020 12:04:41 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1254E9F1B; Thu, 17 Sep 2020 12:04:41 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08HC4e8n070202; Thu, 17 Sep 2020 12:04:40 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08HC4e6I070200; Thu, 17 Sep 2020 12:04:40 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <202009171204.08HC4e6I070200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 17 Sep 2020 12:04:40 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r548839 - in head/deskutils/py-paperless: . files X-SVN-Group: ports-head X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: in head/deskutils/py-paperless: . files X-SVN-Commit-Revision: 548839 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 12:04:41 -0000 Author: grembo Date: Thu Sep 17 12:04:40 2020 New Revision: 548839 URL: https://svnweb.freebsd.org/changeset/ports/548839 Log: Improve man page layout and make it compatible with man.cgi. Modified: head/deskutils/py-paperless/Makefile head/deskutils/py-paperless/files/paperless.7.in Modified: head/deskutils/py-paperless/Makefile ============================================================================== --- head/deskutils/py-paperless/Makefile Thu Sep 17 11:49:34 2020 (r548838) +++ head/deskutils/py-paperless/Makefile Thu Sep 17 12:04:40 2020 (r548839) @@ -2,7 +2,7 @@ PORTNAME= paperless PORTVERSION= 2.7.0 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= deskutils python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Modified: head/deskutils/py-paperless/files/paperless.7.in ============================================================================== --- head/deskutils/py-paperless/files/paperless.7.in Thu Sep 17 11:49:34 2020 (r548838) +++ head/deskutils/py-paperless/files/paperless.7.in Thu Sep 17 12:04:40 2020 (r548839) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 3, 2020 +.Dd September 17, 2020 .Dt PAPERLESS 7 .Os .Sh NAME @@ -105,79 +105,88 @@ can be tuned in the same configuration file to limit the impact on system performance. .Pp To use paperless, the consumer is enabled +.Bd -literal -offset indent +sysrc paperless_consumer_enable=YES +.Ed .Pp -.Dl "sysrc paperless_consumer_enable=YES" -.Pp and subsequently started +.Bd -literal -offset indent +service paperless-consumer start +.Ed .Pp -.Dl "service paperless-consumer start" -.Pp (which also creates/updates the paperless SQLite database). .Pp Therefore, restarting the consumer after updates +.Bd -literal -offset indent +service paperless-consumer restart +.Ed .Pp -.Dl "service paperless-consumer restart" -.Pp updates the database before starting the new program version. .Sh WEB UI SETUP Before using the web ui, make sure to create a super user and assign a password +.Bd -literal -offset indent +su -l paperless -c '%%PREFIX%%/bin/paperless createsuperuser' +.Ed .Pp -.Dl "su -l paperless -c '%%PREFIX%%/bin/paperless createsuperuser'" -.Pp It is recommended to host the web component using a real web server, e.g., nginx + uwsgi. .Pp Install and configure uwsgi: +.Bd -literal -offset indent +pkg install uwsgi +mkdir -p %%PREFIX%%/etc/uwsgi +cp %%EXAMPLESDIR%%/uwsgi.ini \\ + %%PREFIX%%/etc/uwsgi/paperless.ini +sysrc uwsgi_enable=YES +sysrc uwsgi_profiles+=paperless +sysrc uwsgi_paperless_socket_owner=paperless:www +sysrc uwsgi_paperless_uid=paperless +sysrc uwsgi_paperless_gid=paperless +sysrc uwsgi_paperless_configfile=%%PREFIX%%/etc/uwsgi/paperless.ini +.Ed .Pp -.Dl "pkg install uwsgi" -.Dl "mkdir -p %%PREFIX%%/etc/uwsgi" -.Dl "cp %%EXAMPLESDIR%%/uwsgi.ini \\" -.Dl " %%PREFIX%%/etc/uwsgi/paperless.ini" -.Dl "sysrc uwsgi_enable=YES" -.Dl "sysrc uwsgi_profiles+=paperless" -.Dl "sysrc uwsgi_paperless_socket_owner=paperless:www" -.Dl "sysrc uwsgi_paperless_uid=paperless" -.Dl "sysrc uwsgi_paperless_gid=paperless" -.Dl "sysrc uwsgi_paperless_configfile=%%PREFIX%%/etc/uwsgi/paperless.ini" -.Pp Start the uwsgi process: +.Bd -literal -offset indent +service uwsgi start paperless +.Ed .Pp -.Dl "service uwsgi start paperless" -.Pp Install nginx: +.Bd -literal -offset indent +pkg install nginx +.Ed .Pp -.Dl "pkg install nginx" -.Pp Create a basic server configuration ( .Pa %%PREFIX%%/etc/nginx/nginx.conf ), example snippet: +.Bd -literal -offset indent +server { + listen 80; + server_name localhost; + + location /static/ { + alias %%WWWDIR%%/static/; + } + + location / { + uwsgi_pass unix:/tmp/uwsgi-paperless.sock; + include uwsgi_params; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root %%PREFIX%%/www/nginx-dist; + } +} +.Ed .Pp -.Dl "server {" -.Dl " listen 80;" -.Dl " server_name localhost;" -.Dl "" -.Dl " location /static/ {" -.Dl " alias %%WWWDIR%%/static/;" -.Dl " }" -.Dl "" -.Dl " location / {" -.Dl " uwsgi_pass unix:/tmp/uwsgi-paperless.sock;" -.Dl " include uwsgi_params;" -.Dl " }" -.Dl "" -.Dl " error_page 500 502 503 504 /50x.html;" -.Dl " location = /50x.html {" -.Dl " root %%PREFIX%%/www/nginx-dist;" -.Dl " }" -.Dl "}" -.Pp Enable and start nginx: +.Bd -literal -offset indent +sysrc nginx_enable=YES +service nginx start +.Ed .Pp -.Dl "sysrc nginx_enable=YES" -.Dl "service nginx start" -.Pp -.Em \In the real world, nginx should be configured to use TLS +.Em \In a real world setup, nginx should be configured to use TLS .Em and (potentially) client certificates . .Sh SFTP SETUP Setting up @@ -193,40 +202,45 @@ In case paperless is using a dedicated instance of access can be limited to the paperless user by adding these lines to .Pa /etc/ssh/sshd_config : +.Bd -literal -offset indent +# Only include if sshd is dedicated to paperless +# otherwise you'll lock yourself out +AllowUsers paperless +.Ed .Pp -.Dl "# Only include if sshd is dedicated to paperless" -.Dl "# otherwise you'll lock yourself out" -.Dl "AllowUsers paperless" -.Pp The following block limits the paperless user to using the .Xr sftp 1 protocol and locks it into the consume directory: +.Bd -literal -offset indent +# paperless can only do sftp and is dropped into correct directory +Match User paperless + ChrootDirectory %h/consume + ForceCommand internal-sftp -u 0077 -d /input + AllowTcpForwarding no + X11Forwarding no + PasswordAuthentication no +.Ed .Pp -.Dl "# paperless can only do sftp and is dropped into correct directory" -.Dl "Match User paperless" -.Dl " ChrootDirectory %h/consume" -.Dl " ForceCommand internal-sftp -u 0077 -d /input" -.Dl " AllowTcpForwarding no" -.Dl " X11Forwarding no" -.Dl " PasswordAuthentication no" -.Pp The public keys of authorized users/devices need to be added to .Pa /var/db/paperless/.ssh/authorized_keys : +.Bd -literal -offset indent +mkdir -p /var/db/paperless/.ssh +cat path/to/pubkey >>/var/db/paperless/.ssh/authorized_keys +.Ed .Pp -.Dl "mkdir -p /var/db/paperless/.ssh" -.Dl "cat path/to/pubkey >>/var/db/paperless/.ssh/authorized_keys" -.Pp Make sure .Xr sshd 8 is enabled and restart (or reload) it: +.Bd -literal -offset indent +sysrc sshd_enable=YES +service sshd restart +.Ed .Pp -.Dl "sysrc sshd_enable=YES" -.Dl "service sshd restart" -.Pp The user will be dropped into the correct directory, so uploading a file is as simple as: -.Pp -.Dl "echo put file.pdf | sftp -b - paperless@host" +.Bd -literal -offset indent +echo put file.pdf | sftp -b - paperless@host +.Ed .Sh FILES .Bl -tag -width ".Pa %%PREFIX%%/etc/paperless.conf" -compact .It Pa %%PREFIX%%/etc/paperless.conf