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.
This commit is contained in:
Tikitu de Jager 2016-02-19 09:48:43 +02:00
parent ec88ea73f6
commit 147f8f72a2
2 changed files with 30 additions and 44 deletions

View File

@ -23,6 +23,12 @@ services:
# You have to adapt the local path you want the consumption # You have to adapt the local path you want the consumption
# directory to mount to by modifying the part before the ':'. # directory to mount to by modifying the part before the ':'.
- /path/to/arbitrary/place:/consume - /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 env_file: docker-compose.env
command: ["document_consumer"] command: ["document_consumer"]

View File

@ -74,57 +74,37 @@ as JSON is almost as easy:
$ docker-compose run --rm webserver dumpdata documents.Tag > /path/to/arbitrary/place/tags.json $ 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 To export the documents you can either use ``docker run`` directly, specifying all
doesn't support mounting additional volumes with the ``run`` command. You have the commandline options by hand, or (more simply) mount a second volume for export.
three general options:
1. Use the consumption directory if you happen to already have it mounted to a To mount a volume for exports, follow the instructions in the
host directory. ``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 run --rm consumer document_exporter /export
$ docker-compose stop consumer
$ # Export into the consumption directory
$ docker-compose run --rm consumer document_exporter /consume
2. Add another volume to ``docker-compose.yml`` for exports and use If you prefer to use ``docker run`` directly, supplying the necessary commandline
``docker-compose run``: options:
.. code-block:: diff .. code-block:: shell-session
diff --git a/docker-compose.yml b/docker-compose.yml $ # Identify your containers
--- a/docker-compose.yml $ docker-compose ps
+++ b/docker-compose.yml Name Command State Ports
@@ -17,9 +18,8 @@ services: -------------------------------------------------------------------------
volumes: paperless_consumer_1 /sbin/docker-entrypoint.sh ... Exit 0
- paperless-data:/usr/src/paperless/data paperless_webserver_1 /sbin/docker-entrypoint.sh ... Exit 0
- paperless-media:/usr/src/paperless/media
- /consume
+ - /path/to/arbitrary/place:/export
.. code-block:: shell-session $ # Make sure to replace your passphrase and remove or adapt the id mapping
$ docker run --rm \
$ docker-compose run --rm consumer document_exporter /export --volumes-from paperless_data_1 \
--volume /path/to/arbitrary/place:/export \
3. Use ``docker run`` directly, supplying the necessary commandline options: -e PAPERLESS_PASSPHRASE=YOUR_PASSPHRASE \
-e USERMAP_UID=1000 -e USERMAP_GID=1000 \
.. code-block:: shell-session 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: .. _migrating-restoring: