A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Updated the Vagrant tools to use environment variables
Daniel Quinndd3bdcb95688
diff --git a/docs/changelog.rst b/docs/changelog.rstindex 5b8029780..ce2a4edab 100644--- a/docs/changelog.rst+++ b/docs/changelog.rst@@ -3,6 +3,8 @@ Changelog* 0.1.1 (master)+ * Refactored the Vagrant installation process to use environment variables+ rather than asking the user to modify ``settings.py``.* `#44`_: Harmonise environment variable names with constant names.* `#60`_: Setup logging to actually use the Python native logging framework.* `#53`_: Fixed an annoying bug that caused ``.jpeg`` and ``.JPG`` imagesdiff --git a/docs/setup.rst b/docs/setup.rstindex be8a349d8..077ce135c 100644--- a/docs/setup.rst+++ b/docs/setup.rst@@ -98,27 +98,31 @@ Vagrant Method2. Run ``vagrant up``. An instance will start up for you. When it's ready andprovisioned...3. Run ``vagrant ssh`` and once inside your new vagrant box, edit- ``/opt/paperless/src/paperless/settings.py`` and set the values for:- * ``CONSUMPTION_DIR``: this is where your documents will be dumped to be- consumed by Paperless.- * ``PASSPHRASE``: this is the passphrase Paperless uses to encrypt/decrypt- the original document. The default value attempts to source the- passphrase from the environment, so if you don't set it to a static value- here, you must set ``PAPERLESS_PASSPHRASE=some-secret-string`` on the- command line whenever invoking the consumer or webserver.-4. Initialise the database with ``/opt/paperless/src/manage.py migrate``.-5. Still inside your vagrant box, create a user for your Paperless instance with- ``/opt/paperless/src/manage.py createsuperuser``. Follow the prompts to+ ``/etc/paperless.conf`` and set the values for:+ * ``PAPERLESS_CONSUMPTION_DIR``: this is where your documents will be+ dumped to be consumed by Paperless.+ * ``PAPERLESS_PASSPHRASE``: this is the passphrase Paperless uses to+ encrypt/decrypt the original document.+ * ``PAPERLESS_SHARED_SECRET``: this is the "magic word" used when consuming+ documents from mail or via the API. If you don't use either, leaving it+ blank is just fine.+4. Exit the vagrant box and re-enter it with ``vagrant ssh`` again. This+ updates the environment to make use of the changes you made to the config+ file.+5. Initialise the database with ``/opt/paperless/src/manage.py migrate``.+6. Still inside your vagrant box, create a user for your Paperless instance+ with ``/opt/paperless/src/manage.py createsuperuser``. Follow the prompts tocreate your user.-6. Start the webserver with ``/opt/paperless/src/manage.py runserver 0.0.0.0:8000``.- You should now be able to visit your (empty) `Paperless webserver`_ at- ``172.28.128.4:8000``. You can login with the user/pass you created in #5.-7. In a separate window, run ``vagrant ssh`` again, but this time once inside+7. Start the webserver with+ ``/opt/paperless/src/manage.py runserver 0.0.0.0:8000``. You should now be+ able to visit your (empty) `Paperless webserver`_ at ``172.28.128.4:8000``.+ You can login with the user/pass you created in #6.+8. In a separate window, run ``vagrant ssh`` again, but this time once insideyour vagrant instance, you should start the consumer script with``/opt/paperless/src/manage.py document_consumer``.-8. Scan something. Put it in the ``CONSUMPTION_DIR``.-9. Wait a few minutes-10. Visit the document list on your webserver, and it should be there, indexed+9. Scan something. Put it in the ``CONSUMPTION_DIR``.+10. Wait a few minutes+11. Visit the document list on your webserver, and it should be there, indexedand downloadable... _Vagrant: https://vagrantup.com/@@ -158,11 +162,11 @@ Docker Method3. Create a copy of ``docker-compose.yml.example`` as ``docker-compose.yml`` anda copy of ``docker-compose.env.example`` as ``docker-compose.env``. You'll be- editing both these files: taking a copy ensures that you can ``git pull`` to- receive updates without risking merge conflicts with your modified versions+ editing both these files: taking a copy ensures that you can ``git pull`` to+ receive updates without risking merge conflicts with your modified versionsof the configuration files.4. Modify ``docker-compose.yml`` to your preferences, following the instructions- in comments in the file. The only change that is a hard requirement is to+ in comments in the file. The only change that is a hard requirement is tospecify where the consumption directory should mount.5. Modify ``docker-compose.env`` and adapt the following environment variables:diff --git a/scripts/vagrant-provision b/scripts/vagrant-provisionindex aa6ca5e14..c746e7fc1 100644--- a/scripts/vagrant-provision+++ b/scripts/vagrant-provision@@ -1,13 +1,55 @@#!/bin/bash-# install packages-sudo apt-get update-sudo apt-get build-dep -y python-imaging-sudo apt-get install -y libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev-sudo apt-get install -y build-essential python3-dev python3-pip sqlite3 libsqlite3-dev git-sudo apt-get install -y tesseract-ocr tesseract-ocr-eng imagemagick--# setup python project-pushd /opt/paperless-sudo pip3 install -r requirements.txt-popd+# Install packages+apt-get update+apt-get build-dep -y python-imaging+apt-get install -y libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev+apt-get install -y build-essential python3-dev python3-pip sqlite3 libsqlite3-dev git+apt-get install -y tesseract-ocr tesseract-ocr-eng imagemagick++# Python dependencies+pip3 install -r /opt/paperless/requirements.txt++# Create the environment file+echo "+# This where your documents should go to be consumed. Make sure that it exists+# before you start Paperless.+export PAPERLESS_CONSUMPTION_DIR='/home/vagrant/consumption'++# This is the secret passphrase used to encrypt the documents once they have+# been consumed. Change it to whatever you like, but you shouldn't change it+# after it has been used to consume a document or you won't be able to read+# that document again.+export PAPERLESS_PASSPHRASE='secret'++# This is the secret string used to verify PDFs sent by mail or consumed via+# the API. If you don't plan to use either of these, you can safely leave it+# blank+export PAPERLESS_SHARED_SECRET=''+" > /tmp/paperless.conf+chmod 0640 /tmp/paperless.conf+chown root:vagrant /tmp/paperless.conf+mv /tmp/paperless.conf /etc/++# Create the consumption directory+mkdir /home/vagrant/consumption+chown vagrant:vagrant /home/vagrant/consumption++# Create environment wrapper+echo "+++# Setup the paperless environment variables+. /etc/paperless.conf+" >> /home/vagrant/.bashrc++echo "+++Now follow the remaining steps in the Vagrant section of the setup+documentation to complete the process:++http://paperless.readthedocs.org/en/latest/setup.html#setup-installation-vagrant+++"