Code Monkey home page Code Monkey logo

ppngx's Introduction

ppngx: Podman + Paperless-ngx

This is a quick script for setting up Paperless-ngx with Rootless Podman inside a Podman Pod.

It will launch Redis, PostgreSQL, Tika, Gotenberg, SFTPGo and Paperless-ngx inside a self-contained pod. I was able to get this working with Brother ADS2800w and SFTP to SFTPGo. Good luck!

If you want to have a VM runs Paperless-ngx, check out my other project which can be used to run everything on Fedora CoreOS.

https://github.com/quickvm/fcos-layer-paperless-ngx

Setup

  1. Ensure jq and podman packages are installed (ex dnf install jq podman)
  2. Clone this repository
  3. cd ppngx
  4. Edit start.sh and customize at least these variables:
PAPERLESS_TIME_ZONE=America/Chicago
PAPERLESS_OCR_LANGUAGE=eng
SFTPGO_ADMIN_PASSWORD=supersecret
SFTPGO_PAPERLESS_PASSWORD=anothersupersecret
PAPERLESS_SECRET_KEY=chamgemechamgemechamgemechamgemechamgemechamgemechamgemechamgeme
POSTGRESQL_PASSWORD=paperlesschangeme
  1. Run ./start.sh
  2. Wait a bit and make sure http://localhost:8000 is loading paperless.
  3. Add a superuser to paperless-ngx with:
podman exec -it paperless-webserver python manage.py createsuperuser
  1. If you are going to send documents via SFTP use the scanner and password set in SFTPGO_PAPERLESS_PASSWORD. Some scanners need the RSA Public key from SFTPGo. It is output by the script and written out to a file ${PWD}/sftp_rsa_host_key.pub. Also, most scanners are using older versions of OpenSSH so you might need to adjust SFTPGO_SFTPD__KEX_ALGORITHMS and SFTPGO_SFTPD__HOST_KEY_ALGORITHMS to match the right key algorithms so they can connect as clients to SFTPGo. For example my Brother ADS2800w need the following set to work with the latest version of SFTPGo (v2.5.4).
SFTPGO_SFTPD__KEX_ALGORITHMS=curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
SFTPGO_SFTPD__HOST_KEY_ALGORITHMS=rsa-sha2-256,rsa-sha2-512,ecdsa-sha2-nistp256,ssh-ed25519,ssh-rsa

Updating

The most straightforward methodology is to pull the latest image you care about and re-run start.sh. For example:

podman pull ghcr.io/paperless-ngx/paperless-ngx:latest
./start.sh

This will pull the latest image, and assuming your PAPERLESS_VERSION specified in start.sh is latest, will rebuild the pod with the latest versions.

Autostart with systemd

Rootless Podman The script by default assumes you are going to run this as a rootless user. Run loginctl enable-linger $USER so the systemd user instance can be started at boot and kept running even after the user logs out.

  1. Make sure Paperless-ngx is running via start.sh
  2. If it doesn't already exist: mkdir -p ${HOME}/.config/systemd/user
  3. cd ${HOME}/.config/systemd/user
  4. podman generate systemd --new --files --container-prefix='' --name paperless
  5. systemctl daemon-reload --user
  6. podman pod stop paperless
  7. podman pod rm paperless
  8. systemctl enable --user --now pod-paperless.service

Rootfull Podman If you want to run this via systemd as the root user, remove USERMAP_GUID and USERMAP_GID env vars from paperless-webserver before you run start.sh. You will also want to run this script as the root user.

  1. Make sure Paperless-ngx is running via start.sh
  2. cd /etc/systemd/system
  3. podman generate systemd --new --files --container-prefix='' --name paperless
  4. systemctl daemon-reload
  5. podman pod stop paperless
  6. podman pod rm paperless
  7. systemctl enable --now pod-paperless.service

Making changes to your units

Note: If you make changes to start.sh after generating the systemd units you will need to do the following to update the units:

  1. Make your changes to start.sh
  2. systemctl stop --user pod-paperless.service
  3. Make sure Paperless-ngx is running via start.sh
  4. cd ${HOME}/.config/systemd/user
  5. rm -rf paperless-* pod-paperless.service
  6. podman generate systemd --new --files --container-prefix='' --name paperless
  7. systemctl daemon-reload --user
  8. podman pod stop paperless (stops paperless that was started by start.sh)
  9. podman pod rm paperless (removes the paperless pod created by start.sh)
  10. systemctl enable --user --now pod-paperless.service

Or you can edit the systemd unit files directly with your changes and run systemctl daemon-reload --user and then run systemctl restart --user pod-paperless.service.

Backing up

backup.sh is an example generic backup script that will export the required pod volumes, and store the paperless version number. You might want to also backup your modified start.sh as well.

This can either be ran manually as desired or (ideally), as a cron job/whatever.

License

MIT License

Copyright (c) 2022 Joe Doss

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ppngx's People

Contributors

jdoss avatar matthewbregg avatar runningferret avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ppngx's Issues

Advantage of using podman

Hello,

Just tried your ppngx script which is great, works good on RHEL 9 ;)

Since `podman-compose exists, one can adapt the paperless-ngx original install script to run without too much hassle.
I am using podman whenever I can because of the EL ecosystem.

What's the advantage of your script over the original docker-compose setup ?
I do like systemd unit files too for containers, since it makes things "manageable" and easily monitorable.

Are there any other nice advantages I didn't realise ?
Best regards.

login uname & pword?

First thing first - thank you for this little script which has made my life much more straight forward than it might have been!

But, I realise this is not a complicated question and I'm sure I should be able to answer it:-
What is the default username and password for Paperless?
image
I'm having no difficulty with the interface for SFTPGo and the credentials I entered in start.sh - on both ports 2022 and 8022 or accessing the Paperless server, but what's the login? Should I have added the PAPERLESS_ADMIN_USER and PAPERLESS_ADMIN_PASSWORD to start.sh?

Web login

First off, great script and I'm not sure if this is an issue or not. But I don't see where in your script you are configuring the web "superuser" so you can log into the site.

Problem when trying to autostart in rootless mode

I am following the instruction that you provide to have systemd autostarting Paperless on boot. However, I received first a deprecation warning when running podman generate systemd --new --files --container-prefix='' --name paperless:

DEPRECATED command:
It is recommended to use Quadlets for running containers and pods under systemd.

And then, when running systemctl enable --user --now pod-paperless.service I get the following error:

Job for pod-paperless.service failed because the service did not take the steps required by its unit configuration.
See "systemctl --user status pod-paperless.service" and "journalctl --user -xeu pod-paperless.service" for details.

Any idea on what could be the problem?

I cannot set environment variable

I am trying to set the following environment variable with its value:

PAPERLESS_OCR_USER_ARGS={"invalidate_digital_signatures": true}

I need to import many digitally signed documents, so I need to tell the system to just invalidate the signatures. If I have properly understood from my readings, this will keep also a copy of the original, so I should be able to consult my documents and still keep them valid.

Any way, I was trying to set the environment variable with the -e option in you start.sh script, but I am not able to make it work.

I am just adding the line within the Starting paperless block. What am I doing wrong for it to not set the environment variable?

Autostart with systemd DEPRECATED command

Tested on Debian 12 Proxmox VM

podman generate systemd --new --files --container-prefix='' --name paperless

DEPRECATED command:
It is recommended to use Quadlets for running containers and pods under systemd.

Please refer to podman-systemd.unit(5) for details.
/root/.config/systemd/user/pod-paperless.service
/root/.config/systemd/user/paperless-postgresql.service
/root/.config/systemd/user/paperless-redis.service
/root/.config/systemd/user/paperless-sftpgo.service
/root/.config/systemd/user/paperless-tika.service
/root/.config/systemd/user/paperless-webserver.service
/root/.config/systemd/user/paperless-gotenberg.service

Do you have a particular back up plan?

Hi!

Thanks for this script, it's been working pretty well!

I was wondering what you did to back up.

I was thinking of either running the document exporter, or backing up each podman volume + the version.

I was wondering what you did, and if you had a script for it?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.