From 147f8f72a2b76f3118d7f28fe316a2c7e49412fe Mon Sep 17 00:00:00 2001 From: Tikitu de Jager Date: Fri, 19 Feb 2016 09:48:43 +0200 Subject: [PATCH] Simplify instructions for exporting with docker The export workflow reusing the `/consume` volume is complex and error- prone, and not at all necessary if the `docker-compose.yml` file has a volume for `/export` from the beginning. --- docker-compose.yml.example | 6 ++++ docs/migrating.rst | 70 ++++++++++++++------------------------ 2 files changed, 31 insertions(+), 45 deletions(-) diff --git a/docker-compose.yml.example b/docker-compose.yml.example index f8e9b5b93..7e3557aa8 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -23,6 +23,12 @@ services: # You have to adapt the local path you want the consumption # directory to mount to by modifying the part before the ':'. - /path/to/arbitrary/place:/consume + # Likewise, you can add a local path to mount a directory for + # exporting. This is not strictly needed for paperless to + # function, only if you're exporting your files: uncomment + # it and fill in a local path if you know you're going to + # want to export your documents. + # - /path/to/another/arbitrary/place:/export env_file: docker-compose.env command: ["document_consumer"] diff --git a/docs/migrating.rst b/docs/migrating.rst index 1e03bb3cb..491eeace4 100644 --- a/docs/migrating.rst +++ b/docs/migrating.rst @@ -74,57 +74,37 @@ as JSON is almost as easy: $ docker-compose run --rm webserver dumpdata documents.Tag > /path/to/arbitrary/place/tags.json -Exporting the documents though is a little more involved, since docker-compose -doesn't support mounting additional volumes with the ``run`` command. You have -three general options: +To export the documents you can either use ``docker run`` directly, specifying all +the commandline options by hand, or (more simply) mount a second volume for export. -1. Use the consumption directory if you happen to already have it mounted to a - host directory. +To mount a volume for exports, follow the instructions in the +``docker-compose.yml.example`` file for the ``/export`` volume (making the changes +in your own ``docker-compose.yml`` file, of course). Once you have the +volume mounted, the command to run an export is: - .. code-block:: console +.. code-block:: console - $ # Stop the consumer so that it doesn't consume the exported documents - $ docker-compose stop consumer - $ # Export into the consumption directory - $ docker-compose run --rm consumer document_exporter /consume + $ docker-compose run --rm consumer document_exporter /export -2. Add another volume to ``docker-compose.yml`` for exports and use - ``docker-compose run``: +If you prefer to use ``docker run`` directly, supplying the necessary commandline +options: - .. code-block:: diff - - diff --git a/docker-compose.yml b/docker-compose.yml - --- a/docker-compose.yml - +++ b/docker-compose.yml - @@ -17,9 +18,8 @@ services: - volumes: - - paperless-data:/usr/src/paperless/data - - paperless-media:/usr/src/paperless/media - - /consume - + - /path/to/arbitrary/place:/export - - .. code-block:: shell-session - - $ docker-compose run --rm consumer document_exporter /export - -3. Use ``docker run`` directly, supplying the necessary commandline options: - - .. code-block:: shell-session - - $ # Identify your containers - $ docker-compose ps - Name Command State Ports - ------------------------------------------------------------------------- - paperless_consumer_1 /sbin/docker-entrypoint.sh ... Exit 0 - paperless_webserver_1 /sbin/docker-entrypoint.sh ... Exit 0 +.. code-block:: shell-session - $ # Make sure to replace your passphrase and remove or adapt the id mapping - $ docker run --rm \ - --volumes-from paperless_data_1 \ - --volume /path/to/arbitrary/place:/export \ - -e PAPERLESS_PASSPHRASE=YOUR_PASSPHRASE \ - -e USERMAP_UID=1000 -e USERMAP_GID=1000 \ - paperless document_exporter /export + $ # Identify your containers + $ docker-compose ps + Name Command State Ports + ------------------------------------------------------------------------- + paperless_consumer_1 /sbin/docker-entrypoint.sh ... Exit 0 + paperless_webserver_1 /sbin/docker-entrypoint.sh ... Exit 0 + + $ # Make sure to replace your passphrase and remove or adapt the id mapping + $ docker run --rm \ + --volumes-from paperless_data_1 \ + --volume /path/to/arbitrary/place:/export \ + -e PAPERLESS_PASSPHRASE=YOUR_PASSPHRASE \ + -e USERMAP_UID=1000 -e USERMAP_GID=1000 \ + paperless document_exporter /export .. _migrating-restoring: