Fix: Make management commands aware of the container environment (#9499)

This commit is contained in:
Trenton H
2025-03-26 14:17:10 -07:00
committed by GitHub
parent 6e694ad9ff
commit 9c68100dc0
11 changed files with 44 additions and 15 deletions

View File

@@ -24,8 +24,10 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -20,8 +20,9 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -24,7 +24,7 @@
# - Click 'Deploy the stack' and wait for it to be deployed
# - Open the list of containers, select paperless_webserver_1
# - Click 'Console' and then 'Connect' to open the command line inside the container
# - Run 'python3 manage.py createsuperuser' to create a user
# - Run 'createsuperuser' to create a user
# - Exit the console
#
# For more extensive installation and update instructions, refer to the

View File

@@ -24,8 +24,9 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -20,8 +20,9 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -24,8 +24,9 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -17,8 +17,9 @@
# - Copy this file as 'docker-compose.yml' and the files 'docker-compose.env'
# and '.env' into a folder.
# - Run 'docker compose pull'.
# - Run 'docker compose run --rm webserver createsuperuser' to create a user.
# - Run 'docker compose up -d'.
# - Wait until the webserver has completed startup
# - Run 'docker compose exec webserver createsuperuser' to create a user.
#
# For more extensive installation and update instructions, refer to the
# documentation.

View File

@@ -18,9 +18,10 @@ for command in decrypt_documents \
document_fuzzy_match \
manage_superuser \
convert_mariadb_uuid \
prune_audit_logs;
prune_audit_logs \
createsuperuser;
do
echo "installing $command..."
sed "s/management_command/$command/g" management_script.sh >"$PWD/rootfs/usr/local/bin/$command"
chmod +x "$PWD/rootfs/usr/local/bin/$command"
chmod u=rwx,g=rwx,o=rx "$PWD/rootfs/usr/local/bin/$command"
done

View File

@@ -0,0 +1,14 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
set -e
cd "${PAPERLESS_SRC_DIR}"
if [[ $(id -u) == 0 ]]; then
s6-setuidgid paperless python3 manage.py createsuperuser "$@"
elif [[ $(id -un) == "paperless" ]]; then
python3 manage.py createsuperuser "$@"
else
echo "Unknown user."
fi