mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Merge branch 'dev' into feature/superuser-manager
# Conflicts: # docker/docker-entrypoint.sh
This commit is contained in:
commit
4f9ae17059
@ -79,6 +79,7 @@ RUN cd docker \
|
|||||||
&& mkdir /var/log/supervisord /var/run/supervisord \
|
&& mkdir /var/log/supervisord /var/run/supervisord \
|
||||||
&& cp supervisord.conf /etc/supervisord.conf \
|
&& cp supervisord.conf /etc/supervisord.conf \
|
||||||
&& cp docker-entrypoint.sh /sbin/docker-entrypoint.sh \
|
&& cp docker-entrypoint.sh /sbin/docker-entrypoint.sh \
|
||||||
|
&& cp docker-prepare.sh /sbin/docker-prepare.sh \
|
||||||
&& chmod 755 /sbin/docker-entrypoint.sh \
|
&& chmod 755 /sbin/docker-entrypoint.sh \
|
||||||
&& chmod +x install_management_commands.sh \
|
&& chmod +x install_management_commands.sh \
|
||||||
&& ./install_management_commands.sh \
|
&& ./install_management_commands.sh \
|
||||||
|
85
docker/docker-entrypoint.sh
Normal file → Executable file
85
docker/docker-entrypoint.sh
Normal file → Executable file
@ -15,83 +15,6 @@ map_uidgid() {
|
|||||||
fi
|
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 !</dev/tcp/$host/$port ;
|
|
||||||
do
|
|
||||||
|
|
||||||
if [ $attempt_num -eq $max_attempts ]
|
|
||||||
then
|
|
||||||
echo "Unable to connect to database."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Attempt $attempt_num failed! Trying again in 5 seconds..."
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
attempt_num=$(expr "$attempt_num" + 1)
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
superuser() {
|
|
||||||
|
|
||||||
if [[ -n "${PAPERLESS_DBHOST}" ]]
|
|
||||||
then
|
|
||||||
wait_for_postgres
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "${PAPERLESS_ADMIN_USER}" ]]
|
|
||||||
then
|
|
||||||
sudo -HEu paperless python3 manage.py manage_superuser
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
migrations() {
|
|
||||||
|
|
||||||
if [[ -n "${PAPERLESS_DBHOST}" ]]
|
|
||||||
then
|
|
||||||
wait_for_postgres
|
|
||||||
fi
|
|
||||||
|
|
||||||
(
|
|
||||||
# flock is in place to prevent multiple containers from doing migrations
|
|
||||||
# simultaneously. This also ensures that the db is ready when the command
|
|
||||||
# of the current container starts.
|
|
||||||
flock 200
|
|
||||||
echo "Apply database migrations..."
|
|
||||||
sudo -HEu paperless python3 manage.py migrate
|
|
||||||
) 200>/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() {
|
initialize() {
|
||||||
map_uidgid
|
map_uidgid
|
||||||
|
|
||||||
@ -106,13 +29,12 @@ initialize() {
|
|||||||
echo "creating directory /tmp/paperless"
|
echo "creating directory /tmp/paperless"
|
||||||
mkdir -p /tmp/paperless
|
mkdir -p /tmp/paperless
|
||||||
|
|
||||||
|
set +e
|
||||||
chown -R paperless:paperless ../
|
chown -R paperless:paperless ../
|
||||||
chown -R paperless:paperless /tmp/paperless
|
chown -R paperless:paperless /tmp/paperless
|
||||||
|
set -e
|
||||||
|
|
||||||
migrations
|
sudo -HEu paperless /sbin/docker-prepare.sh
|
||||||
superuser
|
|
||||||
|
|
||||||
search_index
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_languages() {
|
install_languages() {
|
||||||
@ -168,4 +90,3 @@ else
|
|||||||
echo Executing "$@"
|
echo Executing "$@"
|
||||||
exec "$@"
|
exec "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
68
docker/docker-prepare.sh
Executable file
68
docker/docker-prepare.sh
Executable file
@ -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 !</dev/tcp/$host/$port ;
|
||||||
|
do
|
||||||
|
|
||||||
|
if [ $attempt_num -eq $max_attempts ]
|
||||||
|
then
|
||||||
|
echo "Unable to connect to database."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Attempt $attempt_num failed! Trying again in 5 seconds..."
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
attempt_num=$(expr "$attempt_num" + 1)
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
migrations() {
|
||||||
|
if [[ -n "${PAPERLESS_DBHOST}" ]]
|
||||||
|
then
|
||||||
|
wait_for_postgres
|
||||||
|
fi
|
||||||
|
|
||||||
|
(
|
||||||
|
# flock is in place to prevent multiple containers from doing migrations
|
||||||
|
# simultaneously. This also ensures that the db is ready when the command
|
||||||
|
# of the current container starts.
|
||||||
|
flock 200
|
||||||
|
echo "Apply database migrations..."
|
||||||
|
python3 manage.py migrate
|
||||||
|
) 200>/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;
|
0
docker/management_script.sh
Normal file → Executable file
0
docker/management_script.sh
Normal file → Executable file
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
</app-page-header>
|
</app-page-header>
|
||||||
|
|
||||||
<div class="w-100 mb-2 mb-sm-4">
|
<div class="sticky-top py-2 mt-n2 mt-sm-n3 py-sm-4 bg-body mx-n3 px-3">
|
||||||
<app-filter-editor [hidden]="isBulkEditing" [(filterRules)]="list.filterRules" [unmodifiedFilterRules]="unmodifiedFilterRules" #filterEditor></app-filter-editor>
|
<app-filter-editor [hidden]="isBulkEditing" [(filterRules)]="list.filterRules" [unmodifiedFilterRules]="unmodifiedFilterRules" #filterEditor></app-filter-editor>
|
||||||
<app-bulk-editor [hidden]="!isBulkEditing"></app-bulk-editor>
|
<app-bulk-editor [hidden]="!isBulkEditing"></app-bulk-editor>
|
||||||
</div>
|
</div>
|
||||||
@ -99,7 +99,7 @@
|
|||||||
<app-document-card-large [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" *ngFor="let d of list.documents; trackBy: trackByDocumentId" [document]="d" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)" (clickDocumentType)="clickDocumentType($event)" (clickMoreLike)="clickMoreLike(d.id)">
|
<app-document-card-large [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" *ngFor="let d of list.documents; trackBy: trackByDocumentId" [document]="d" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)" (clickDocumentType)="clickDocumentType($event)" (clickMoreLike)="clickMoreLike(d.id)">
|
||||||
</app-document-card-large>
|
</app-document-card-large>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table table-sm border shadow-sm" *ngIf="displayMode == 'details'">
|
<table class="table table-sm border shadow-sm" *ngIf="displayMode == 'details'">
|
||||||
<thead>
|
<thead>
|
||||||
<th></th>
|
<th></th>
|
||||||
@ -174,10 +174,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="m-n2 row row-cols-paperless-cards" *ngIf="displayMode == 'smallCards'">
|
<div class="m-n2 row row-cols-paperless-cards" *ngIf="displayMode == 'smallCards'">
|
||||||
<app-document-card-small [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" [document]="d" *ngFor="let d of list.documents; trackBy: trackByDocumentId" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)" (clickDocumentType)="clickDocumentType($event)"></app-document-card-small>
|
<app-document-card-small [selected]="list.isSelected(d)" (toggleSelected)="toggleSelected(d, $event)" [document]="d" *ngFor="let d of list.documents; trackBy: trackByDocumentId" (clickTag)="clickTag($event)" (clickCorrespondent)="clickCorrespondent($event)" (clickDocumentType)="clickDocumentType($event)"></app-document-card-small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -34,3 +34,12 @@ $paperless-card-breakpoints: (
|
|||||||
right: 0 !important;
|
right: 0 !important;
|
||||||
left: auto !important;
|
left: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sticky-top {
|
||||||
|
z-index: 1000; // below main navbar
|
||||||
|
top: calc(7rem - 2px); // height of navbar (mobile)
|
||||||
|
|
||||||
|
@media (min-width: 580px) {
|
||||||
|
top: 3.5rem; // height of navbar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,4 +4,8 @@ $primaryFaded: #d1ddd2;
|
|||||||
|
|
||||||
$theme-colors: (
|
$theme-colors: (
|
||||||
"primary": $primary
|
"primary": $primary
|
||||||
);
|
);
|
||||||
|
|
||||||
|
.bg-body {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
@ -37,6 +37,10 @@ $border-color-dark-mode: #47494f;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-body {
|
||||||
|
background-color: $bg-dark-mode !important;
|
||||||
|
}
|
||||||
|
|
||||||
.text-light {
|
.text-light {
|
||||||
color: $text-color-dark-mode !important;
|
color: $text-color-dark-mode !important;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user