diff --git a/Dockerfile b/Dockerfile index 2b06ded0f..48e48dec6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,6 +79,7 @@ RUN cd docker \ && mkdir /var/log/supervisord /var/run/supervisord \ && cp supervisord.conf /etc/supervisord.conf \ && cp docker-entrypoint.sh /sbin/docker-entrypoint.sh \ + && cp docker-prepare.sh /sbin/docker-prepare.sh \ && chmod 755 /sbin/docker-entrypoint.sh \ && chmod +x install_management_commands.sh \ && ./install_management_commands.sh \ diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh old mode 100644 new mode 100755 index 892462286..e9cfd2b7e --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -15,83 +15,6 @@ map_uidgid() { fi } - -wait_for_postgres() { - attempt_num=1 - max_attempts=5 - - echo "Waiting for PostgreSQL to start..." - - host="${PAPERLESS_DBHOST}" - port="${PAPERLESS_DBPORT}" - - if [[ -z $port ]] ; - then - port="5432" - fi - - while !/usr/src/paperless/data/migration_lock - -} - -search_index() { - index_version=1 - index_version_file=/usr/src/paperless/data/.index_version - - if [[ (! -f "$index_version_file") || $(< $index_version_file) != "$index_version" ]]; then - echo "Search index out of date. Updating..." - sudo -HEu paperless python3 manage.py document_index reindex - echo $index_version | sudo -HEu paperless tee $index_version_file >/dev/null - fi -} - initialize() { map_uidgid @@ -106,13 +29,12 @@ initialize() { echo "creating directory /tmp/paperless" mkdir -p /tmp/paperless + set +e chown -R paperless:paperless ../ chown -R paperless:paperless /tmp/paperless + set -e - migrations - superuser - - search_index + sudo -HEu paperless /sbin/docker-prepare.sh } install_languages() { @@ -168,4 +90,3 @@ else echo Executing "$@" exec "$@" fi - diff --git a/docker/docker-prepare.sh b/docker/docker-prepare.sh new file mode 100755 index 000000000..53f5201e4 --- /dev/null +++ b/docker/docker-prepare.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +wait_for_postgres() { + attempt_num=1 + max_attempts=5 + + echo "Waiting for PostgreSQL to start..." + + host="${PAPERLESS_DBHOST}" + port="${PAPERLESS_DBPORT}" + + if [[ -z $port ]] ; + then + port="5432" + fi + + while !/usr/src/paperless/data/migration_lock +} + +search_index() { + index_version=1 + index_version_file=/usr/src/paperless/data/.index_version + + if [[ (! -f "$index_version_file") || $(< $index_version_file) != "$index_version" ]]; then + echo "Search index out of date. Updating..." + python3 manage.py document_index reindex + echo $index_version | tee $index_version_file >/dev/null + fi +} + +do_work() { + migrations; + + search_index; +} + +do_work; diff --git a/docker/management_script.sh b/docker/management_script.sh old mode 100644 new mode 100755 diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index 45b6fad37..1b805bb2e 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -75,7 +75,7 @@ -
@@ -174,10 +174,10 @@ |
---|